Debian Codegraph @

src/network/cyberoroconnection.cpp

raw symbols SCIP
1 /***************************************************************************
2 * Copyright (C) 2011 by The qGo Project *
3 * *
4 * This file is part of qGo. *
5 * *
6 * qGo is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, see <http://www.gnu.org/licenses/> *
18 * or write to the Free Software Foundation, Inc., *
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
20 ***************************************************************************/
21
22
23 #include <string.h>
24 #include <math.h>
25 #include "cyberoroconnection.h"cxx . . $ `<file>/src/network/cyberoroconnection.h`/
26 #include "cyberoroprotocol.h"cxx . . $ `<file>/src/network/cyberoroprotocol.h`/
27 #include "consoledispatch.h"cxx . . $ `<file>/src/network/consoledispatch.h`/
28 #include "room.h"cxx . . $ `<file>/src/network/room.h`/
29 #include "boarddispatch.h"cxx . . $ `<file>/src/network/boarddispatch.h`/
30 #include "gamedialog.h"cxx . . $ `<file>/src/network/gamedialog.h`/
31 #include "talk.h"cxx . . $ `<file>/src/network/talk.h`/
32 #include "serverlistdialog.h"cxx . . $ `<file>/src/network/serverlistdialog.h`/
33 #include "codecwarndialog.h"cxx . . $ `<file>/src/network/codecwarndialog.h`/
34 #include "matchinvitedialog.h"cxx . . $ `<file>/src/network/matchinvitedialog.h`/
35 #include "gamedialogflags.h"cxx . . $ `<file>/src/network/gamedialogflags.h`/
36 #include "orosetphrasechat.h"cxx . . $ `<file>/src/network/orosetphrasechat.h`/
37 #include "setphrasepalette.h"cxx . . $ `<file>/src/network/setphrasepalette.h`/
38 #include "createroomdialog.h"cxx . . $ `<file>/src/network/createroomdialog.h`/
39 #include "gamedata.h"cxx . . $ `<file>/src/gamedata.h`/
40 #include "playergamelistings.h"cxx . . $ `<file>/src/network/playergamelistings.h`/
41 #include "quickconnection.h"cxx . . $ `<file>/src/network/quickconnection.h`/
42 #include "matchnegotiationstate.h"cxx . . $ `<file>/src/network/matchnegotiationstate.h`/
43 #include <QMessageBox>
44
45 #ifdef NEWPROTOCOL
46 #include "protocol.h"
47 #endif //NEWPROTOCOL
48
49 #define ALLOW_ALL_INVITEScxx . . $ `src/network/cyberoroconnection.cpp:49:9`! 0
50 #define ALLOW_STRONGER_INVITEcxx . . $ `src/network/cyberoroconnection.cpp:50:9`! 1
51 #define ALLOW_EVEN_INVITEcxx . . $ `src/network/cyberoroconnection.cpp:51:9`! 2
52 #define ALLOW_WEAKER_INVITEcxx . . $ `src/network/cyberoroconnection.cpp:52:9`! 3
53 #define ALLOW_PAIR_INVITEcxx . . $ `src/network/cyberoroconnection.cpp:53:9`! 4
54 #define IGNORE_ALL_INVITEScxx . . $ `src/network/cyberoroconnection.cpp:54:9`! 5
55
56 #define PLAYERLIST_SKIPNUMBER_UNSETcxx . . $ `src/network/cyberoroconnection.cpp:56:9`! 0xffff
57
58 //#define RE_DEBUG
59
60 const char * KoreanCodeccxx . . $ KoreanCodec. = "eucKR";
61 const char * ChineseCodeccxx . . $ ChineseCodec. = "GB2312";
62 const char * JapaneseCodeccxx . . $ JapaneseCodec. = "Shift-JIS";
63 const char * LatinCodeccxx . . $ LatinCodec. = "ISO-8859-1";
64
65 CyberOroConnectioncxx . . $ CyberOroConnection#::CyberOroConnectioncxx . . $ CyberOroConnection#CyberOroConnection(231cf4fc7da7cd6f).(const ConnectionCredentialscxx . . $ ConnectionCredentials# credentials)
66 : NetworkConnectioncxx . . $ NetworkConnection#NetworkConnection(231cf4fc7da7cd6f).(credentials)
67 {
68 //Note that this is not world.cyberoro.com
69 //which right now is 91.91.
70 //This is gateway server which is sent login
71 //information and authenticates us to other
72 //servers that are provided on a list. */
73 if(openConnectioncxx . . $ NetworkConnection#openConnection(6f40ee5c4c30d87e).(hostnamecxx . . $ NetworkConnection#hostname., portcxx . . $ NetworkConnection#port., NOT_MAIN_CONNECTIONcxx . . $ `src/network/networkconnection.h:64:9`!))
74 {
75 setStatecxx . . $ NetworkConnection#setState(41e728cff2b23034).(Logincxx . . $ Login.);
76 }
77 else
78 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Can't open Connection\n"); //throw error?
79
80 textCodeccxx . . $ CyberOroConnection#textCodec. = QTextCodeccxx . . $ QTextCodec#::codecForLocalecxx . . $ QTextCodec#codecForLocale(6599407a1b23811).();
81 serverCodeccxx . . $ CyberOroConnection#serverCodec. = QTextCodeccxx . . $ QTextCodec#::codecForLocalecxx . . $ QTextCodec#codecForLocale(6599407a1b23811).();
82 //FIXME check for validity of codecs ???
83 ORO_setup_setphrasescxx . . $ ORO_setup_setphrases(49f6e7a06ebc5aa8).();
84
85 current_server_indexcxx . . $ CyberOroConnection#current_server_index. = -1;
86 challenge_responsecxx . . $ CyberOroConnection#challenge_response. = 0;
87 codetablecxx . . $ CyberOroConnection#codetable. = 0;
88
89 room_were_incxx . . $ CyberOroConnection#room_were_in. = 0; //lobby?
90 connecting_to_game_numbercxx . . $ CyberOroConnection#connecting_to_game_number. = 0;
91
92 matchKeepAliveTimerIDcxx . . $ CyberOroConnection#matchKeepAliveTimerID. = 0;
93 matchRequestKeepAliveTimerIDcxx . . $ CyberOroConnection#matchRequestKeepAliveTimerID. = 0;
94
95 /* We should either create the palette on creation of
96 * the connection, or have a button to activate it that
97 * appears when the room is connected */
98 setphrasepalettecxx . . $ CyberOroConnection#setphrasepalette. = new SetPhrasePalettecxx . . $ SetPhrasePalette#SetPhrasePalette(8f41bc275abc9962).(this);
99 setphrasepalettecxx . . $ CyberOroConnection#setphrasepalette.->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).();
100 }
101
102 CyberOroConnectioncxx . . $ CyberOroConnection#::~cxx . . $ CyberOroConnection#`~CyberOroConnection`(ced63f7c635d850d).CyberOroConnectioncxx . . $ CyberOroConnection#()
103 {
104 if(setphrasepalettecxx . . $ CyberOroConnection#setphrasepalette.)
105 delete setphrasepalettecxx . . $ CyberOroConnection#setphrasepalette.;
106 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Destroying CyberORO connection");
107 closeConnectioncxx . . $ NetworkConnection#closeConnection(b45ddcbc8423892c).();
108 stdcxx . . $ std/::vectorcxx . . $ std/vector#<ServerItem*>::iteratorcxx . . $ std/vector#iterator# iter;
109 for(iter = serverListcxx . . $ CyberOroConnection#serverList..begincxx . . $ std/vector#begin(55a6de06420d4903).(); iter != serverListcxx . . $ CyberOroConnection#serverList..endcxx . . $ std/vector#end(55a6de06420d4903).(); iter++)
110 delete *iter;
111 if(challenge_responsecxx . . $ CyberOroConnection#challenge_response.)
112 delete[] challenge_responsecxx . . $ CyberOroConnection#challenge_response.;
113 if(codetablecxx . . $ CyberOroConnection#codetable.)
114 delete[] codetablecxx . . $ CyberOroConnection#codetable.;
115 }
116
117 void CyberOroConnectioncxx . . $ CyberOroConnection#::OnConnectedcxx . . $ CyberOroConnection#OnConnected(49f6e7a06ebc5aa8).()
118 {
119 /* Likely client version info */
120 if(connectionStatecxx . . $ NetworkConnection#connectionState. == Logincxx . . $ Login.)
121 {
122 sendLogincxx . . $ CyberOroConnection#sendLogin(49f6e7a06ebc5aa8).();
123 }
124 }
125
126 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendTextcxx . . $ CyberOroConnection#sendText(7df51288a9ebd664).(QStringcxx . . $ QString#)
127 {
128 return;
129 }
130
131 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendDisconnectcxx . . $ CyberOroConnection#sendDisconnect(49f6e7a06ebc5aa8).(void)
132 {
133 /* Yeah, FIXME, we don't want to send this
134 * when we're reconnecting... which means we
135 * need a special connection state ... yada yada */
136 if(connectionStatecxx . . $ NetworkConnection#connectionState. == Connectedcxx . . $ Connected.)
137 sendDisconnectMsgcxx . . $ CyberOroConnection#sendDisconnectMsg(49f6e7a06ebc5aa8).();
138 }
139
140 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendTextcxx . . $ CyberOroConnection#sendText(85c52e162fed56f9).(const char * text)
141 {
142 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Wanted to send %s", text);
143 return;
144 }
145
146 /* What about a room_id?? */
147 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendMsgcxx . . $ CyberOroConnection#sendMsg(679a3afc1f0f3212).(unsigned int id, QStringcxx . . $ QString# text)
148 {
149 if(id == 0)
150 {
151 sendServerChatcxx . . $ CyberOroConnection#sendServerChat(7df51288a9ebd664).(textcxx . . $ QString#QString(132dd6869045752b).);
152 return;
153 }
154 sendRoomChatcxx . . $ CyberOroConnection#sendRoomChat(85c52e162fed56f9).(text.toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).());
155 }
156
157 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendMsgcxx . . $ CyberOroConnection#sendMsg(c3abbc2f7b873519).(PlayerListingcxx . . $ PlayerListing# * player, QStringcxx . . $ QString# text)
158 {
159 sendPersonalChatcxx . . $ CyberOroConnection#sendPersonalChat(7ed01115d689877).(player, text.toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).());
160 }
161
162 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendTogglecxx . . $ CyberOroConnection#sendToggle(37c160c81b6367f7).(const QStringcxx . . $ QString# & param, bool val)
163 {
164 /* FIXME, more to do here probably */
165 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Setting open %d", val);
166 if(param ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "open")
167 sendInvitationSettingscxx . . $ CyberOroConnection#sendInvitationSettings(b45ddcbc8423892c).(val);
168 }
169
170 /* If we can observe something besides games,
171 * like rooms or people, then this name is a bit
172 * iffy too... */
173 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendObservecxx . . $ CyberOroConnection#sendObserve(963dc8955d49573e).(const GameListingcxx . . $ GameListing# *game)
174 {
175 connecting_to_game_numbercxx . . $ CyberOroConnection#connecting_to_game_number. = game->numbercxx . . $ GameListing#number.;
176 sendObserveAfterJoiningcxx . . $ CyberOroConnection#sendObserveAfterJoining(963dc8955d49573e).(game);
177 }
178
179 void CyberOroConnectioncxx . . $ CyberOroConnection#::adjournGamecxx . . $ CyberOroConnection#adjournGame(963dc8955d49573e).(const GameListingcxx . . $ GameListing# * )
180 {
181 }
182
183 void CyberOroConnectioncxx . . $ CyberOroConnection#::closeBoardDispatchcxx . . $ CyberOroConnection#closeBoardDispatch(cb2f890c2fdad230).(unsigned int game_id)
184 {
185 /* This isn't quite right, we need to send a leave if
186 * we close a window, but its not necessarily an adjournGame.
187 * At the same time, I think dispatch needs to remain open
188 * after game like a room, to talk in */
189 GameListingcxx . . $ GameListing# * g = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(game_id);
190 /* I've been saving boards that have results but I think maybe that's
191 * supposed to be for betting matches in general. I.e., we should check
192 * here if we need to save the board */
193 if(g->isBettingcxx . . $ GameListing#isBetting. || g->resultcxx . . $ GameListing#result. !=cxx . . $ `operator!=`(5bc2975d2d751687). QStringcxx . . $ QString#QString(ced63f7c635d850d).())
194 {
195 BoardDispatchcxx . . $ BoardDispatch# * b = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_id);
196 b->saveRecordToGameDatacxx . . $ BoardDispatch#saveRecordToGameData(49f6e7a06ebc5aa8).();
197 }
198 /* Looks like finish observing is sent for both
199 * also possibly finish observing used in matches somehow as well? */
200 /* Order here matters apparently, leave is for leaving the room,
201 FinishObserving says we're no longer looking at board.
202 FIXME doublecheck
203 No, that didn't fix it.*/
204 if(room_were_incxx . . $ CyberOroConnection#room_were_in. == g->numbercxx . . $ GameListing#number.)
205 sendLeavecxx . . $ CyberOroConnection#sendLeave(963dc8955d49573e).(g);
206 sendFinishObservingcxx . . $ CyberOroConnection#sendFinishObserving(963dc8955d49573e).(g);
207
208 NetworkConnectioncxx . . $ NetworkConnection#::closeBoardDispatchcxx . . $ NetworkConnection#closeBoardDispatch(cb2f890c2fdad230).(game_id);
209 }
210
211
212 /* I'd like to just send the match invite, but only if we're not
213 * in the same room... actually, maybe its almost like a room invite */
214 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendMatchRequestcxx . . $ CyberOroConnection#sendMatchRequest(969a5d62d7a1bd6e).(MatchRequestcxx . . $ MatchRequest# * mr)
215 {
216 /* Right now, we're working with this from the stand point of
217 * the counter offer. The gamedialog needs to check if
218 * anything has changed and then do acceptOffer. */
219 sendMatchOffercxx . . $ CyberOroConnection#sendMatchOffer(9a796e385859106a).(*mr, true);
220 }
221
222 /* Note that we could ignore the dispute time one and change whatever
223 * we wanted to, but its kind of cheap to the other player who can't
224 * see what we changed. */
225 unsigned long CyberOroConnectioncxx . . $ CyberOroConnection#::getGameDialogFlagscxx . . $ CyberOroConnection#getGameDialogFlags(f708dce9a8856c70).(void)
226 {
227 return (GDF_CANADIANcxx . . $ `src/network/gamedialogflags.h:26:9`! | GDF_BYOYOMIcxx . . $ `src/network/gamedialogflags.h:27:9`! | GDF_TVASIAcxx . . $ `src/network/gamedialogflags.h:28:9`! | GDF_FREE_RATED_CHOICEcxx . . $ `src/network/gamedialogflags.h:30:9`!
228 | GDF_RATED_SIZE_FIXEDcxx . . $ `src/network/gamedialogflags.h:31:9`! | GDF_RATED_HANDICAP_FIXEDcxx . . $ `src/network/gamedialogflags.h:32:9`!
229 | GDF_NIGIRI_EVENcxx . . $ `src/network/gamedialogflags.h:34:9`! | GDF_ONLY_DISPUTE_TIMEcxx . . $ `src/network/gamedialogflags.h:35:9`!
230 | GDF_BY_CAN_MAIN_MINcxx . . $ `src/network/gamedialogflags.h:36:9`!);
231 }
232
233 void CyberOroConnectioncxx . . $ CyberOroConnection#::declineMatchOffercxx . . $ CyberOroConnection#declineMatchOffer(cac334474c82cf3a).(const PlayerListingcxx . . $ PlayerListing# * opponent)
234 {
235 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Declining match offer");
236 /* If this is our offer, we need to sendMatchOfferCancel FIXME */
237 sendDeclineMatchOffercxx . . $ CyberOroConnection#sendDeclineMatchOffer(cac334474c82cf3a).(opponent);
238 // do we also need to leave the room?
239 }
240
241 void CyberOroConnectioncxx . . $ CyberOroConnection#::cancelMatchOffercxx . . $ CyberOroConnection#cancelMatchOffer(cac334474c82cf3a).(const PlayerListingcxx . . $ PlayerListing# * opponent)
242 {
243 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Canceling match offer");
244 sendMatchOfferCancelcxx . . $ CyberOroConnection#sendMatchOfferCancel(cac334474c82cf3a).(opponent);
245 }
246
247 void CyberOroConnectioncxx . . $ CyberOroConnection#::acceptMatchOffercxx . . $ CyberOroConnection#acceptMatchOffer(27875a747def42ce).(const PlayerListingcxx . . $ PlayerListing# * /*opponent*/, MatchRequestcxx . . $ MatchRequest# * mr)
248 {
249 /* FIXME, we should really just move the real code in here instead
250 * of the extra layer of indication... when its done. */
251 sendMatchOffercxx . . $ CyberOroConnection#sendMatchOffer(9a796e385859106a).(*mr);
252 }
253
254 void CyberOroConnectioncxx . . $ CyberOroConnection#::handlePendingDatacxx . . $ CyberOroConnection#handlePendingData(49f6e7a06ebc5aa8).()
255 {
256 unsigned char * c;
257 unsigned char header[4];
258 unsigned int packet_size;
259 int bytes;
260
261 /* We need better connection states, but we'll use the old
262 * for now */
263
264 switch(connectionStatecxx . . $ NetworkConnection#connectionState.)
265 {
266 case Logincxx . . $ Login.:
267 bytes = qsocketcxx . . $ NetworkConnection#qsocket.->bytesAvailablecxx . . $ QAbstractSocket#bytesAvailable(98833e9ab7de59a4).();
268 if(bytes)
269 {
270 QByteArraycxx . . $ QByteArray# data = qsocketcxx . . $ NetworkConnection#qsocket.->readAllcxx . . $ QIODevice#readAll(b3c286cec66e09f4).();
271 //0004064d
272
273 #ifdef RE_DEBUG
274 for(int i = 0; i < bytes; i++)
275 printf("%02x", c[i]);
276 printf("\n");
277 #endif //RE_DEBUG
278 //1f27080015270000
279 if(data.constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()[0] == 0x1f)
280 {
281 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("CyberOroConnection::handlePendingData() : Bad password or login");
282 setStatecxx . . $ NetworkConnection#setState(41e728cff2b23034).(PassFailedcxx . . $ PassFailed.);
283 //closeConnection();
284 return;
285 }
286 /* First packet is list of servers and ips */
287 else if(data.constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()[0] == 0x24)
288 handleServerListcxx . . $ CyberOroConnection#handleServerList(f25546b61a629de7).((unsigned char *)data.datacxx . . $ QByteArray#data(41208ce6ca65dd58).());
289 }
290 break;
291 case Connectedcxx . . $ Connected.:
292 while((bytes = qsocketcxx . . $ NetworkConnection#qsocket.->bytesAvailablecxx . . $ QAbstractSocket#bytesAvailable(98833e9ab7de59a4).()) > 0)
293 {
294 qsocketcxx . . $ NetworkConnection#qsocket.->peekcxx . . $ QIODevice#peek(2e638bc8ed65be6c).((char *)header, 4);
295 #ifdef RE_DEBUG
296 printf("%02x%02x%02x%02x\n", header[0], header[1], header[2], header[3]);
297 #endif //RE_DEBUG
298 packet_size = header[2] + (header[3] << 8);
299 if((unsigned)bytes < packet_size)
300 break;
301 c = new unsigned char[packet_size];
302 qsocketcxx . . $ NetworkConnection#qsocket.->readcxx . . $ QIODevice#read(2e638bc8ed65be6c).((char*)c, packet_size);
303 handleMessagecxx . . $ CyberOroConnection#handleMessage(e1e8b00c42c42532).(c, packet_size);
304 delete[] c;
305 }
306 break;
307 case Canceledcxx . . $ Canceled.:
308 case Reconnectingcxx . . $ Reconnecting.:
309 break;
310 /*case AUTH_FAILED:
311 qDebug("Auth failed\n");
312 break;*/
313 default:
314 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("connection state not handled by ORO");
315 break;
316 }
317 }
318
319 /* FIXME, these need to be const msg refs I think */
320 /* They also need to be reordered in a more intuitive manner
321 * after we get the IGS cruft out */
322 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleServerListcxx . . $ CyberOroConnection#handleServerList(f25546b61a629de7).(unsigned char * msg)
323 {
324 unsigned char * p = msg;
325 unsigned char * s;
326 int servers, i;
327 int ip_string_length, server_name_length;
328 ServerItemcxx . . $ ServerItem# * si;
329
330 if(p[0] != 0x24 || p[1] != 0x27)
331 {
332 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Non standard server list msg header"); //unnecessary check FIXME
333 printf("%02x %02x", p[0], p[1]);
334 }
335 p += 4;
336 challenge_responsecxx . . $ CyberOroConnection#challenge_response. = new unsigned char[106];
337 for(i = 0; i < 106; i++)
338 challenge_responsecxx . . $ CyberOroConnection#challenge_response.[i] = p[i];
339 p += 108; //106 + 01 00
340 servers = p[1];
341 /* FIXME, I no longer think that this is the number of
342 * servers. I think there are always 8 */
343 /* Actually, I think it is the number of servers but some of them
344 * are not game servers... */
345 servers = 8;
346 #ifdef RE_DEBUG
347 qDebug("Servers: %d", servers);
348 printf("\n");
349 for(i = 0; i < 20; i++)
350 printf("%02x ", p[i]);
351 printf("\n");
352 #endif //RE_DEBUG
353 p += 2;
354 for(i = 0; i < servers; i++)
355 {
356 /* If the first byte is 0x0a, right before the ip, that
357 * might indicate full, the byte before that then might
358 * be the language of the previous server entry. */
359 si = new ServerItemcxx . . $ ServerItem#();
360 ip_string_length = 0;
361 server_name_length = 0;
362 s = p + 16;
363 strncpy(si->ipaddresscxx . . $ ServerItem#ipaddress., (const char *)p, 16);
364 while(p < s && *p != 0x00)
365 {
366 #ifdef RE_DEBUG
367 printf("%c", *p);
368 #endif //RE_DEBUG
369 p++;
370 ip_string_length++;
371 }
372 #ifdef RE_DEBUG
373 printf(" -> ");
374 #endif //RE_DEBUG
375 // pad out to 15 (max ip length
376 p += (16 - ip_string_length);
377 s = p + 16;
378 //strncpy(si->name, (const char *)p, 18);
379 si->namecxx . . $ ServerItem#name. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).((char *)p);
380 while(p < s && *p != 0x00)
381 {
382 #ifdef RE_DEBUG
383 printf("%c", *p);
384 #endif //RE_DEBUG
385 p++;
386 server_name_length++;
387 }
388
389 p += (16 - server_name_length);
390 printf("\n");
391 serverListcxx . . $ CyberOroConnection#serverList..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(si);
392 #ifdef RE_DEBUG
393 printf("Language byte: %02x\n", p[0]);
394 #endif //RE_DEBUG
395 switch(p[0])
396 {
397 case 1:
398 si->codeccxx . . $ ServerItem#codec. = (char *)KoreanCodeccxx . . $ KoreanCodec.;
399 break;
400 case 2:
401 si->codeccxx . . $ ServerItem#codec. = (char *)ChineseCodeccxx . . $ ChineseCodec.;
402 break;
403 case 3:
404 si->codeccxx . . $ ServerItem#codec. = (char *)JapaneseCodeccxx . . $ JapaneseCodec.;
405 break;
406 case 6:
407 si->codeccxx . . $ ServerItem#codec. = (char *)LatinCodeccxx . . $ LatinCodec.;
408 break;
409 default:
410 break;
411 }
412 p += 2;
413 }
414 /* We should really check for overflows here so that we don't run out
415 * of packet. FIXME FIXME FIXME 1046 bytes every time*/
416
417 /* We close here because this first time, its going to close
418 * anyway, and if we don't close here, we'll get an error
419 * and lose the object */
420
421
422 //requestAccountInfo(); //this will close this connection
423 closeConnectioncxx . . $ NetworkConnection#closeConnection(b45ddcbc8423892c).(false);
424 setStatecxx . . $ NetworkConnection#setState(41e728cff2b23034).(Reconnectingcxx . . $ Reconnecting.);
425 requestAccountInfocxx . . $ CyberOroConnection#requestAccountInfo(49f6e7a06ebc5aa8).();
426 if(reconnectToServercxx . . $ CyberOroConnection#reconnectToServer(b126dc7c1de90089).() < 0)
427 {
428 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("User canceled");
429 setStatecxx . . $ NetworkConnection#setState(41e728cff2b23034).(Canceledcxx . . $ Canceled.);
430 return;
431 }
432 }
433
434 void CyberOroConnectioncxx . . $ CyberOroConnection#::changeServercxx . . $ CyberOroConnection#changeServer(49f6e7a06ebc5aa8).(void)
435 {
436 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("changeServer called");
437 if(connectionStatecxx . . $ NetworkConnection#connectionState. != Connectedcxx . . $ Connected.)
438 return;
439 if(reconnectToServercxx . . $ CyberOroConnection#reconnectToServer(b126dc7c1de90089).() < 0)
440 {
441 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("User canceled");
442 return;
443 }
444 }
445
446 void CyberOroConnectioncxx . . $ CyberOroConnection#::createRoomcxx . . $ CyberOroConnection#createRoom(49f6e7a06ebc5aa8).(void)
447 {
448 CreateRoomDialogcxx . . $ CreateRoomDialog# * createroomdialog = new CreateRoomDialogcxx . . $ CreateRoomDialog#(this);
449 createroomdialog->execcxx . . $ QDialog#exec(b126dc7c1de90089).();
450 }
451
452 /* FIXME we need error handling here, a return value, something
453 * or at least we need to call the right destructors throughout,
454 * and safely. */
455 int CyberOroConnectioncxx . . $ CyberOroConnection#::reconnectToServercxx . . $ CyberOroConnection#reconnectToServer(b126dc7c1de90089).(void)
456 {
457 /* FIXME, we need to add something to specify the server we're
458 * currently on */
459 /* FIXME, why does the serverReconnectDialog disappear the ui
460 * elements in the server window ?!?!? */
461 ServerListDialogcxx . . $ ServerListDialog# * serverReconnectDialog = new ServerListDialogcxx . . $ ServerListDialog#(serverListcxx . . $ std/vector#vector(a1201200cf0efa42)., current_server_indexcxx . . $ CyberOroConnection#current_server_index.);
462 int server_i = serverReconnectDialog->execcxx . . $ QDialog#exec(b126dc7c1de90089).();
463 if(server_i < 0 || server_i == QDialogcxx . . $ QDialog#::Rejectedcxx . . $ QDialog#Rejected.)
464 return -1;
465 server_i--;
466 if(!this)
467 {
468 /* FIXME, this needs to be much better. It should be,
469 * to start with, irrelevant. */
470 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Waited too long to connect");
471 return -1;
472 }
473 current_server_indexcxx . . $ CyberOroConnection#current_server_index. = server_i;
474
475 /* FIXME
476 * Might be neat if we listed the server that one was currently on
477 * somewhere, like on the main window. */
478 if(serverListcxx . . $ CyberOroConnection#serverList..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() <= (unsigned)server_i)
479 {
480 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("serverList has probably been freed when you weren't looking");
481 return -1;
482 }
483
484 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Reconnecting to %s: %s...", serverListcxx . . $ CyberOroConnection#serverList.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).server_i]->namecxx . . $ ServerItem#name..toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).(), serverListcxx . . $ CyberOroConnection#serverList.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).server_i]->ipaddresscxx . . $ ServerItem#ipaddress.);
485
486 if(connectionStatecxx . . $ NetworkConnection#connectionState. == Connectedcxx . . $ Connected.)
487 closeConnectioncxx . . $ NetworkConnection#closeConnection(b45ddcbc8423892c).(false);
488 /* Though connection isn't really negotiated yet,
489 * we can get here without a playerListingIDRegistry as soon
490 * as the connection is opened, so we're going to do this
491 * first. FIXME for other protocols */
492 onAuthenticationNegotiatedcxx . . $ NetworkConnection#onAuthenticationNegotiated(49f6e7a06ebc5aa8).();
493 if(openConnectioncxx . . $ NetworkConnection#openConnection(6f40ee5c4c30d87e).(serverListcxx . . $ QString#QString(85c52e162fed56f9).[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).server_i]->ipaddresscxx . . $ ServerItem#ipaddress., 7002))
494 {
495 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Reconnected");
496 setStatecxx . . $ NetworkConnection#setState(41e728cff2b23034).(Connectedcxx . . $ Connected.);
497 game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number..clearcxx . . $ std/map#clear(ced63f7c635d850d).();
498 }
499 else
500 {
501 /* FIXME This can happen, for instance two of the china servers gave connection refused errors
502 * which left the select server drop down menu grayed out!!! Add handling for this! */
503 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Can't open Connection!!");
504 }
505 /* FIXME, really we should set server init variables in a function
506 * called from here on every reconnect, not on connection object allocation*/
507 playerlist_skipnumbercxx . . $ CyberOroConnection#playerlist_skipnumber. = PLAYERLIST_SKIPNUMBER_UNSETcxx . . $ `src/network/cyberoroconnection.cpp:56:9`!;
508 playerlist_receivedcxx . . $ CyberOroConnection#playerlist_received. = 0;
509 roomlist_observerscxx . . $ CyberOroConnection#roomlist_observers. = 0;
510 playerlist_roomnumbercxx . . $ CyberOroConnection#playerlist_roomnumber. = 1;
511 playerlist_observernumbercxx . . $ CyberOroConnection#playerlist_observernumber. = 0;
512
513 if(server_i > 6)
514 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Please don't try to connect to the voice, we don't know what that is");
515
516 serverCodeccxx . . $ CyberOroConnection#serverCodec. = QTextCodeccxx . . $ QTextCodec#::codecForNamecxx . . $ QTextCodec#codecForName(914382192c9ca379).(getCodecStringcxx . . $ CyberOroConnection#getCodecString(33a1f659e94feb42).());
517 if(!serverCodeccxx . . $ CyberOroConnection#serverCodec.)
518 {
519 new CodecWarnDialogcxx . . $ CodecWarnDialog#(getCodecStringcxx . . $ CyberOroConnection#getCodecString(33a1f659e94feb42).());
520 serverCodeccxx . . $ CyberOroConnection#serverCodec. = QTextCodeccxx . . $ QTextCodec#::codecForLocalecxx . . $ QTextCodec#codecForLocale(6599407a1b23811).();
521 }
522
523 // this is the initial packet
524 const unsigned char packet[8] = { 0x0a, 0xfa, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 };
525 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, 8) < 0)
526 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending init packet to reconnected host");
527 return 0;
528 }
529
530 /* Check comment in networkconnection code, FIXME */
531 // Why is this function different for this connection type?
532 // Because player tracking is by ID, not name, for CyberOro
533 const PlayerListingcxx . . $ PlayerListing# * CyberOroConnectioncxx . . $ CyberOroConnection#::getOurListingcxx . . $ CyberOroConnection#getOurListing(c84291d55c8466c6).(void)
534 {
535 ourListingcxx . . $ NetworkConnection#ourListing. = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(our_player_idcxx . . $ CyberOroConnection#our_player_id.);
536 return ourListingcxx . . $ NetworkConnection#ourListing.;
537 }
538
539 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendPersonalChatcxx . . $ CyberOroConnection#sendPersonalChat(7ed01115d689877).(const PlayerListingcxx . . $ PlayerListing# * player, const char * text)
540 {
541 unsigned int length = strlen(text) + 12;
542 char *packet = new char[length];
543 int i;
544
545 packet[0] = 0xe2;
546 packet[1] = 0x59;
547 packet[2] = length & 0x00ff;
548 packet[3] = (length >> 8);
549 packet[4] = player->idcxx . . $ PlayerListing#id. & 0x00ff;
550 packet[5] = (player->idcxx . . $ PlayerListing#id. >> 8);
551 packet[6] = player->specialbytecxx . . $ PlayerListing#specialbyte.;
552 packet[7] = 0x00;
553 packet[8] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
554 packet[9] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
555 //their id 93[62]00 (maybe a room), id?, 00 00
556 packet[10] = 0x00;
557 packet[11] = 0x00;
558 for(i = 12; i < (int)length; i++)
559 packet[i] = text[i - 12];
560 #ifdef RE_DEBUG
561 printf("Before encode\n");
562 for(i = 0; i < (int)length; i++)
563 printf("%02x ", (unsigned char)packet[i]);
564 printf("\n");
565 #endif //RE_DEBUG
566 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).((unsigned char *)packet, 0xc);
567 #ifdef RE_DEBUG
568 printf("Sending personal chat\n");
569 for(i = 0; i < (int)length; i++)
570 printf("%02x ", (unsigned char)packet[i]);
571 printf("\n");
572 #endif //RE_DEBUG
573 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
574 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending personal chat");
575 delete[] packet;
576 }
577
578 // there's a room chat, looks like
579 //ec 59 size our_id 00 00 text with encode 8
580 /* But I don't see the room id so I'm confused */
581 //FIXME
582 /* Now I'm thinking it just goes to the room we're in */
583 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendRoomChatcxx . . $ CyberOroConnection#sendRoomChat(85c52e162fed56f9).(const char * text)
584 {
585 unsigned int length = strlen(text) + 8;
586 char *packet = new char[length];
587 int i;
588
589 packet[0] = 0xec;
590 packet[1] = 0x59;
591 packet[2] = length & 0x00ff;
592 packet[3] = (length >> 8);
593 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
594 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
595 packet[6] = 0x00;
596 packet[7] = 0x00; //dc? font?
597 for(i = 8; i < (int)length; i++)
598 packet[i] = text[i - 8];
599 #ifdef RE_DEBUG
600 printf("Before encode\n");
601 for(i = 0; i < (int)length; i++)
602 printf("%02x ", (unsigned char)packet[i]);
603 printf("\n");
604 #endif //RE_DEBUG
605 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).((unsigned char *)packet, 0x8);
606 #ifdef RE_DEBUG
607 printf("Sending room chat\n");
608 for(i = 0; i < (int)length; i++)
609 printf("%02x ", (unsigned char)packet[i]);
610 printf("\n");
611 #endif //RE_DEBUG
612 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
613 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending room chat");
614 delete[] packet;
615 }
616
617 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendServerChatcxx . . $ CyberOroConnection#sendServerChat(7df51288a9ebd664).(QStringcxx . . $ QString# text)
618 {
619 unsigned int length = text.sizecxx . . $ QString#size(455f465bc33b4cdf).() + 8;
620 unsigned char *packet = new unsigned char[length];
621 int i;
622
623 packet[0] = 0x0a;
624 packet[1] = 0x5a;
625 packet[2] = length & 0x00ff;
626 packet[3] = (length >> 8);
627 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
628 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
629 packet[6] = 0x00;
630 packet[7] = 0x00; //i've seen 40 here
631 for(i = 8; i < (int)length; i++)
632 packet[i] = text.toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()[i - 8];
633
634 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x8);
635 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
636 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending server char");
637 delete[] packet;
638 }
639
640 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendSetChatMsgcxx . . $ CyberOroConnection#sendSetChatMsg(ed53e3bbd3fa2f69).(unsigned short phrase_id)
641 {
642 unsigned int length = 20;
643 unsigned char *packet = new unsigned char[length];
644
645 packet[0] = 0x55;
646 packet[1] = 0xc3;
647 packet[2] = length & 0x00ff;
648 packet[3] = (length >> 8);
649 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
650 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
651 packet[6] = 0xff; //probably their id if directed?
652 packet[7] = 0xff;
653 packet[8] = 0x01;
654 packet[9] = 0x00;
655 packet[10] = 0x00;
656 packet[11] = 0x00;
657 packet[12] = phrase_id & 0x00ff;
658 packet[13] = (phrase_id >> 8);
659 packet[14] = 0x00;
660 packet[15] = 0x00;
661
662 packet[16] = 0x00;
663 packet[17] = 0x00;
664 packet[18] = 0x00;
665 packet[19] = 0x00;
666
667 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x14);
668 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
669 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending set chat msg");
670 delete[] packet;
671 }
672
673 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendJoinRoomcxx . . $ CyberOroConnection#sendJoinRoom(27567cc4e87be946).(const RoomListingcxx . . $ RoomListing# & room, const char * password)
674 {
675 unsigned int length = 18;
676 unsigned char * packet = new unsigned char[length];
677 int i;
678
679 packet[0] = 0xde;
680 packet[1] = 0x5d;
681 packet[2] = 0x12;
682 packet[3] = 0x00;;
683 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
684 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
685 packet[6] = room.numbercxx . . $ RoomListing#number. & 0x00ff;
686 packet[7] = (room.numbercxx . . $ RoomListing#number. >> 8);
687 //password padded out to ten bytes with zeroes
688 //FIXME, but password only 8 in create room???
689 if(password)
690 {
691 for(i = 0; i < (int)strlen(password); i++)
692 packet[8 + i] = password[i];
693 for(i = 9; i >= (int)strlen(password); i--)
694 packet[8 + i] = 0x00;
695 }
696 else
697 {
698 for(i = 8; i < 18; i++)
699 packet[i] = 0x00;
700 }
701 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending join room");
702 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x12);
703 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
704 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending join room");
705 delete[] packet;
706 }
707
708 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendObserveOutsidecxx . . $ CyberOroConnection#sendObserveOutside(963dc8955d49573e).(const GameListingcxx . . $ GameListing# *game)
709 {
710 unsigned int length = 10;
711 char *packet = new char[length];
712
713 /* We need to turn this to a join if its a room, not a game
714 * otherwise bad things happen FIXME */
715 if(!game->game_codecxx . . $ GameListing#game_code.)
716 {
717 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("No game code for %d", game->numbercxx . . $ GameListing#number.);
718 // can we send number instead? where was the game code?
719 delete[] packet;
720 return;
721 }
722 packet[0] = 0x40;
723 packet[1] = 0x9c;
724 packet[2] = 0x0a;
725 packet[3] = 0x00;
726 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
727 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
728 packet[6] = game->game_codecxx . . $ GameListing#game_code. & 0x00ff;
729 packet[7] = (game->game_codecxx . . $ GameListing#game_code. >> 8);
730 packet[8] = 0x00;
731 packet[9] = 0x00; //careful could be something else? FIXME
732 //our id game id then ED0B, maybe two random bytes? time?
733 #ifdef RE_DEBUG
734 printf("Sending observe outside to %s vs %s: %d ", game.white_name().toLatin1().constData(), game.black_name().toLatin1().constData(), game.game_code);
735 for(unsigned int i = 0; i < length; i++)
736 printf("%02x ", (unsigned char)packet[i]);
737 printf("\n");
738 #endif //RE_DEBUG
739 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).((unsigned char *)packet, 0xa);
740 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
741 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending observe outside");
742 delete[] packet;
743
744 connecting_to_game_numbercxx . . $ CyberOroConnection#connecting_to_game_number. = game->numbercxx . . $ GameListing#number.;
745 }
746
747 /* This is a subcase of sendJoinRoom, we should fix that up
748 * and add a password prompt FIXME */
749 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendObserveAfterJoiningcxx . . $ CyberOroConnection#sendObserveAfterJoining(963dc8955d49573e).(const GameListingcxx . . $ GameListing# *game)
750 {
751 unsigned int length = 18;
752 char *packet = new char[length];
753 int i;
754
755 /* Observing a room definitely uses game number over game_code.
756 * weird... DOUBLECHECK */
757 packet[0] = 0xde;
758 packet[1] = 0x5d;
759 packet[2] = 0x12;
760 packet[3] = 0x00;
761 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
762 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
763 packet[6] = game->numbercxx . . $ GameListing#number. & 0x00ff;
764 packet[7] = (game->numbercxx . . $ GameListing#number. >> 8);
765 for(i = 8; i < (int)length; i++)
766 packet[i] = 0x00; //password in here? all password?
767 #ifdef RE_DEBUG
768 printf("Sending observe to %s vs %s: %d (%d)\n", game.white_name().toLatin1().constData(), game.black_name().toLatin1().constData(), game.game_code, game.number); //crash here ?!?!
769 for(i = 0; i < (int)length; i++)
770 printf("%02x ", (unsigned char)packet[i]);
771 printf("\n");
772 #endif //RE_DEBUG
773 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).((unsigned char *)packet, 0x12);
774 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
775 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending observe");
776 delete[] packet;
777 setRoomNumbercxx . . $ CyberOroConnection#setRoomNumber(ed53e3bbd3fa2f69).(game->numbercxx . . $ GameListing#number.);
778 }
779
780 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendFinishObservingcxx . . $ CyberOroConnection#sendFinishObserving(963dc8955d49573e).(const GameListingcxx . . $ GameListing# *game)
781 {
782 unsigned int length = 14;
783 char *packet = new char[length];
784 int i;
785
786 packet[0] = 0x45;
787 packet[1] = 0x9c;
788 packet[2] = 0x0e;
789 packet[3] = 0x00;
790 packet[4] = game->game_codecxx . . $ GameListing#game_code. & 0x00ff;
791 packet[5] = (game->game_codecxx . . $ GameListing#game_code. >> 8);
792 packet[6] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
793 packet[7] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
794 for(i = 8; i < 14; i++)
795 packet[i] = 0x00;
796 //and then? 0x54 instead of last 0x00? //I'm thinking 0e encode
797 // overwrites this and then it gets passed back to us in reply
798 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).((unsigned char *)packet, 0xe);
799 #ifdef RE_DEBUG
800 qDebug("Sending finish observing");
801 #endif //RE_DEBUG
802 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
803 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending finish observing");
804 delete[] packet;
805 //setRoomNumber(0);
806 }
807
808 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendCreateRoomcxx . . $ CyberOroConnection#sendCreateRoom(9db6e4897fed4acd).(RoomCreatecxx . . $ RoomCreate# * room)
809 {
810 unsigned int length = 64;
811 char *packet = new char[length];
812 int i;
813
814 if(!room)
815 {
816 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("CreateRoom called on NULL room!!");
817 delete[] packet;
818 return;
819 }
820 if((room->titlecxx . . $ RoomCreate#title. && strlen((const char *)room->titlecxx . . $ RoomCreate#title.) > 20) ||
821 (room->passwordcxx . . $ RoomCreate#password. && strlen((const char *)room->passwordcxx . . $ RoomCreate#password.) > 8))
822 {
823 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Can't create room, bad title or password");
824 delete[] packet;
825 return;
826 }
827 packet[0] = 0xca;
828 packet[1] = 0x5d;
829 packet[2] = 0x40;
830 packet[3] = 0x00;
831 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
832 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
833 packet[6] = 0x00;
834 packet[7] = 0x00;
835 packet[8] = 0x00;
836 packet[9] = 0x00;
837
838
839 packet[10] = (room->titlecxx . . $ RoomCreate#title. ? 0x80 : 0x00) | (room->passwordcxx . . $ RoomCreate#password. ? 0x40 : 0x00);
840 //packet[10] = 0xc0; //80 open //stronger quick 1:1 general password
841
842 //set 0 before hand
843 packet[11] = 0x00;
844 packet[12] = 0x00;
845 packet[13] = 0x00;
846 packet[14] = 0x00;
847 packet[15] = 0x00;
848 packet[16] = 0x00;
849 switch(room->typecxx . . $ RoomCreate#type.)
850 {
851 /* gomoku appears to use settings from game tab
852 * what's the difference? it automatically starts when
853 * someone joins? */
854 //gomoku equal player standard time
855 //00 09 11
856 case RoomCreatecxx . . $ RoomCreate#::GOMOKUcxx . . $ RoomCreate#GOMOKU.:
857 case RoomCreatecxx . . $ RoomCreate#::GAMEcxx . . $ RoomCreate#GAME.:
858 if(room->typecxx . . $ RoomCreate#type. == RoomCreatecxx . . $ RoomCreate#::GOMOKUcxx . . $ RoomCreate#GOMOKU.)
859 packet[11] = 0x09;
860 else
861 packet[11] = 0x00;
862 packet[12] = ((unsigned char)room->opponentStrengthcxx . . $ RoomCreate#opponentStrength. << 4) |
863 (unsigned char)room->timeLimitcxx . . $ RoomCreate#timeLimit.;
864
865 break;
866 case RoomCreatecxx . . $ RoomCreate#::CHATcxx . . $ RoomCreate#CHAT.:
867 packet[11] = 0xc0 | (unsigned char)room->topiccxx . . $ RoomCreate#topic.;
868 packet[12] = 0x00 | (unsigned char)room->locationcxx . . $ RoomCreate#location.;
869 //chat c1 21 movies -9 china
870 //chat c0 c0 baduk all ages korea
871 //chat cf 08 etc 70+ etc
872 //chat c5 a3 manga 40-49 thai
873 //chat c6 c4 humour 50-59 US
874 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Unsupported Room Type");
875 return;
876 break;
877 case RoomCreatecxx . . $ RoomCreate#::REVIEWcxx . . $ RoomCreate#REVIEW.:
878 packet[11] = 0x80;
879
880 packet[14] = 0x02; //live //00 teaching
881 //below 10k live commentary review
882 //00 80 00 00 02 10
883 //below 11k teaching focused
884 //00 80 00 00 00 11 04
885 //below 6d live
886 //00 80 00 00 02 01
887 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Unsupported Room Type");
888 return;
889 break;
890 case RoomCreatecxx . . $ RoomCreate#::MULTIcxx . . $ RoomCreate#MULTI.:
891 //multi must be below or at(doublecheck?) your rank
892 //multi 7 20m 20m below 10k
893 //00 80 00 07 03 10 02
894 //multi 6 15m 30m below 13k
895 //00 80 00 06 04 13 01
896 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Unsupported Room Type");
897 return;
898 break;
899 case RoomCreatecxx . . $ RoomCreate#::VARIATIONcxx . . $ RoomCreate#VARIATION.:
900 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Unsupported Room Type");
901 return;
902 break;
903 }
904
905 for(i = 17; i < 26; i++)
906 packet[i] = 0x00;
907 //title padded to 20
908 if(room->titlecxx . . $ RoomCreate#title.)
909 {
910 for(i = 0; i < (int)strlen((const char *)room->titlecxx . . $ RoomCreate#title.); i++)
911 packet[26 + i] = room->titlecxx . . $ RoomCreate#title.[i];
912 for(i = 19; i >= (int)strlen((const char *)room->titlecxx . . $ RoomCreate#title.); i--)
913 packet[26 + i] = 0x00;
914 }
915 else
916 {
917 for(i = 26; i < 46; i++)
918 packet[i] = 0x00;
919 }
920 for(i = 46; i < 56; i++)
921 packet[i] = 0x00;
922 //password padded to 8
923 if(room->passwordcxx . . $ RoomCreate#password.)
924 {
925 for(i = 0; i < (int)strlen((const char *)room->passwordcxx . . $ RoomCreate#password.); i++)
926 packet[56 + i] = room->passwordcxx . . $ RoomCreate#password.[i];
927 for(i = 7; i >= (int)strlen((const char *)room->passwordcxx . . $ RoomCreate#password.); i--)
928 packet[56 + i] = 0x00;
929 }
930 else
931 {
932 for(i = 56; i < 64; i++)
933 packet[i] = 0x00;
934 }
935
936 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).((unsigned char *)packet, 0x1a);
937 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending create room");
938 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
939 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending create room");
940 delete[] packet;
941 //setRoomNumber(0);
942 delete room;
943 }
944
945 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendMatchInvitecxx . . $ CyberOroConnection#sendMatchInvite(cac334474c82cf3a).(const PlayerListingcxx . . $ PlayerListing# * player)
946 {
947 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("room were in %d room there in %d", room_were_incxx . . $ CyberOroConnection#room_were_in., player->observingcxx . . $ PlayerListing#observing.);
948 /* We'll need to check that they're in the same room as we
949 * are, in which case, we could just popup the dialog */
950 if(room_were_incxx . . $ CyberOroConnection#room_were_in. && player->observingcxx . . $ PlayerListing#observing. == room_were_incxx . . $ CyberOroConnection#room_were_in.)
951 {
952 sendMatchOfferPendingcxx . . $ CyberOroConnection#sendMatchOfferPending(cac334474c82cf3a).(player);
953 }
954 else
955 sendMatchInvitecxx . . $ CyberOroConnection#sendMatchInvite(d77e65cb0d14bb16).(player, false);
956 }
957
958 /* note that this only enters the match offer dialog
959 * it doesn't accept the game.*/
960 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendMatchInvitecxx . . $ CyberOroConnection#sendMatchInvite(d77e65cb0d14bb16).(const PlayerListingcxx . . $ PlayerListing# * player, bool accepting)
961 {
962 #ifdef FIXME
963 if(!match_negotiation_state->newMatchAllowed()) //really should be handled elsewhere FIXME
964 return;
965 #endif //FIXME
966 unsigned int length = 16;
967 unsigned char * packet = new unsigned char[length];
968
969 if(accepting)
970 packet[0] = 0x86;
971 else
972 packet[0] = 0x22;
973 packet[1] = 0x79;
974 packet[2] = 0x10;
975 packet[3] = 0x00;
976 if(accepting)
977 {
978 packet[4] = player->idcxx . . $ PlayerListing#id. & 0x00ff;
979 packet[5] = (player->idcxx . . $ PlayerListing#id. >> 8);
980 packet[6] = player->specialbytecxx . . $ PlayerListing#specialbyte.;
981 }
982 else
983 {
984 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
985 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
986 packet[6] = our_special_bytecxx . . $ CyberOroConnection#our_special_byte.;
987 }
988 packet[7] = 0x00;
989 if(accepting)
990 {
991 packet[8] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
992 packet[9] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
993 packet[10] = our_special_bytecxx . . $ CyberOroConnection#our_special_byte.;
994 }
995 else
996 {
997 packet[8] = player->idcxx . . $ PlayerListing#id. & 0x00ff;
998 packet[9] = (player->idcxx . . $ PlayerListing#id. >> 8);
999 packet[10] = player->specialbytecxx . . $ PlayerListing#specialbyte.;
1000 }
1001 packet[11] = 0x00;
1002
1003 packet[12] = 0x00;
1004 packet[13] = 0x00;
1005 packet[14] = 0x00;
1006 packet[15] = 0x00; //or 7b? random??? FIXME
1007 #ifdef RE_DEBUG
1008 printf("match invite packet: ");
1009 for(int i = 0; i < (int)length; i++)
1010 printf("%02x ", packet[i]);
1011 printf("\n");
1012 #endif //RE_DEBUG
1013 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x10);
1014 #ifdef RE_DEBUG
1015 qDebug("Sending accept match request or invite");
1016 #endif //RE_DEBUG
1017 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1018 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending accept match request or invite");
1019 delete[] packet;
1020 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->sendMatchInvitecxx . . $ MatchNegotiationState#sendMatchInvite(122195e397f39e1b).((PlayerListingcxx . . $ PlayerListing# *)&player);
1021 }
1022
1023 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendDeclineMatchInvitecxx . . $ CyberOroConnection#sendDeclineMatchInvite(cac334474c82cf3a).(const PlayerListingcxx . . $ PlayerListing# * player)
1024 {
1025 unsigned int length = 12;
1026 unsigned char * packet = new unsigned char[length];
1027
1028 packet[0] = 0xa4;
1029 packet[1] = 0x79;
1030 packet[2] = 0x0c;
1031 packet[3] = 0x00;
1032 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1033 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1034 packet[6] = player->idcxx . . $ PlayerListing#id. & 0x00ff;
1035 packet[7] = (player->idcxx . . $ PlayerListing#id. >> 8);
1036 packet[8] = player->specialbytecxx . . $ PlayerListing#specialbyte.;
1037 packet[9] = 0x00;
1038 packet[10] = 0x00;
1039 packet[11] = 0x00;
1040 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0xc);
1041 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending decline match request");
1042 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1043 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending decline match request");
1044 delete[] packet;
1045 }
1046
1047
1048 /* This is also apparently sent automatically when
1049 * too much time passes after a request. But I missed
1050 * that last byte, I think it was 1b, but it could have
1051 * been anything. FIXME
1052 * There's also a chance I got this wrong and it
1053 * wasn't a decline message at all but something else. !!!*/
1054 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendDeclineMatchOffercxx . . $ CyberOroConnection#sendDeclineMatchOffer(cac334474c82cf3a).(const PlayerListingcxx . . $ PlayerListing# * player)
1055 {
1056 unsigned int length = 10;
1057 unsigned char * packet = new unsigned char[length];
1058
1059 packet[0] = 0x32;
1060 packet[1] = 0x7d;
1061 packet[2] = 0x0a;
1062 packet[3] = 0x00;
1063 packet[4] = player->idcxx . . $ PlayerListing#id. & 0x00ff;
1064 packet[5] = (player->idcxx . . $ PlayerListing#id. >> 8);
1065 packet[6] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1066 packet[7] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1067 packet[8] = 0x00;
1068 packet[9] = 0x00; //FIXME
1069 //32 7d 0a 00 49 04 d3 04 00 xx
1070 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0xa);
1071 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending decline request");
1072 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1073 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending decline request");
1074 delete[] packet;
1075 }
1076
1077 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendMatchOfferPendingcxx . . $ CyberOroConnection#sendMatchOfferPending(cac334474c82cf3a).(const PlayerListingcxx . . $ PlayerListing# * player)
1078 {
1079 unsigned int length = 10;
1080 unsigned char * packet = new unsigned char[length];
1081
1082 packet[0] = 0x1e;
1083 packet[1] = 0x7d;
1084 packet[2] = 0x0a;
1085 packet[3] = 0x00;
1086 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1087 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1088 packet[6] = player->idcxx . . $ PlayerListing#id. & 0x00ff;
1089 packet[7] = (player->idcxx . . $ PlayerListing#id. >> 8);
1090 packet[8] = 0x00;
1091 packet[9] = 0x00;
1092
1093 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0xa);
1094 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending match offer pending");
1095 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1096 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending match offer pending");
1097 delete[] packet;
1098 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->sendMatchOfferPendingcxx . . $ MatchNegotiationState#sendMatchOfferPending(49f6e7a06ebc5aa8).();
1099 }
1100
1101 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendMatchOfferCancelcxx . . $ CyberOroConnection#sendMatchOfferCancel(cac334474c82cf3a).(const PlayerListingcxx . . $ PlayerListing# * )
1102 {
1103 unsigned int length = 8;
1104 unsigned char * packet = new unsigned char[length];
1105
1106 packet[0] = 0x28;
1107 packet[1] = 0x7d;
1108 packet[2] = 0x08;
1109 packet[3] = 0x00;
1110 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1111 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1112 packet[6] = 0x00;
1113 packet[7] = 0x00; //FIXME
1114
1115
1116 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x8);
1117 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending match offer cancel");
1118 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1119 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending match offer cancel");
1120 delete[] packet;
1121 }
1122
1123 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendMatchOffercxx . . $ CyberOroConnection#sendMatchOffer(9a796e385859106a).(const MatchRequestcxx . . $ MatchRequest# & mr, bool offercounteroffer)
1124 {
1125 unsigned int length = 0xa0;
1126 unsigned char * packet = new unsigned char[length];
1127 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
1128 PlayerListingcxx . . $ PlayerListing# * opponent = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(mr.opponent_idcxx . . $ MatchRequest#opponent_id.);
1129 if(!opponent)
1130 {
1131 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Can't get opponent listing for match request\n");
1132 delete[] packet;
1133 return;
1134 }
1135 int i;
1136 if(offercounteroffer)
1137 packet[0] = 0xc8;
1138 else
1139 packet[0] = 0xcd;
1140 packet[1] = 0xaf;
1141 packet[2] = 0xa0;
1142 packet[3] = 0x00;
1143
1144 /* This is supposed to be their id for some reason... always?
1145 * or only on accept? */
1146 if(offercounteroffer || mr.rematchcxx . . $ MatchRequest#rematch.)
1147 {
1148 // Careful, might only be our id when we send
1149 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1150 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1151 //commenting this out fixed the resign that we see to have (W)
1152 //but it still makes them see it wrong
1153 //also, it probably affects the "is challenger stuff so I'm not
1154 //so sure I want to do this
1155 //but then we still can't play black and the (W) is wrong
1156 //...
1157 // FIXME FIXME this all needs to be carefully redone
1158 //I think I should start really by seeing what the resigns
1159 //are sent as, i.e., with whos id. I think its difficult because
1160 //there's no good way to see what id one is assigned
1161 //no, I think at the very least when accepting this
1162 //should not be commented out
1163 //don't know what mr.rematch is though
1164 }
1165 else
1166 {
1167 packet[4] = mr.opponent_idcxx . . $ MatchRequest#opponent_id. & 0x00ff;
1168 packet[5] = (mr.opponent_idcxx . . $ MatchRequest#opponent_id. >> 8);
1169 }
1170 packet[6] = mr.last_game_codecxx . . $ MatchRequest#last_game_code. & 0x00ff;
1171 packet[7] = (mr.last_game_codecxx . . $ MatchRequest#last_game_code. >> 8);
1172 packet[8] = 0x00;
1173 packet[9] = 0x02; //02 or 00
1174 /* Looks like rated is forced if there's a (greater than one stone? )
1175 * rank difference ? FIXME */
1176 if(mr.free_ratedcxx . . $ MatchRequest#free_rated. == RATEDcxx . . $ RATED.)
1177 packet[10] = 0x00;
1178 else
1179 packet[10] = 0x01; //friendly
1180 packet[11] = mr.flagscxx . . $ MatchRequest#flags.;
1181 if(mr.color_requestcxx . . $ MatchRequest#color_request. == MatchRequestcxx . . $ MatchRequest#::NIGIRIcxx . . $ MatchRequest#NIGIRI.)
1182 packet[11] |= 0x08;
1183 switch(mr.board_sizecxx . . $ MatchRequest#board_size.)
1184 {
1185 case 19:
1186 packet[12] = 0x00;
1187 break;
1188 case 13:
1189 packet[12] = 0x01;
1190 break;
1191 case 9:
1192 packet[12] = 0x02;
1193 break;
1194 case 7:
1195 packet[12] = 0x03;
1196 break;
1197 case 5:
1198 packet[12] = 0x04;
1199 break;
1200 default:
1201 printf("Bad board size: %d\n", mr.board_sizecxx . . $ MatchRequest#board_size.);
1202 return;
1203 break;
1204 }
1205 //looks like 13 is just whether there is a handicap
1206 if(mr.handicapcxx . . $ MatchRequest#handicap. > 1)
1207 {
1208 packet[13] = 0x01;
1209
1210 }
1211 else
1212 packet[13] = 0x00;
1213 #ifdef RE_DEBUG
1214 printf("challenger is black, 13: %d %d\n", mr.challenger_is_black, packet[13]);
1215 #endif //RE_DEBUG
1216 packet[14] = mr.handicapcxx . . $ MatchRequest#handicap.; //handicap I'd warrant
1217 /* FIXME
1218 * handicap may force komi = 0.5 rather than whatever we've set it at. Really
1219 * gamedialog should set this up properly with some flag. Also, we don't seem to
1220 * check the komi later and we should, actually looks like oro ignores it even if its set */
1221 //if this is 0x01, then its negative komi, taken from white
1222 packet[15] = (mr.komicxx . . $ MatchRequest#komi. < 0 ? 0x01 : 0x00); //not sure about this
1223 packet[16] = (int)(fabscxx . . $ fabs(fbcf3211dfe1bfd1).(mr.komicxx . . $ MatchRequest#komi.) - 0.5);
1224 #ifdef RE_DEBUG
1225 printf("komi: %02x %f %f\n", packet[16], mr.komi, fabs(mr.komi) - .5);
1226 #endif //RE_DEBUG
1227 packet[17] = 0x00;
1228 //a4 01 a4 01 a4 01
1229 //6 bytes of time settings
1230 /* FIXME, in real life, we're probably going to need the old
1231 * match request to fill this out properly
1232 * (later) ... or not... I think its just because same
1233 * game struct is used for loading new games, a struct
1234 * we should USE FIXME*/
1235 packet[18] = mr.maintimecxx . . $ MatchRequest#maintime. & 0x00ff;
1236 packet[19] = (mr.maintimecxx . . $ MatchRequest#maintime. >> 8);
1237 packet[20] = mr.maintimecxx . . $ MatchRequest#maintime. & 0x00ff;
1238 packet[21] = (mr.maintimecxx . . $ MatchRequest#maintime. >> 8);
1239 packet[22] = mr.maintimecxx . . $ MatchRequest#maintime. & 0x00ff;
1240 packet[23] = (mr.maintimecxx . . $ MatchRequest#maintime. >> 8);
1241 switch(mr.timeSystemcxx . . $ MatchRequest#timeSystem.)
1242 {
1243 case canadiancxx . . $ canadian.:
1244 packet[31] = 0x01;
1245 break;
1246 case byoyomicxx . . $ byoyomi.:
1247 packet[31] = 0x00;
1248 break;
1249 case tvasiacxx . . $ tvasia.:
1250 packet[31] = 0x02;
1251 break;
1252 default:
1253 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Unknown time system!!");
1254 break;
1255 }
1256 packet[24] = mr.stones_periodscxx . . $ MatchRequest#stones_periods.;
1257 packet[25] = mr.stones_periodscxx . . $ MatchRequest#stones_periods.;
1258 packet[28] = mr.periodtimecxx . . $ MatchRequest#periodtime. & 0x00ff;
1259 packet[29] = (mr.periodtimecxx . . $ MatchRequest#periodtime. >> 8);
1260 packet[30] = mr.stones_periodscxx . . $ MatchRequest#stones_periods.;
1261 packet[26] = 0x00;
1262 packet[27] = 0x00;
1263 //[32] 01 may indicate white's handicap
1264 packet[32] = 0x02;
1265 //packet[32] = 0x01; //definitely not on send, this throws it back to us
1266 #ifdef RE_DEBUG
1267 printf("byte 32: %02x\n", packet[32]);
1268 #endif //RE_DEBUG
1269 packet[33] = 0x00;
1270 packet[34] = 0x00;
1271 packet[35] = 0x00;
1272 #ifdef RE_DEBUG
1273 printf("Room number: %d\n", mr.number);
1274 #endif //RE_DEBUG
1275 packet[36] = mr.numbercxx . . $ MatchRequest#number. & 0xff;
1276 packet[37] = (mr.numbercxx . . $ MatchRequest#number. >> 8);
1277 packet[38] = 0x00; //room number again sometimes?
1278 packet[39] = 0x00;
1279 for(i = 40; i < 52; i++)
1280 packet[i] = 0x00;
1281 packet[52] = 0x1f; //??? FIXME
1282 /*packet[52] = ~0x1f;
1283 * this was an extra bad idea, setting this to e0
1284 * launches some weird special game type. */
1285 packet[53] = 0x00;
1286 for(i = 54; i < 62; i++)
1287 packet[i] = 0x00;
1288 //10 zeroes, though first might be part of our 1f friend
1289 packet[62] = 0x00;
1290 #ifdef RE_DEBUG
1291 printf("opponent special byte: %02x\n", opponent->specialbyte);
1292 #endif //RE_DEBUG
1293 packet[63] = 0x00;
1294 packet[63] = 0x00;
1295 //challengers name first...
1296 // maybe challenger first if nigiri? otherwise black first?
1297 const QStringcxx . . $ QString# * first_name, * second_name;
1298 unsigned short first_id, second_id;
1299 switch(mr.color_requestcxx . . $ MatchRequest#color_request.)
1300 {
1301 case MatchRequestcxx . . $ MatchRequest#::NIGIRIcxx . . $ MatchRequest#NIGIRI.:
1302 /* Pretty sure if we reverse these it
1303 * screws up who sends the nigiri
1304 * possibly among other things. */
1305 if(mr.opponent_is_challengercxx . . $ MatchRequest#opponent_is_challenger.)
1306 {
1307 first_name = &opponent->namecxx . . $ PlayerListing#name.;
1308 first_id = mr.opponent_idcxx . . $ MatchRequest#opponent_id.;
1309 second_name = &getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).();
1310 second_id = our_player_idcxx . . $ CyberOroConnection#our_player_id.;
1311 }
1312 else
1313 {
1314 first_name = &getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).();
1315 first_id = our_player_idcxx . . $ CyberOroConnection#our_player_id.;
1316 second_name = &opponent->namecxx . . $ PlayerListing#name.;
1317 second_id = mr.opponent_idcxx . . $ MatchRequest#opponent_id.;
1318 }
1319 break;
1320 case MatchRequestcxx . . $ MatchRequest#::BLACKcxx . . $ MatchRequest#BLACK.:
1321 first_name = &getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).();
1322 first_id = our_player_idcxx . . $ CyberOroConnection#our_player_id.;
1323 second_name = &opponent->namecxx . . $ PlayerListing#name.;
1324 second_id = mr.opponent_idcxx . . $ MatchRequest#opponent_id.;
1325 break;
1326 case MatchRequestcxx . . $ MatchRequest#::WHITEcxx . . $ MatchRequest#WHITE.:
1327 first_name = &opponent->namecxx . . $ PlayerListing#name.;
1328 first_id = mr.opponent_idcxx . . $ MatchRequest#opponent_id.;
1329 second_name = &getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).();
1330 second_id = our_player_idcxx . . $ CyberOroConnection#our_player_id.;
1331 break;
1332 }
1333
1334
1335
1336 for(i = 0; i < first_name->sizecxx . . $ QString#size(455f465bc33b4cdf).(); i++)
1337 packet[64 + i] = first_name->atcxx . . $ QString#at(13af7ae5a875439e).(i).cellcxx . . $ QChar#cell(2051adb0c9b72be0).();
1338 for(i = 9; i >= first_name->sizecxx . . $ QString#size(455f465bc33b4cdf).(); i--)
1339 packet[64 + i] = 0x00;
1340 packet[74] = first_id & 0x00ff;
1341 packet[75] = (first_id >> 8);
1342
1343 for(i = 0; i < second_name->sizecxx . . $ QString#size(455f465bc33b4cdf).(); i++)
1344 packet[76 + i] = second_name->atcxx . . $ QString#at(13af7ae5a875439e).(i).cellcxx . . $ QChar#cell(2051adb0c9b72be0).();
1345 for(i = 9; i >= second_name->sizecxx . . $ QString#size(455f465bc33b4cdf).(); i--)
1346 packet[76 + i] = 0x00;
1347 packet[86] = second_id & 0x00ff;
1348 packet[87] = (second_id >> 8);
1349
1350 for(i = 88; i < 98; i++)
1351 packet[i] = 0x00;
1352 packet[98] = 0x10;
1353 packet[99] = 0x27;
1354 for(i = 100; i < (int)length; i++)
1355 packet[i] = 0x00;
1356 //10 zeroes
1357 //packet[103] = 0x10;
1358 //packet[104] = 0x27;
1359 // 10 zeroes
1360 //packet[115] = 0x10;
1361 //packet[116] = 0x27;
1362 // 3 * 16 zeroes
1363
1364 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->offerMatchTermscxx . . $ MatchNegotiationState#offerMatchTerms(969a5d62d7a1bd6e).((MatchRequestcxx . . $ MatchRequest# *)&mr);
1365 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->setGameIdcxx . . $ MatchNegotiationState#setGameId(ed53e3bbd3fa2f69).(mr.numbercxx . . $ MatchRequest#number.);
1366
1367 #ifdef RE_DEBUG
1368 printf("match packet we are sending now: ");
1369 for(i = 0; i < (int)length; i++)
1370 printf("%02x", packet[i]);
1371 printf("\n");
1372 #endif //RE_DEBUG
1373
1374 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x40);
1375 #ifdef RE_DEBUG
1376 qDebug("Sending accept request");
1377 #endif //RE_DEBUG
1378 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1379 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending accept request");
1380 delete[] packet;
1381 }
1382
1383 /* I don't have a fucking clue what this is, only that
1384 * it comes up constantly practically without warning.
1385 * it could be a "typing message", maybe there's one similar
1386 * when you check the score, etc.. to notify the other player
1387 * of what you're doing. But since we've seen them before...
1388 * I don't know. Either way, I'm not certain that its
1389 * a necessary message */
1390 /* These are necessary before moves are accepted I think...
1391 * and if they aren't... well for some reason moves aren't
1392 * getting played.
1393 * I tend to think this is how the time stuff works...
1394 * and we potentially have to send one of these initially.*/
1395 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendGameUpdatecxx . . $ CyberOroConnection#sendGameUpdate(ed53e3bbd3fa2f69).(unsigned short game_code)
1396 {
1397 unsigned int length = 0xa;
1398 unsigned char * packet = new unsigned char[length];
1399 packet[0] = 0x50;
1400 packet[1] = 0xc3;
1401 packet[2] = 0x0a;
1402 packet[3] = 0x00;
1403 packet[4] = game_code & 0x00ff;
1404 packet[5] = (game_code >> 8);
1405
1406 /* Okay looks like packet[6] controls the smiley faces ?
1407 * 0b might be 0 shaped mouth, 0a could be yawn with tear? */
1408 packet[6] = 0x09; //huh?? 0b
1409 /* Also seen 0x0b 0x0d 0x12 0x11 0x0b which might be a preplay mode, an estimate, possibly
1410 * a clear or a return to preplay mode or something else and then back to match */
1411 packet[7] = 0x00;
1412
1413 packet[8] = 0x00;
1414 packet[9] = 0x00;
1415 //50 c3 0a 00 cd 01 0b 00 00 00
1416 //50 c3 0a 00 0b 09 00 fc f6 08 //?
1417 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x0a);
1418 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending game update");
1419 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1420 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending game update");
1421 delete[] packet;
1422 }
1423
1424 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendKeepAlivecxx . . $ CyberOroConnection#sendKeepAlive(963dc8955d49573e).(const GameListingcxx . . $ GameListing# *game)
1425 {
1426 unsigned int length = 0x10;
1427 unsigned char * packet = new unsigned char[length];
1428 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game->numbercxx . . $ GameListing#number.);
1429 if(!boarddispatch)
1430 {
1431 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("tried to sendKeepAlive on nonexistent board %d", game->numbercxx . . $ GameListing#number.);
1432 delete[] packet;
1433 return;
1434 }
1435 TimeRecordcxx . . $ TimeRecord# tr = boarddispatch->getOurTimeRecordcxx . . $ BoardDispatch#getOurTimeRecord(3d89b73610291578).();
1436 GameDatacxx . . $ GameData# * gr = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
1437 packet[0] = 0x64;
1438 packet[1] = 0xc3;
1439 packet[2] = 0x10;
1440 packet[3] = 0x00;
1441 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1442 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1443 packet[6] = game->game_codecxx . . $ GameListing#game_code. & 0x00ff;
1444 packet[7] = (game->game_codecxx . . $ GameListing#game_code. >> 8);
1445 if(gr->white_namecxx . . $ GameData#white_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).())
1446 packet[8] = 0x01; //color?
1447 else
1448 packet[8] = 0x00;
1449 packet[9] = 0x00;
1450
1451 //time
1452 packet[10] = tr.timecxx . . $ TimeRecord#time. & 0x00ff;
1453 packet[11] = (tr.timecxx . . $ TimeRecord#time. >> 8);
1454 //periods
1455 packet[12] = tr.stones_periodscxx . . $ TimeRecord#stones_periods. & 0x00ff;
1456 packet[13] = (tr.stones_periodscxx . . $ TimeRecord#stones_periods. >> 8);
1457 packet[14] = 0x00; //probably whether we're in byo yomi?
1458 packet[15] = 0x00; //FIXME
1459
1460 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x10);
1461 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending keep alive");
1462 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1463 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending keep alive");
1464 delete[] packet;
1465 }
1466
1467 /* Unnecessary but we don't want to raise suspicion */
1468 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendRequestKeepAlivecxx . . $ CyberOroConnection#sendRequestKeepAlive(963dc8955d49573e).(const GameListingcxx . . $ GameListing# *game)
1469 {
1470 unsigned int length = 0x0c;
1471 unsigned char * packet = new unsigned char[length];
1472 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game->numbercxx . . $ GameListing#number.);
1473 if(!boarddispatch)
1474 {
1475 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("tried to sendRequestKeepAlive on nonexistent board %d", game->numbercxx . . $ GameListing#number.);
1476 delete[] packet;
1477 return;
1478 }
1479 GameDatacxx . . $ GameData# * gr = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
1480 packet[0] = 0x5c;
1481 packet[1] = 0x4e;
1482 packet[2] = 0x0c;
1483 packet[3] = 0x00;
1484 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1485 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1486 packet[6] = game->game_codecxx . . $ GameListing#game_code. & 0x00ff;
1487 packet[7] = (game->game_codecxx . . $ GameListing#game_code. >> 8);
1488 packet[8] = gr->movescxx . . $ GameData#moves. & 0x00ff;
1489 packet[9] = (gr->movescxx . . $ GameData#moves. >> 8);
1490 packet[10] = 0x00; //probably whether we're in byo yomi?
1491 packet[11] = 0x00; //FIXME
1492
1493 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("sending request keepalive on moves: %d", gr->movescxx . . $ GameData#moves.);
1494 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x0c);
1495 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending request keep alive");
1496 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1497 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending keep alive2");
1498 delete[] packet;
1499 }
1500
1501 void CyberOroConnectioncxx . . $ CyberOroConnection#::saveIfDoesntSavecxx . . $ CyberOroConnection#saveIfDoesntSave(53acbc9cc3152f0d).(GameDatacxx . . $ GameData# * data)
1502 {
1503 GameListingcxx . . $ GameListing# * listing = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(data->numbercxx . . $ GameData#number.);
1504 listing->gameDatacxx . . $ GameListing#gameData. = new GameDatacxx . . $ GameData#GameData(53acbc9cc3152f0d).(data);
1505 }
1506
1507 void CyberOroConnectioncxx . . $ CyberOroConnection#::timerEventcxx . . $ CyberOroConnection#timerEvent(b9e57d1150f23bf5).(QTimerEventcxx . . $ QTimerEvent# * event)
1508 {
1509 if(event->timerIdcxx . . $ QTimerEvent#timerId(455f465bc33b4cdf).() == matchKeepAliveTimerIDcxx . . $ CyberOroConnection#matchKeepAliveTimerID. ||
1510 event->timerIdcxx . . $ QTimerEvent#timerId(455f465bc33b4cdf).() == matchRequestKeepAliveTimerIDcxx . . $ CyberOroConnection#matchRequestKeepAliveTimerID.)
1511 {
1512 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
1513 GameListingcxx . . $ GameListing# * listing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->getGameIdcxx . . $ MatchNegotiationState#getGameId(32a7769d58713265).());
1514 if(event->timerIdcxx . . $ QTimerEvent#timerId(455f465bc33b4cdf).() == matchKeepAliveTimerIDcxx . . $ CyberOroConnection#matchKeepAliveTimerID.)
1515 sendKeepAlivecxx . . $ CyberOroConnection#sendKeepAlive(963dc8955d49573e).(listing);
1516 else
1517 sendRequestKeepAlivecxx . . $ CyberOroConnection#sendRequestKeepAlive(963dc8955d49573e).(listing);
1518 }
1519 }
1520
1521 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendMovecxx . . $ CyberOroConnection#sendMove(74f2a753311a2adf).(unsigned int game_id, MoveRecordcxx . . $ MoveRecord# * move)
1522 {
1523 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_id);
1524 if(!boarddispatch)
1525 {
1526 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Can't get board for send move: %d", game_id);
1527 }
1528 GameDatacxx . . $ GameData# * r = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
1529 switch(move->flagscxx . . $ MoveRecord#flags.)
1530 {
1531 case MoveRecordcxx . . $ MoveRecord#::RESIGNcxx . . $ MoveRecord#RESIGN.:
1532 sendResigncxx . . $ CyberOroConnection#sendResign(cb2f890c2fdad230).(r->game_codecxx . . $ GameData#game_code.);
1533 killActiveMatchTimerscxx . . $ CyberOroConnection#killActiveMatchTimers(49f6e7a06ebc5aa8).();
1534 return;
1535 break;
1536
1537 case MoveRecordcxx . . $ MoveRecord#::REMOVEcxx . . $ MoveRecord#REMOVE.:
1538 case MoveRecordcxx . . $ MoveRecord#::UNREMOVEcxx . . $ MoveRecord#UNREMOVE.:
1539 sendRemoveStonescxx . . $ CyberOroConnection#sendRemoveStones(b8a9826dc1a717e6).(r->game_codecxx . . $ GameData#game_code., move);
1540 return;
1541 break;
1542 case MoveRecordcxx . . $ MoveRecord#::DONE_SCORINGcxx . . $ MoveRecord#DONE_SCORING.:
1543 sendDoneScoringcxx . . $ CyberOroConnection#sendDoneScoring(272d193675e92631).(r->game_codecxx . . $ GameData#game_code., r->opponent_idcxx . . $ GameData#opponent_id.);
1544 return;
1545 break;
1546 case MoveRecordcxx . . $ MoveRecord#::REQUESTUNDOcxx . . $ MoveRecord#REQUESTUNDO.:
1547 sendUndocxx . . $ CyberOroConnection#sendUndo(b8a9826dc1a717e6).(r->game_codecxx . . $ GameData#game_code., move);
1548 return;
1549 break;
1550 case MoveRecordcxx . . $ MoveRecord#::UNDOcxx . . $ MoveRecord#UNDO.:
1551 sendAcceptUndocxx . . $ CyberOroConnection#sendAcceptUndo(b8a9826dc1a717e6).(r->game_codecxx . . $ GameData#game_code., move);
1552 return;
1553 break;
1554 case MoveRecordcxx . . $ MoveRecord#::REFUSEUNDOcxx . . $ MoveRecord#REFUSEUNDO.:
1555 sendDeclineUndocxx . . $ CyberOroConnection#sendDeclineUndo(b8a9826dc1a717e6).(r->game_codecxx . . $ GameData#game_code., move);
1556 return;
1557 break;
1558 default:
1559 break;
1560 }
1561
1562 unsigned int length = 0x14;
1563 unsigned char * packet = new unsigned char[length];
1564
1565 packet[0] = 0xdc;
1566 packet[1] = 0xaf;
1567 packet[2] = 0x14;
1568 packet[3] = 0x00;
1569 packet[4] = r->game_codecxx . . $ GameData#game_code. & 0x00ff;
1570 packet[5] = (r->game_codecxx . . $ GameData#game_code. >> 8);
1571 packet[6] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1572 packet[7] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1573 /* I've seen black moves sent with this... could be that non
1574 * challenger sends 0101?, or maybe challenger does... */
1575 if(r->white_namecxx . . $ GameData#white_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getOurListingcxx . . $ CyberOroConnection#getOurListing(c84291d55c8466c6).()->namecxx . . $ PlayerListing#name.)
1576 {
1577 packet[8] = 0x01; //both ones?
1578 packet[9] = 0x01;
1579 }
1580 else
1581 {
1582 packet[8] = 0x00; //this maybe has to be for color?
1583 packet[9] = 0x00;
1584 }
1585 // this may be off, 1 too high in even games
1586 move->numbercxx . . $ MoveRecord#number.++; //wtf FIXME
1587 packet[10] = (move->numbercxx . . $ MoveRecord#number. & 0x00ff);
1588 packet[11] = (move->numbercxx . . $ MoveRecord#number. >> 8);
1589 if(move->flagscxx . . $ MoveRecord#flags. == MoveRecordcxx . . $ MoveRecord#::PASScxx . . $ MoveRecord#PASS.)
1590 {
1591 packet[12] = 0;
1592 packet[13] = 0;
1593 }
1594 else
1595 {
1596 packet[12] = move->xcxx . . $ MoveRecord#x.;
1597 packet[13] = move->ycxx . . $ MoveRecord#y.;
1598 }
1599 TimeRecordcxx . . $ TimeRecord# t = getBoardDispatchcxx . . $ NetworkConnection#getBoardDispatch(f34f0704202202).(game_id)->getOurTimeRecordcxx . . $ BoardDispatch#getOurTimeRecord(3d89b73610291578).();
1600 if(move->numbercxx . . $ MoveRecord#number. == 1 || move->numbercxx . . $ MoveRecord#number. == 2)
1601 {
1602 /* We apparently don't start the clock until 3rd move
1603 * so this should fix that up. */
1604 packet[14] = r->maintimecxx . . $ GameData#maintime. & 0x00ff;
1605 packet[15] = (r->maintimecxx . . $ GameData#maintime. >> 8);
1606 }
1607 else
1608 {
1609 packet[14] = t.timecxx . . $ TimeRecord#time. & 0x00ff;
1610 packet[15] = (t.timecxx . . $ TimeRecord#time. >> 8);
1611 }
1612 if(t.stones_periodscxx . . $ TimeRecord#stones_periods. == -1)
1613 {
1614 //UGLY FIXME
1615 t.stones_periodscxx . . $ TimeRecord#stones_periods. = r->stones_periodscxx . . $ GameData#stones_periods.;
1616 #ifdef RE_DEBUG
1617 printf("r->periods here %d\n", r->stones_periods);
1618 #endif //RE_DEBUG
1619 packet[17] = 0x00;
1620 }
1621 else
1622 packet[17] = 0x01;
1623 packet[16] = t.stones_periodscxx . . $ TimeRecord#stones_periods.;
1624 //packet[17] = (t.stones_periods >> 8);
1625 packet[18] = 0x00;
1626 packet[19] = 0x00;
1627
1628 //move
1629 //dc af 14 00 fa 01 ec 05 00 00 0a 00 04 08 6e 04
1630 //03 00 00 00
1631 //pass
1632 //dc af 14 00 6a e2 ec 05 00 00 02 00 00 00 b0 04
1633 //03 00 00 00
1634
1635 //we send
1636 //dc af 14 00 49 0d 2b 07 00 00 01 00 07 07 78 00 03 00 00 00
1637
1638 #ifdef RE_DEBUG
1639 printf("movepacket: ");
1640 for(unsigned int i = 0; i < length; i++)
1641 printf("%02x ", packet[i]);
1642 printf("\n");
1643 #endif //RE_DEBUG
1644 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x14);
1645 #ifdef RE_DEBUG
1646 qDebug("Sending move");
1647 #endif //RE_DEBUG
1648 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1649 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending move packet");
1650 delete[] packet;
1651
1652 if(matchKeepAliveTimerIDcxx . . $ CyberOroConnection#matchKeepAliveTimerID.)
1653 {
1654 killTimercxx . . $ QObject#killTimer(d4f767463ce0a6b3).(matchKeepAliveTimerIDcxx . . $ CyberOroConnection#matchKeepAliveTimerID.);
1655 matchKeepAliveTimerIDcxx . . $ CyberOroConnection#matchKeepAliveTimerID. = 0;
1656 matchRequestKeepAliveTimerIDcxx . . $ CyberOroConnection#matchRequestKeepAliveTimerID. = startTimercxx . . $ QObject#startTimer(cf5d4a693bb15cf1).(39000);
1657 }
1658
1659 }
1660
1661 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendUndocxx . . $ CyberOroConnection#sendUndo(b8a9826dc1a717e6).(unsigned int game_code, const MoveRecordcxx . . $ MoveRecord# * move)
1662 {
1663 unsigned int length = 0x0e;
1664 unsigned char * packet = new unsigned char[length];
1665 GameDatacxx . . $ GameData# * aGameData;
1666 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).game_code]);
1667 if(!boarddispatch)
1668 {
1669 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("How can there not be a board dispatch, it just sent us an undo");
1670 delete[] packet;
1671 return;
1672 }
1673 aGameData = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
1674 packet[0] = 0xe6;
1675 packet[1] = 0xaf;
1676 packet[2] = 0x0e;
1677 packet[3] = 0x00;
1678 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1679 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1680 packet[6] = game_code & 0x00ff;
1681 packet[7] = (game_code >> 8);
1682 if(aGameData->white_namecxx . . $ GameData#white_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).())
1683 packet[8] = 0x01;
1684 else
1685 packet[8] = 0x00;
1686 packet[9] = 0x00;
1687 packet[10] = move->numbercxx . . $ MoveRecord#number. & 0x00ff; //this is the move to start from (10)
1688 packet[11] = (move->numbercxx . . $ MoveRecord#number. >> 8);
1689 packet[12] = 0x00;
1690 packet[13] = 0x00;
1691
1692 //from sender perspective encode(e)
1693 //e6af 0e00 b50d 4c02 01 00 0a 00 00 00
1694 #ifdef RE_DEBUG
1695 printf("undo packet: ");
1696 for(int i = 0; i < (int)length; i++)
1697 printf("%02x ", packet[i]);
1698 printf("\n");
1699 #endif //RE_DEBUG
1700 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0xe);
1701 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending undo");
1702 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1703 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending undo packet");
1704 delete[] packet;
1705 }
1706
1707 /* FIXME oro client can't seem to play after an undo, but we can if
1708 * its our turn. We need to make sure that this is an ORO bug, and not
1709 * us screwing up the move number we send back */
1710 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendDeclineUndocxx . . $ CyberOroConnection#sendDeclineUndo(b8a9826dc1a717e6).(unsigned int game_code, const MoveRecordcxx . . $ MoveRecord# * move)
1711 {
1712 unsigned int length = 14;
1713 unsigned char * packet = new unsigned char[length];
1714 GameDatacxx . . $ GameData# * aGameData;
1715 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).game_code]);
1716 if(!boarddispatch)
1717 {
1718 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("How can there not be a board dispatch, it just sent us a timeloss");
1719 delete[] packet;
1720 return;
1721 }
1722 aGameData = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
1723 packet[0] = 0xf0;
1724 packet[1] = 0xaf;
1725 packet[2] = 0x0e;
1726 packet[3] = 0x00;
1727 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1728 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1729 packet[6] = game_code & 0x00ff;
1730 packet[7] = (game_code >> 8);
1731 if(aGameData->white_namecxx . . $ GameData#white_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).()) //opposite color
1732 packet[8] = 0x00;
1733 else
1734 packet[8] = 0x01;
1735 packet[9] = 0x00;
1736 packet[10] = move->numbercxx . . $ MoveRecord#number. & 0x00ff;
1737 packet[11] = (move->numbercxx . . $ MoveRecord#number. >> 8);
1738 packet[12] = 0x00;
1739 packet[13] = 0x00;
1740
1741 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x0e);
1742 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending decline undo");
1743 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1744 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending decline undo");
1745 delete[] packet;
1746 }
1747
1748 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendAcceptUndocxx . . $ CyberOroConnection#sendAcceptUndo(b8a9826dc1a717e6).(unsigned int game_code, const MoveRecordcxx . . $ MoveRecord# * move)
1749 {
1750 unsigned int length = 14;
1751 unsigned char * packet = new unsigned char[length];
1752 GameDatacxx . . $ GameData# * aGameData;
1753 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).game_code]);
1754 if(!boarddispatch)
1755 {
1756 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("How can there not be a board dispatch, it just sent us a timeloss");
1757 delete[] packet;
1758 return;
1759 }
1760 aGameData = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
1761 packet[0] = 0xeb;
1762 packet[1] = 0xaf;
1763 packet[2] = 0x0e;
1764 packet[3] = 0x00;
1765 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1766 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1767 packet[6] = game_code & 0x00ff;
1768 packet[7] = (game_code >> 8);
1769 if(aGameData->white_namecxx . . $ GameData#white_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).())
1770 packet[8] = 0x01;
1771 else
1772 packet[8] = 0x00;
1773 packet[9] = 0x00;
1774 packet[10] = move->numbercxx . . $ MoveRecord#number. & 0x00ff;
1775 packet[11] = (move->numbercxx . . $ MoveRecord#number. >> 8);
1776 packet[12] = 0x00;
1777 packet[13] = 0x00;
1778
1779 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x0e);
1780 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending accept undo");
1781 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1782 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending accept undo");
1783 delete[] packet;
1784 }
1785
1786 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendEndgame12Msgcxx . . $ CyberOroConnection#sendEndgame12Msg(272d193675e92631).(unsigned int game_id, unsigned short msg_code)
1787 {
1788 unsigned int length = 0x0c;
1789 unsigned char * packet = new unsigned char[length];
1790 GameDatacxx . . $ GameData# * aGameData;
1791 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_id);
1792 if(!boarddispatch)
1793 {
1794 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("How can there not be a board dispatch, it just sent us an endgame msg");
1795 delete[] packet;
1796 return;
1797 }
1798 aGameData = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
1799 /* FIXME looking at this suggests that we have all the msg codes byte order backwards if they're
1800 * to be consistent!! Interesting */
1801 packet[0] = (msg_code >> 8);
1802 packet[1] = msg_code & 0x00ff;
1803 packet[2] = 0x0c;
1804 packet[3] = 0x00;
1805 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1806 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1807 packet[6] = aGameData->game_codecxx . . $ GameData#game_code. & 0x00ff;
1808 packet[7] = (aGameData->game_codecxx . . $ GameData#game_code. >> 8);
1809 if(aGameData->white_namecxx . . $ GameData#white_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).())
1810 packet[8] = 0x01;
1811 else
1812 packet[8] = 0x00;
1813 packet[9] = 0x00;
1814 packet[10] = 0x00;
1815 packet[11] = 0x00;
1816
1817 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0xc);
1818 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending %d endgame msg", msg_code);
1819 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1820 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending request count packet");
1821 delete[] packet;
1822 }
1823
1824 /* FIXME Most of these messages all seem to be the same and I would love to clean up all of this
1825 * code with a single case statement or something */
1826 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendRequestCountcxx . . $ CyberOroConnection#sendRequestCount(cb2f890c2fdad230).(unsigned int game_id)
1827 {
1828 sendEndgame12Msgcxx . . $ CyberOroConnection#sendEndgame12Msg(272d193675e92631).(game_id, 0xc4b3);
1829 killActiveMatchTimerscxx . . $ CyberOroConnection#killActiveMatchTimers(49f6e7a06ebc5aa8).();
1830 }
1831
1832 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendAcceptCountRequestcxx . . $ CyberOroConnection#sendAcceptCountRequest(53acbc9cc3152f0d).(GameDatacxx . . $ GameData# * data)
1833 {
1834 sendEnterScoringcxx . . $ CyberOroConnection#sendEnterScoring(cb2f890c2fdad230).(data->game_codecxx . . $ GameData#game_code.);
1835 }
1836
1837 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendRefuseCountRequestcxx . . $ CyberOroConnection#sendRefuseCountRequest(53acbc9cc3152f0d).(GameDatacxx . . $ GameData# * data)
1838 {
1839 sendEndgame12Msgcxx . . $ CyberOroConnection#sendEndgame12Msg(272d193675e92631).(data->numbercxx . . $ GameData#number., 0xceb3);
1840 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(data->numbercxx . . $ GameData#number.);
1841 if(!boarddispatch)
1842 {
1843 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("How can there not be a board dispatch, it just sent us a send refuse count request");
1844 return;
1845 }
1846 startMatchTimerscxx . . $ CyberOroConnection#startMatchTimers(b45ddcbc8423892c).(boarddispatch->getBlackTurncxx . . $ BoardDispatch#getBlackTurn(c9857a73d68e59ba).() ? (data->black_namecxx . . $ GameData#black_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).()) : (data->white_namecxx . . $ GameData#white_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).()));
1847 }
1848
1849 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendRequestMatchModecxx . . $ CyberOroConnection#sendRequestMatchMode(cb2f890c2fdad230).(unsigned int game_id)
1850 {
1851 sendEndgame12Msgcxx . . $ CyberOroConnection#sendEndgame12Msg(272d193675e92631).(game_id, 0x05b4);
1852 killActiveMatchTimerscxx . . $ CyberOroConnection#killActiveMatchTimers(49f6e7a06ebc5aa8).(); //does killing the match timers like this also stop the clock from ticking doublecheck FIXME?
1853 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->sendMatchModeRequestcxx . . $ MatchNegotiationState#sendMatchModeRequest(49f6e7a06ebc5aa8).();
1854 }
1855
1856 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendAcceptRequestMatchModecxx . . $ CyberOroConnection#sendAcceptRequestMatchMode(cb2f890c2fdad230).(unsigned int game_id)
1857 {
1858 unsigned int length = 0x08;
1859 unsigned char * packet = new unsigned char[length];
1860 GameDatacxx . . $ GameData# * aGameData;
1861 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_id);
1862 if(!boarddispatch)
1863 {
1864 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("How can there not be a board dispatch, it just sent us a accept request match mode");
1865 delete[] packet;
1866 return;
1867 }
1868 aGameData = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
1869 packet[0] = 0x8c;
1870 packet[1] = 0xc3;
1871 packet[2] = 0x08;
1872 packet[3] = 0x00;
1873 packet[4] = aGameData->game_codecxx . . $ GameData#game_code. & 0x00ff;
1874 packet[5] = (aGameData->game_codecxx . . $ GameData#game_code. >> 8);
1875 packet[6] = 0x00;
1876 packet[7] = 0x00;
1877
1878 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x8);
1879 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending accept request match mode");
1880 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1881 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending request match mode packet");
1882 delete[] packet;
1883 //FIXME this isn't starting thematch timers properly FIXME
1884 startMatchTimerscxx . . $ CyberOroConnection#startMatchTimers(b45ddcbc8423892c).(boarddispatch->getBlackTurncxx . . $ BoardDispatch#getBlackTurn(c9857a73d68e59ba).() ? (aGameData->black_namecxx . . $ GameData#black_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).()) : (aGameData->white_namecxx . . $ GameData#white_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).()));
1885 }
1886
1887 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendDeclineRequestMatchModecxx . . $ CyberOroConnection#sendDeclineRequestMatchMode(cb2f890c2fdad230).(unsigned int game_id)
1888 {
1889 sendEndgame12Msgcxx . . $ CyberOroConnection#sendEndgame12Msg(272d193675e92631).(game_id, 0x0ab4);
1890 }
1891
1892 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendTimeLosscxx . . $ CyberOroConnection#sendTimeLoss(cb2f890c2fdad230).(unsigned int game_id)
1893 {
1894 sendEndgame12Msgcxx . . $ CyberOroConnection#sendEndgame12Msg(272d193675e92631).(game_id, 0xf6b3);
1895 killActiveMatchTimerscxx . . $ CyberOroConnection#killActiveMatchTimers(49f6e7a06ebc5aa8).();
1896 }
1897
1898 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendRemoveStonescxx . . $ CyberOroConnection#sendRemoveStones(b8a9826dc1a717e6).(unsigned int game_code, const MoveRecordcxx . . $ MoveRecord# * move)
1899 {
1900 unsigned int length = 0x10;
1901 unsigned char * packet = new unsigned char[length];
1902
1903 packet[0] = 0xe2;
1904 packet[1] = 0xb3;
1905 packet[2] = 0x10;
1906 packet[3] = 0x00;
1907 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1908 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1909 packet[6] = game_code & 0x00ff;
1910 packet[7] = (game_code >> 8);
1911 packet[8] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff; //why our id again??
1912 packet[9] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1913 //packet[10] = (move.number & 0x00ff); //what the hell are these?
1914 //packet[11] = (move.number >> 8); // FIXME scores???
1915 if(move->flagscxx . . $ MoveRecord#flags. == MoveRecordcxx . . $ MoveRecord#::REMOVEcxx . . $ MoveRecord#REMOVE.)
1916 packet[12] = 0x01; //probably unremove bit
1917 else //if(move->flags == MoveRecord::UNREMOVE)
1918 packet[12] = 0x02;
1919 packet[13] = 0x00;
1920
1921 packet[14] = move->xcxx . . $ MoveRecord#x.;
1922 packet[15] = move->ycxx . . $ MoveRecord#y.;
1923
1924 //e2 b3 10 00 ec 05 fa 01 ec 05 01 00 01 00 03 04
1925 //e2 b3 10 00 ec 05 fa 01 ec 05 98 66 01 00 03 10
1926 #ifdef RE_DEBUG
1927 printf("remove stones packet: ");
1928 for(unsigned int i = 0; i < length; i++)
1929 printf("%02x ", packet[i]);
1930 printf("\n");
1931 #endif //RE_DEBUG
1932 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x0c);
1933 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending remove stones");
1934 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
1935 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending remove stones packet");
1936 delete[] packet;
1937 }
1938
1939 /* Looks like we send this, for instance, as white if we pass
1940 * and then receive a black pass */
1941 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendEnterScoringcxx . . $ CyberOroConnection#sendEnterScoring(cb2f890c2fdad230).(unsigned int game_code)
1942 {
1943 sendEndgame12Msgcxx . . $ CyberOroConnection#sendEndgame12Msg(272d193675e92631).(game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).game_code], 0xc9b3);
1944 }
1945
1946 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendDoneScoringcxx . . $ CyberOroConnection#sendDoneScoring(272d193675e92631).(unsigned int game_code, unsigned short opp_id)
1947 {
1948 unsigned int length = 14 + (deadStonesListcxx . . $ CyberOroConnection#deadStonesList..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() * 2) + (deadStonesListcxx . . $ CyberOroConnection#deadStonesList..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() ? 2 : 0);
1949 unsigned char * packet = new unsigned char[length];
1950 int i;
1951 bool receivedOppDone = match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->receivedDoneCountingcxx . . $ MatchNegotiationState#receivedDoneCounting(c9857a73d68e59ba).();
1952
1953 if(receivedOppDone)
1954 {
1955 packet[0] = 0xe7;
1956 packet[1] = 0xb3;
1957 }
1958 else
1959 {
1960 packet[0] = 0xf1;
1961 packet[1] = 0xb3;
1962 }
1963 packet[2] = length & 0x00ff;
1964 packet[3] = (length >> 8);
1965 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1966 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1967 packet[6] = game_code & 0x00ff;
1968 packet[7] = (game_code >> 8);
1969 /* I think bytes 8 and 9 are opponents id if we haven't
1970 * received a done from them yet and ours if we have. FIXME */
1971 if(receivedOppDone)
1972 {
1973 packet[8] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
1974 packet[9] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
1975 }
1976 else
1977 {
1978 packet[8] = opp_id & 0x00ff;
1979 packet[9] = (opp_id >> 8);
1980 }
1981 //packet[8] = our_player_id & 0x00ff; //why our id again??
1982 //packet[9] = (our_player_id >> 8);
1983 //packet[10] = (move.number & 0x00ff); //what the hell are these?
1984 //packet[11] = (move.number >> 8); // FIXME scores???
1985 //packet[10] = 0x00; //possible scores, random?
1986 if(receivedOppDone)
1987 {
1988 unsigned short done_response = match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->getCountingVerificationcxx . . $ MatchNegotiationState#getCountingVerification(32a7769d58713265).();
1989 packet[10] = done_response & 0x00ff;
1990 packet[11] = (done_response >> 8);
1991 }
1992 else
1993 {
1994 //FIXME what the hell?
1995 //packet[10] = 0x82; //these seems to be kept...
1996 //packet[11] = 0x45; //should be random? = 63?
1997 /* I'm going to assume that these are random, to ensure that scores can't be spoofed.
1998 * i.e., we should check their response */
1999 packet[10] = rand() % 256;
2000 packet[11] = rand() % 256;
2001 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->setCountingVerificationcxx . . $ MatchNegotiationState#setCountingVerification(ed53e3bbd3fa2f69).(packet[10] + (packet[11] << 8));
2002 }
2003
2004 packet[12] = 0x01;
2005 packet[13] = deadStonesListcxx . . $ CyberOroConnection#deadStonesList..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).();
2006 if(deadStonesListcxx . . $ CyberOroConnection#deadStonesList..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).())
2007 {
2008 /* We're supposed to send the last one */
2009 packet[14] = deadStonesListcxx . . $ CyberOroConnection#deadStonesList.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).deadStonesListcxx . . $ CyberOroConnection#deadStonesList..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() - 1].xcxx . . $ MoveRecord#x.;
2010 packet[15] = deadStonesListcxx . . $ CyberOroConnection#deadStonesList.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).deadStonesListcxx . . $ CyberOroConnection#deadStonesList..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() - 1].ycxx . . $ MoveRecord#y.;
2011 for(i = 0; i < (int)deadStonesListcxx . . $ CyberOroConnection#deadStonesList..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++)
2012 {
2013 packet[16 + (i * 2)] = deadStonesListcxx . . $ CyberOroConnection#deadStonesList.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].xcxx . . $ MoveRecord#x.;
2014 packet[17 + (i * 2)] = deadStonesListcxx . . $ CyberOroConnection#deadStonesList.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].ycxx . . $ MoveRecord#y.;
2015 }
2016 }
2017
2018 //f1 b3 18 00 ec 05 fa 01 ec 05 98 82 01 04 03 10
2019 //11 0f 11 05 03 04 03 10
2020 #ifdef RE_DEBUG
2021 printf("done scoring packet: ");
2022 for(i = 0; i < (int)length; i++)
2023 printf("%02x ", packet[i]);
2024 printf("\n");
2025 #endif //RE_DEBUG
2026 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x0c); //doublecheck that scoring works FIXME
2027 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending done scoring");
2028 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
2029 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending done scoring");
2030 delete[] packet;
2031
2032 if(receivedOppDone)
2033 {
2034 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->setDoneCountingcxx . . $ MatchNegotiationState#setDoneCounting(49f6e7a06ebc5aa8).();
2035 sendMatchResultcxx . . $ CyberOroConnection#sendMatchResult(ed53e3bbd3fa2f69).(game_code);
2036 }
2037 else
2038 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->sendDoneCountingcxx . . $ MatchNegotiationState#sendDoneCounting(49f6e7a06ebc5aa8).();
2039 }
2040
2041 /* I don't think we're allowed to send this in score phase or
2042 * after opponent has pressed done or something */
2043 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendResigncxx . . $ CyberOroConnection#sendResign(cb2f890c2fdad230).(unsigned int game_code)
2044 {
2045 sendEndgame12Msgcxx . . $ CyberOroConnection#sendEndgame12Msg(272d193675e92631).(game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).game_code], 0xb0b3);
2046 }
2047
2048 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendAdjournRequestcxx . . $ CyberOroConnection#sendAdjournRequest(49f6e7a06ebc5aa8).(void)
2049 {
2050 sendEndgame12Msgcxx . . $ CyberOroConnection#sendEndgame12Msg(272d193675e92631).(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->getGameIdcxx . . $ MatchNegotiationState#getGameId(32a7769d58713265).(), 0xb5b3);
2051 }
2052
2053 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendAdjourncxx . . $ CyberOroConnection#sendAdjourn(49f6e7a06ebc5aa8).(void)
2054 {
2055 sendEndgame12Msgcxx . . $ CyberOroConnection#sendEndgame12Msg(272d193675e92631).(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->getGameIdcxx . . $ MatchNegotiationState#getGameId(32a7769d58713265).(), 0xbab3);
2056 }
2057
2058 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendRefuseAdjourncxx . . $ CyberOroConnection#sendRefuseAdjourn(49f6e7a06ebc5aa8).(void)
2059 {
2060 sendEndgame12Msgcxx . . $ CyberOroConnection#sendEndgame12Msg(272d193675e92631).(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->getGameIdcxx . . $ MatchNegotiationState#getGameId(32a7769d58713265).(), 0xbfb3);
2061 }
2062
2063
2064 /* So far, we know this is sent by client that responded
2065 * to done or by loser. The margin seems to be ignored
2066 * by opposing client but maybe its registered by
2067 * server. */
2068 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendMatchResultcxx . . $ CyberOroConnection#sendMatchResult(ed53e3bbd3fa2f69).(unsigned short game_code)
2069 {
2070 unsigned int length = 20;
2071 unsigned char * packet = new unsigned char[length];
2072 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code]);
2073 if(!boarddispatch)
2074 {
2075 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Can't get board for %d for match result send", game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code]);
2076 delete[] packet;
2077 return;
2078 }
2079 /* We need to notify boarddispatch of finished game so we can
2080 * get the full result */
2081 boarddispatch->recvResultcxx . . $ BoardDispatch#recvResult(c72a8b5aed169521).(0);
2082 GameDatacxx . . $ GameData# *aGameData = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
2083 packet[0] = 0x80;
2084 packet[1] = 0xbb;
2085 packet[2] = 0x14;
2086 packet[3] = 0x00;
2087 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
2088 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
2089 packet[6] = game_code & 0x00ff;
2090 packet[7] = (game_code >> 8);
2091 packet[8] = 0x03; //?
2092 if(aGameData->white_namecxx . . $ GameData#white_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).()) //doublecheck
2093 packet[9] = 0x01;
2094 else
2095 packet[9] = 0x00;
2096 if(!aGameData->fullresultcxx . . $ GameData#fullresult.)
2097 {
2098 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("No result on game data to send result");
2099 return;
2100 }
2101 float margin = aGameData->fullresultcxx . . $ GameData#fullresult.->winner_scorecxx . . $ GameResult#winner_score. - aGameData->fullresultcxx . . $ GameData#fullresult.->loser_scorecxx . . $ GameResult#loser_score.;
2102 packet[10] = (int)margin & 0x00ff;
2103 packet[11] = ((int)margin >> 8);
2104 packet[12] = 0x1a; //?? 04
2105 packet[13] = 0x00;
2106 packet[14] = 0x00; //?? 01
2107 packet[15] = 0x00;
2108 packet[16] = 0x00; //?? 01
2109 packet[17] = 0x00;
2110 packet[18] = 0x00;
2111 packet[19] = 0x00;
2112
2113 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0x14);
2114 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending match result");
2115 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
2116 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending match result");
2117 delete[] packet;
2118 }
2119
2120 /* It seems like this appears like a match invite if opponent closes
2121 * the window */
2122 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendRematchRequestcxx . . $ CyberOroConnection#sendRematchRequest(49f6e7a06ebc5aa8).(void)
2123 {
2124 if(!room_were_incxx . . $ CyberOroConnection#room_were_in.)
2125 {
2126 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Trying to send rematch request but not in a room");
2127 return;
2128 }
2129 unsigned int length = 10;
2130 unsigned char * packet = new unsigned char[length];
2131 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_were_incxx . . $ CyberOroConnection#room_were_in.);
2132 if(!boarddispatch)
2133 {
2134 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Can't get board for %d for rematch send", room_were_incxx . . $ CyberOroConnection#room_were_in.);
2135 return;
2136 }
2137 GameDatacxx . . $ GameData# * gr = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
2138 packet[0] = 0x69;
2139 packet[1] = 0xc3;
2140 packet[2] = 0x0a;
2141 packet[3] = 0x00;
2142 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
2143 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
2144 packet[6] = gr->opponent_idcxx . . $ GameData#opponent_id. & 0x00ff;
2145 packet[7] = (gr->opponent_idcxx . . $ GameData#opponent_id. >> 8);
2146 packet[8] = 0x12; //?
2147 packet[9] = 0x00; //?
2148
2149 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0xa);
2150 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending rematch request");
2151 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
2152 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending rematch request");
2153 delete[] packet;
2154
2155 /* Since end of game resets the match state */
2156 PlayerListingcxx . . $ PlayerListing# * player = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(gr->opponent_idcxx . . $ GameData#opponent_id.);
2157 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->sendRematchcxx . . $ MatchNegotiationState#sendRematch(122195e397f39e1b).(player);
2158 }
2159
2160 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendRematchAcceptcxx . . $ CyberOroConnection#sendRematchAccept(49f6e7a06ebc5aa8).(void)
2161 {
2162 if(!room_were_incxx . . $ CyberOroConnection#room_were_in.)
2163 {
2164 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Trying to send rematch accept but we aren't in room");
2165 return;
2166 }
2167 unsigned int length = 10;
2168 unsigned char * packet = new unsigned char[length];
2169 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_were_incxx . . $ CyberOroConnection#room_were_in.);
2170 if(!boarddispatch)
2171 {
2172 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Can't get board for %d for rematch accept send", room_were_incxx . . $ CyberOroConnection#room_were_in.);
2173 return;
2174 }
2175 GameDatacxx . . $ GameData# * gr = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
2176 packet[0] = 0x6e;
2177 packet[1] = 0xc3;
2178 packet[2] = 0x0a;
2179 packet[3] = 0x00;
2180 packet[4] = gr->opponent_idcxx . . $ GameData#opponent_id. & 0x00ff;
2181 packet[5] = (gr->opponent_idcxx . . $ GameData#opponent_id. >> 8);
2182 packet[6] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
2183 packet[7] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
2184 packet[8] = 0x12; //? is this a room?
2185 packet[9] = 0x00; //?
2186
2187 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0xa);
2188 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending rematch request accept");
2189 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
2190 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending rematch request accept");
2191 delete[] packet;
2192 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->sendRematchAcceptcxx . . $ MatchNegotiationState#sendRematchAccept(49f6e7a06ebc5aa8).();
2193 //prepare for rematch func?
2194 }
2195
2196 /* I think this double as both our odd/even guess as well
2197 * as the number we send. But I think... well I assume
2198 * that the challenged player is holding the stones out? */
2199 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendNigiricxx . . $ CyberOroConnection#sendNigiri(aa266def8759b091).(unsigned short game_code, bool /*odd*/)
2200 {
2201 unsigned short room_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
2202 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_number);
2203 if(!boarddispatch)
2204 {
2205 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Can't get board for %d for nigiri send", room_number);
2206 return;
2207 }
2208 unsigned int length = 12;
2209 unsigned char * packet = new unsigned char[length];
2210 GameDatacxx . . $ GameData# * gr = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
2211 packet[0] = 0xf5;
2212 packet[1] = 0xaf;
2213 packet[2] = 0x0c;
2214 packet[3] = 0x00;
2215 packet[4] = game_code & 0x00ff;
2216 packet[5] = (game_code >> 8);
2217 packet[6] = room_number & 0x00ff;
2218 packet[7] = (room_number >> 8);
2219 //packet[8] = rand() % 255; //this is both odd and even
2220 /* If its 0x0_, it looks like its an odd choice
2221 * 0x2_ looks like an even choice,
2222 * then the second four bits seem to be the number that gets
2223 * sent. But we can still seemingly confuse the oro client,
2224 * like we're supposed to send something else... it lets it
2225 * play for the right turn, but the colors aren't set. And
2226 * then in addition, we can't seem to play, like we're supposed
2227 * to send something else first
2228 * But so its like the first 4 bits are our choice of odd 0 or even 2
2229 * and then the second 4 bits are the number of stones that our
2230 * opponent is holding. But actually, I've seen 0, 2, and 3 sent!*/
2231 /* FIXME I think we can say definitively that its simpler than we think
2232 * but it definitely doesn't work */
2233 packet[8] = (rand() % 0xd) + 2;
2234 packet[8] |= (rand() % 0x19) + 1; //19? d??? I guess it doesn't matter but...
2235 we_send_nigiricxx . . $ CyberOroConnection#we_send_nigiri. = true;
2236
2237 /* I've seen the new version of this here work at least for one color */
2238 //if((((packet[8] & 0xe0) >> 4) % 2) == ((packet[8] & 0x1f) % 2))
2239 //if(((((packet[8] & 0xe0) >> 5) + 1) % 2) == ((packet[8] & 0x1f) % 2))
2240 if((!(packet[8] & 0x20)) == ((packet[8] & 0x1f) % 2))
2241 {
2242 //0x38 even 24 we play black
2243 #ifdef RE_DEBUG
2244 qDebug("nigiri successful");
2245 #endif //RE_DEBUG
2246 boarddispatch->recvKibitzcxx . . $ BoardDispatch#recvKibitz(3458fe3960d5051).(QStringcxx . . $ QString#QString(ced63f7c635d850d).(), "Opponent plays white"cxx . . $ QString#QString(85c52e162fed56f9).);
2247 if(gr->black_namecxx . . $ GameData#black_name. !=cxx . . $ `operator!=`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).())
2248 boarddispatch->swapColorscxx . . $ BoardDispatch#swapColors(b45ddcbc8423892c).();
2249 else
2250 boarddispatch->swapColorscxx . . $ BoardDispatch#swapColors(b45ddcbc8423892c).(true);
2251 }
2252 else
2253 {
2254 packet[8] |= 0x80; //nigiri failure we play white
2255 //0xaf even 15 we play white
2256 #ifdef RE_DEBUG
2257 qDebug("nigiri failure");
2258 #endif //RE_DEBUG
2259 boarddispatch->recvKibitzcxx . . $ BoardDispatch#recvKibitz(3458fe3960d5051).(QStringcxx . . $ QString#QString(ced63f7c635d850d).(), "Opponent plays black"cxx . . $ QString#QString(85c52e162fed56f9).);
2260 if(gr->white_namecxx . . $ GameData#white_name. !=cxx . . $ `operator!=`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).())
2261 boarddispatch->swapColorscxx . . $ BoardDispatch#swapColors(b45ddcbc8423892c).();
2262 else
2263 boarddispatch->swapColorscxx . . $ BoardDispatch#swapColors(b45ddcbc8423892c).(true);
2264 }
2265 //QMessageBox::information(0 , tr("sending niri"), tr("sending ") + QString::number(packet[8], 16) + tr(" nigiri."));
2266
2267 packet[9] = 0x00; //?
2268 packet[10] = 0x00;
2269 packet[11] = 0x00;
2270
2271 /* Its possible to send this and confuse the ORO client
2272 * actually, if we send this, when we are challenging,
2273 * it thinks that the ORO client sent it.. ?!?! */
2274 #ifdef RE_DEBUG
2275 printf("nigiri packet: ");
2276 for(int i = 0; i < (int)length; i++)
2277 printf("%02x ", packet[i]);
2278 printf("\n");
2279 #endif //RE_DEBUG
2280 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0xc);
2281 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending nigiri");
2282 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
2283 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending nigiri");
2284 delete[] packet;
2285
2286 gr = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).(); //get again
2287 /* FIXME don't think we start until second move */
2288 startMatchTimerscxx . . $ CyberOroConnection#startMatchTimers(b45ddcbc8423892c).(gr->black_namecxx . . $ GameData#black_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).());
2289
2290 // we seem to immediately send keep alive here
2291 if(gr->black_namecxx . . $ GameData#black_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).())
2292 sendGameUpdatecxx . . $ CyberOroConnection#sendGameUpdate(ed53e3bbd3fa2f69).(gr->game_codecxx . . $ GameData#game_code.);
2293 }
2294
2295 /* As in leave a played or in room game? Maybe rooms as well?
2296 * Double check, all those zeroes are suspicious.
2297 * Actually, probably same as sendObserve message for joining
2298 * a game? room? but with no possible password and no id.
2299 * Yeah, leave is basically the same thing as joining a room
2300 * except it joins the 00 room, I guess the lobby.
2301 * Also seems like we can observe after joining other rooms
2302 * without error, it just moves us. */
2303 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendLeavecxx . . $ CyberOroConnection#sendLeave(963dc8955d49573e).(const GameListingcxx . . $ GameListing# *)
2304 {
2305 /* Find why leaving a joined game sends two leaves... */
2306 if(room_were_incxx . . $ CyberOroConnection#room_were_in. == 0)
2307 {
2308 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Attempted to sendLeave but in lobby!");
2309 return;
2310 }
2311 #ifdef RE_DEBUG
2312 qDebug("Sending leave");
2313 #endif //RE_DEBUG
2314
2315 sendJoinRoomcxx . . $ CyberOroConnection#sendJoinRoom(27567cc4e87be946).(0cxx . . $ RoomListing#RoomListing(d4f767463ce0a6b3)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
2316
2317 setRoomNumbercxx . . $ CyberOroConnection#setRoomNumber(ed53e3bbd3fa2f69).(0);
2318 }
2319
2320 void CyberOroConnectioncxx . . $ CyberOroConnection#::requestAccountInfocxx . . $ CyberOroConnection#requestAccountInfo(49f6e7a06ebc5aa8).(void)
2321 {
2322 //QuickConnection * c = new QuickConnection(getQSocket(), NULL, this, QuickConnection::sendRequestAccountInfo);
2323 metaserverQCcxx . . $ CyberOroConnection#metaserverQC. = new QuickConnectioncxx . . $ QuickConnection#QuickConnection(2e604933bf3a85e).(hostnamecxx . . $ QString#QString(132dd6869045752b)., portcxx . . $ NetworkConnection#port., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, this, QuickConnectioncxx . . $ QuickConnection#::sendRequestAccountInfocxx . . $ QuickConnection#sendRequestAccountInfo.);
2324 }
2325
2326 char * CyberOroConnectioncxx . . $ CyberOroConnection#::sendRequestAccountInfocxx . . $ CyberOroConnection#sendRequestAccountInfo(f967802dd305bc07).(int * size, void *)
2327 {
2328 *size = 0x1a;
2329 char * packet = new char[*size];
2330 packet[0] = 0x88;
2331 packet[1] = 0x27;
2332 packet[2] = 0x1a;
2333 packet[3] = 0x00;
2334
2335 packet[4] = 0x40;
2336 packet[5] = 0x00;
2337 writeZeroPaddedStringcxx . . $ NetworkConnection#writeZeroPaddedString(13ac1ff599cf8ed8).(&(packet[6]), getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).(), 10);
2338 packet[16] = 0x43;
2339 packet[17] = 0x00;
2340 packet[18] = 0x12;
2341 packet[19] = 0x0f;
2342 packet[20] = 0xdc;
2343 packet[21] = 0x02;
2344 for(int i= 22; i < *size; i++)
2345 packet[i] = 0x00;
2346 #ifdef RE_DEBUG
2347 printf("requesting account info:\n");
2348 for(int i = 0; i < (int)*size; i++)
2349 printf("%02x", packet[i]);
2350 printf("\n");
2351 #endif //RE_DEBUG
2352 return packet;
2353 }
2354
2355 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleAccountInfoMsgcxx . . $ CyberOroConnection#handleAccountInfoMsg(577809987ad7a468).(int size, char * msg)
2356 {
2357 unsigned short message_type = msg[1] + (msg[0] << 8);
2358
2359 msg += 4;
2360 size -=4;
2361 switch(message_type)
2362 {
2363 case 0x8129:
2364 handleFriendscxx . . $ CyberOroConnection#handleFriends(e1e8b00c42c42532).((unsigned char *)msg, size);
2365 metaserverQCcxx . . $ CyberOroConnection#metaserverQC.->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).();
2366 metaserverQCcxx . . $ CyberOroConnection#metaserverQC. = 0;
2367 break;
2368 case 0x7c29:
2369 //7c29 1a00 789e 0800 8800 b502 e0b0 887c
2370 //78de 0800 0100 0000 709e
2371
2372 //7c29 1a00 000b 0900 ffff ffa0 00ff ffff
2373 //b502 ffff ffe0 ffff ffb0 ffff ff88 7c00
2374 //4b09 0001 0000 00ff ffff f80a
2375 default:
2376 #ifdef RE_DEBUG
2377 msg -= 4; //FIXME
2378 printf("Strange account info: %02x%02x: \n", msg[0], msg[1]);
2379 for(int i = 2; i < (int)size + 4; i++)
2380 printf("%02x", msg[i]);
2381 printf("\n");
2382 #endif //RE_DEBUG
2383 break;
2384 }
2385 }
2386
2387 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendLogincxx . . $ CyberOroConnection#sendLogin(49f6e7a06ebc5aa8).(void)
2388 {
2389 //term code could be version, probably just junk
2390 unsigned char term_code[2] = { 0x57, 0x04 }; //= { 0x5b, 0x02 };
2391 int length = 0x1a; //10 + user and pass padded to 10
2392 unsigned char * packet = new unsigned char[length];
2393 unsigned char * p = packet;
2394 int i;
2395
2396 p[0] = 0x0b; //= 0x6e;
2397 p[1] = 0xe1; //= 0xe2;
2398 p[2] = length;
2399 p[3] = 0x00;
2400 p += 4;
2401
2402 writeZeroPaddedStringcxx . . $ NetworkConnection#writeZeroPaddedString(13ac1ff599cf8ed8).((char *)p, usernamecxx . . $ NetworkConnection#username., 10);
2403 p += 10;
2404
2405 writeZeroPaddedStringcxx . . $ NetworkConnection#writeZeroPaddedString(13ac1ff599cf8ed8).((char *)p, passwordcxx . . $ NetworkConnection#password., 10);
2406 p += 10;
2407 for(i = 0; i < 2; i++)
2408 p[i] = term_code[i];
2409 #ifdef RE_DEBUG
2410 for(i = 0; i < length; i++)
2411 printf("%02x ", packet[i]);
2412 printf("\n");
2413 #endif //RE_DEBUG
2414 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
2415 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending login packet to host");
2416 delete[] packet;
2417 }
2418
2419 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendInvitationSettingscxx . . $ CyberOroConnection#sendInvitationSettings(b45ddcbc8423892c).(bool invite)
2420 {
2421 unsigned int length = 0x0c;
2422 unsigned char * packet = new unsigned char[length];
2423 packet[0] = 0x9a;
2424 packet[1] = 0x65;
2425 packet[2] = 0x0c;
2426 packet[3] = 0x00;
2427 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
2428 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
2429 packet[6] = 0x00;
2430 packet[7] = 0x00;
2431 packet[8] = (invite ? ALLOW_ALL_INVITEScxx . . $ `src/network/cyberoroconnection.cpp:49:9`! : IGNORE_ALL_INVITEScxx . . $ `src/network/cyberoroconnection.cpp:54:9`!);
2432 packet[9] = 0x00;
2433 packet[10] = 0x00;
2434 packet[11] = 0x00; //weird byte???
2435
2436 #ifdef RE_DEBUG
2437 printf("Sending invite settings: ");
2438 for(int i = 0; i < (int)length; i++)
2439 printf("%02x ", packet[i]);
2440 printf("\n");
2441 #endif //RE_DEBUG
2442 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 0xc);
2443 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Sending invitation settings\n");
2444 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, length) < 0)
2445 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending invitation settings");
2446 delete[] packet;
2447 }
2448
2449 /* These four require separate connection to meta
2450 * server! */
2451 void CyberOroConnectioncxx . . $ CyberOroConnection#::addFriendcxx . . $ CyberOroConnection#addFriend(122195e397f39e1b).(PlayerListingcxx . . $ PlayerListing# * player)
2452 {
2453 if(metaserverQCcxx . . $ CyberOroConnection#metaserverQC.)
2454 {
2455 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Already connected to accounts server, please wait.");
2456 //silent no error might be okay
2457 return;
2458 }
2459 metaserverQCcxx . . $ CyberOroConnection#metaserverQC. = new QuickConnectioncxx . . $ QuickConnection#QuickConnection(2e604933bf3a85e).(hostnamecxx . . $ QString#QString(132dd6869045752b)., portcxx . . $ NetworkConnection#port., (void *)player, this, QuickConnectioncxx . . $ QuickConnection#::sendAddFriendcxx . . $ QuickConnection#sendAddFriend.);
2460 NetworkConnectioncxx . . $ NetworkConnection#::addFriendcxx . . $ NetworkConnection#addFriend(122195e397f39e1b).(player);
2461 }
2462
2463 char * CyberOroConnectioncxx . . $ CyberOroConnection#::sendFriendsBlocksMsgcxx . . $ CyberOroConnection#sendFriendsBlocksMsg(fa1eb079735375ec).(int * size, void *p, enum FriendsBlocksMsgTypecxx . . $ CyberOroConnection#FriendsBlocksMsgType# f)
2464 {
2465 PlayerListingcxx . . $ PlayerListing# * player = (PlayerListingcxx . . $ PlayerListing# *)p;
2466 *size = 0x1a;
2467 char * packet = new char[*size];
2468 if(f == fbm_addFriendcxx . . $ CyberOroConnection#fbm_addFriend. || f == fbm_addBlockcxx . . $ CyberOroConnection#fbm_addBlock.)
2469 packet[0] = 0x13;
2470 else
2471 packet[0] = 0x77;
2472 packet[1] = 0x29;
2473 packet[2] = (*size & 0xff);
2474 packet[3] = (*size >> 8);
2475 if(f == fbm_addFriendcxx . . $ CyberOroConnection#fbm_addFriend. || f == fbm_removeFriendcxx . . $ CyberOroConnection#fbm_removeFriend.)
2476 packet[4] = 0x01;
2477 else
2478 packet[4] = 0x02;
2479 packet[5] = 0x00;
2480 writeZeroPaddedStringcxx . . $ NetworkConnection#writeZeroPaddedString(13ac1ff599cf8ed8).((char *)&(packet[6]), getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).(), 10);
2481 writeZeroPaddedStringcxx . . $ NetworkConnection#writeZeroPaddedString(13ac1ff599cf8ed8).((char *)&(packet[16]), player->namecxx . . $ PlayerListing#name., 10);
2482 return packet;
2483 }
2484
2485 char * CyberOroConnectioncxx . . $ CyberOroConnection#::sendAddFriendcxx . . $ CyberOroConnection#sendAddFriend(f967802dd305bc07).(int * size, void * p)
2486 {
2487 return sendFriendsBlocksMsgcxx . . $ CyberOroConnection#sendFriendsBlocksMsg(fa1eb079735375ec).(size, p, fbm_addFriendcxx . . $ CyberOroConnection#fbm_addFriend.);
2488 }
2489
2490 #ifdef RE_DEBUG
2491 void CyberOroConnection::recvFriendResponse(int size, char * msg)
2492 #else
2493 void CyberOroConnectioncxx . . $ CyberOroConnection#::recvFriendResponsecxx . . $ CyberOroConnection#recvFriendResponse(577809987ad7a468).(int size, char * /*msg*/)
2494 #endif //RE_DEBUG
2495 {
2496 if(size != 8)
2497 {
2498 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("received friends list response of strange size: %d\n", size);
2499 //return;
2500 }
2501 //1f2708001a270000
2502 #ifdef RE_DEBUG
2503 int i;
2504 printf("recvFriendResponse:\n");
2505 for(i = 0; i < size; i++)
2506 printf("%02x", msg[i]);
2507 printf("\n");
2508 #endif //RE_DEBUG
2509 metaserverQCcxx . . $ CyberOroConnection#metaserverQC.->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).();
2510 metaserverQCcxx . . $ CyberOroConnection#metaserverQC. = 0;
2511 }
2512
2513 void CyberOroConnectioncxx . . $ CyberOroConnection#::removeFriendcxx . . $ CyberOroConnection#removeFriend(122195e397f39e1b).(PlayerListingcxx . . $ PlayerListing# * player)
2514 {
2515 if(metaserverQCcxx . . $ CyberOroConnection#metaserverQC.)
2516 {
2517 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Already connected to accounts server, please wait.");
2518 //silent no error might be okay
2519 return;
2520 }
2521 metaserverQCcxx . . $ CyberOroConnection#metaserverQC. = new QuickConnectioncxx . . $ QuickConnection#QuickConnection(2e604933bf3a85e).(hostnamecxx . . $ QString#QString(132dd6869045752b)., portcxx . . $ NetworkConnection#port., (void *)player, this, QuickConnectioncxx . . $ QuickConnection#::sendRemoveFriendcxx . . $ QuickConnection#sendRemoveFriend.);
2522 NetworkConnectioncxx . . $ NetworkConnection#::removeFriendcxx . . $ NetworkConnection#removeFriend(122195e397f39e1b).(player);
2523 }
2524
2525 char * CyberOroConnectioncxx . . $ CyberOroConnection#::sendRemoveFriendcxx . . $ CyberOroConnection#sendRemoveFriend(f967802dd305bc07).(int * size, void * p)
2526 {
2527 return sendFriendsBlocksMsgcxx . . $ CyberOroConnection#sendFriendsBlocksMsg(fa1eb079735375ec).(size, p, fbm_removeFriendcxx . . $ CyberOroConnection#fbm_removeFriend.);
2528 }
2529
2530 void CyberOroConnectioncxx . . $ CyberOroConnection#::addBlockcxx . . $ CyberOroConnection#addBlock(122195e397f39e1b).(PlayerListingcxx . . $ PlayerListing# * player)
2531 {
2532 if(metaserverQCcxx . . $ CyberOroConnection#metaserverQC.)
2533 {
2534 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Already connected to accounts server, please wait.");
2535 //silent no error might be okay
2536 return;
2537 }
2538 metaserverQCcxx . . $ CyberOroConnection#metaserverQC. = new QuickConnectioncxx . . $ QuickConnection#QuickConnection(2e604933bf3a85e).(hostnamecxx . . $ QString#QString(132dd6869045752b)., portcxx . . $ NetworkConnection#port., (void *)player, this, QuickConnectioncxx . . $ QuickConnection#::sendAddBlockcxx . . $ QuickConnection#sendAddBlock.);
2539 NetworkConnectioncxx . . $ NetworkConnection#::addBlockcxx . . $ NetworkConnection#addBlock(122195e397f39e1b).(player);
2540 }
2541
2542 void CyberOroConnectioncxx . . $ CyberOroConnection#::removeBlockcxx . . $ CyberOroConnection#removeBlock(122195e397f39e1b).(PlayerListingcxx . . $ PlayerListing# * player)
2543 {
2544 if(metaserverQCcxx . . $ CyberOroConnection#metaserverQC.)
2545 {
2546 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Already connected to accounts server, please wait.");
2547 //silent no error might be okay
2548 return;
2549 }
2550 metaserverQCcxx . . $ CyberOroConnection#metaserverQC. = new QuickConnectioncxx . . $ QuickConnection#QuickConnection(2e604933bf3a85e).(hostnamecxx . . $ QString#QString(132dd6869045752b)., portcxx . . $ NetworkConnection#port., (void *)player, this, QuickConnectioncxx . . $ QuickConnection#::sendRemoveBlockcxx . . $ QuickConnection#sendRemoveBlock.);
2551 NetworkConnectioncxx . . $ NetworkConnection#::removeBlockcxx . . $ NetworkConnection#removeBlock(122195e397f39e1b).(player);
2552 }
2553
2554 char * CyberOroConnectioncxx . . $ CyberOroConnection#::sendAddBlockcxx . . $ CyberOroConnection#sendAddBlock(f967802dd305bc07).(int * size, void * p)
2555 {
2556 return sendFriendsBlocksMsgcxx . . $ CyberOroConnection#sendFriendsBlocksMsg(fa1eb079735375ec).(size, p, fbm_addBlockcxx . . $ CyberOroConnection#fbm_addBlock.);
2557 }
2558
2559 char * CyberOroConnectioncxx . . $ CyberOroConnection#::sendRemoveBlockcxx . . $ CyberOroConnection#sendRemoveBlock(f967802dd305bc07).(int * size, void * p)
2560 {
2561 return sendFriendsBlocksMsgcxx . . $ CyberOroConnection#sendFriendsBlocksMsg(fa1eb079735375ec).(size, p, fbm_removeBlockcxx . . $ CyberOroConnection#fbm_removeBlock.);
2562 }
2563
2564 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendDisconnectMsgcxx . . $ CyberOroConnection#sendDisconnectMsg(49f6e7a06ebc5aa8).(void)
2565 {
2566 if(!codetablecxx . . $ CyberOroConnection#codetable.)
2567 return;
2568 unsigned char * packet = new unsigned char[8];
2569 packet[0] = 0x1c;
2570 packet[1] = 0x52;
2571 packet[2] = 0x08;
2572 packet[3] = 0x00;
2573 packet[4] = our_player_idcxx . . $ CyberOroConnection#our_player_id. & 0x00ff;
2574 packet[5] = (our_player_idcxx . . $ CyberOroConnection#our_player_id. >> 8);
2575 packet[6] = 0x00; //zeroes for fun?? FIXME
2576 packet[7] = 0x00;
2577
2578 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(packet, 8);
2579 #ifdef RE_DEBUG
2580 qDebug("Sending disconnect msg");
2581 #endif //RE_DEBUG
2582 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, 8) < 0)
2583 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending disconnect packet");
2584 delete[] packet;
2585 }
2586
2587 /* This is a challenge-response message. The meta-server validates
2588 * the name and password and sends a chunk of something which is
2589 * then passed to whatever servers the client connects to */
2590 /* This isn't a challenge response probably but just a server
2591 * connect packet... that's my guess.
2592 * It seems like this is sent when we switch servers mid session so
2593 * yeah...*/
2594 void CyberOroConnectioncxx . . $ CyberOroConnection#::sendChallengeResponsecxx . . $ CyberOroConnection#sendChallengeResponse(49f6e7a06ebc5aa8).(void)
2595 {
2596 int i;
2597 unsigned char * p;
2598 unsigned char packet[120];
2599 p = packet;
2600 /* The opening four bytes are operated on by some kind of cyclic
2601 * xor in a table... we're still working it out. Also below
2602 * may have two options as well. DONE */
2603 p[0] = 0x07;
2604 p[1] = 0x52;
2605 p[2] = 0x78;
2606 p[3] = 0x00;
2607 encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(p, 6);
2608 p += 4;
2609 for(i = 0; i < 106; i++)
2610 p[i] = challenge_responsecxx . . $ CyberOroConnection#challenge_response.[i];
2611 p += 106;
2612 /* I think this 05 can change but I'm not certain. */
2613 p[0] = 0x05;
2614 p[1] = 0x00;
2615 p += 2;
2616 /* These 4 bytes are literally random, we can put
2617 * anything here */
2618 p[0] = 0x01;
2619 p[1] = 0x02;
2620 p[2] = 0x03;
2621 p[3] = 0x04;
2622 p += 4;
2623 p[0] = 0x31;
2624 p[1] = 0x2e;
2625 p[2] = 0x33;
2626 p[3] = 0x38;
2627 #ifdef RE_DEBUG
2628 printf("Sending challenge response\n");
2629 for(i = 0; i < 120; i++)
2630 printf("%02x ", packet[i]);
2631 printf("\n");
2632 #endif //RE_DEBUG
2633 if(writecxx . . $ NetworkConnection#write(1df18506ef0a631b).((const char *)packet, 120) < 0)
2634 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("*** failed sending challenge response");
2635 }
2636
2637 /* I think the codetable is used so that the session can't
2638 * be violated or forged. In other words, since we're the
2639 * only client with the right codetable and the right IV
2640 * position in that code table as by all the messages we've
2641 * sent, no one can, for instance, send a move packet with
2642 * our name and make us make a move that we don't intend.
2643 * Seems that there could be simpler ways to do it and I
2644 * do wonder if its partly for obfuscation still.*/
2645 void CyberOroConnectioncxx . . $ CyberOroConnection#::encodecxx . . $ CyberOroConnection#encode(e1e8b00c42c42532).(unsigned char * h, unsigned int cycle_size)
2646 {
2647 int i;
2648 unsigned char a = 0xff;
2649 int IV3 = cycle_size; //maybe we're passed this?
2650
2651 IV3 -= 3;
2652 /* sub edx, eax jl */
2653 IV3++;
2654 for(i = 0; i < IV3; i++)
2655 {
2656 h[i] = h[i] ^ codetablecxx . . $ CyberOroConnection#codetable.[codetable_IVcxx . . $ CyberOroConnection#codetable_IV.];
2657 a = h[i] ^ a;
2658 codetable_IVcxx . . $ CyberOroConnection#codetable_IV.++;
2659 codetable_IVcxx . . $ CyberOroConnection#codetable_IV. %= 1000; //double check!!! could be /!!
2660 if(codetable_IVcxx . . $ CyberOroConnection#codetable_IV. == 0) //should probably be % 1000 ==, not %=!!!
2661 {
2662 codetable_IV2cxx . . $ CyberOroConnection#codetable_IV2.++;
2663 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("incrementing codetable_IV2: %d", codetable_IV2cxx . . $ CyberOroConnection#codetable_IV2.);
2664 }
2665 }
2666 if(cycle_size >= 8)
2667 {
2668 /* 16000f points to the byte before the header for some reason */
2669 h[cycle_size - 1/* + [codetable +34d3]*/] = a;
2670 }
2671 if(codetable_IV2cxx . . $ CyberOroConnection#codetable_IV2. >= 10)
2672 {
2673 if(codetable_IVcxx . . $ CyberOroConnection#codetable_IV. >= 900)
2674 {
2675 /* looks like we zero codetable_IV2 and
2676 * then do some crazy repeated shit */
2677 }
2678 }
2679 }
2680
2681 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleMessagecxx . . $ CyberOroConnection#handleMessage(7df51288a9ebd664).(QStringcxx . . $ QString#)
2682 {
2683 }
2684
2685 /* We may convert everything here to unsigned char *s, delete the old...
2686 * we're still sort of hung up on all the things we were doing
2687 * to work with the IGS code. */
2688 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleMessagecxx . . $ CyberOroConnection#handleMessage(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
2689 {
2690 unsigned short message_type = msg[1] + (msg[0] << 8);
2691 //message_type = msg[0];
2692 //message_type >>= 8;
2693 //message_type += msg[1];
2694 /* Third byte is likely the size of the message meaning multiple
2695 * messages per packet, etc. */
2696 /*if((message_type & 0x00ff) == 0x00b3)
2697 {*/
2698 #ifdef RE_DEBUG
2699 //seems unnecessary even for debug
2700 /*printf("****: \n");
2701 for(unsigned int i = 0; i < size; i++)
2702 printf("%02x", msg[i]);
2703 printf("\n");*/
2704 #endif //RE_DEBUG
2705 /*}*/
2706 msg += 4;
2707 size -=4;
2708 switch(message_type)
2709 {
2710 case ORO_CODETABLEcxx . . $ `src/network/cyberoroprotocol.h:23:9`!:
2711 handleCodeTablecxx . . $ CyberOroConnection#handleCodeTable(e1e8b00c42c42532).(msg, size);
2712 break;
2713 case 0x2652:
2714 handleConnectedcxx . . $ CyberOroConnection#handleConnected(e1e8b00c42c42532).(msg, size);
2715 break;
2716 case ORO_PLAYERLISTcxx . . $ `src/network/cyberoroprotocol.h:25:9`!:
2717 handlePlayerListcxx . . $ CyberOroConnection#handlePlayerList(e1e8b00c42c42532).(msg, size);
2718 break;
2719 /*case 0xfa00:
2720 printf("likely game message\n");
2721 break;*/
2722 case 0x2c56:
2723 #ifdef RE_DEBUG
2724 printf("0x2c56: some kind of logon");
2725 for(unsigned int i = 0; i < size; i++)
2726 printf("%02x", msg[i]);
2727 printf("\n");
2728 #endif //RE_DEBUG
2729 break;
2730 case ORO_BROADCASTLISTcxx . . $ `src/network/cyberoroprotocol.h:27:9`!:
2731 //boardcast games list
2732 handleBroadcastGamesListcxx . . $ CyberOroConnection#handleBroadcastGamesList(e1e8b00c42c42532).(msg, size);
2733 break;
2734 case ORO_ROOMLISTcxx . . $ `src/network/cyberoroprotocol.h:24:9`!:
2735 handleRoomListcxx . . $ CyberOroConnection#handleRoomList(e1e8b00c42c42532).(msg, size);
2736 break;
2737 case 0xb261:
2738 #ifdef RE_DEBUG
2739 printf("0xb261: ");
2740 for(unsigned int i = 0; i < size; i++)
2741 printf("%02x", msg[i]);
2742 printf("\n");
2743 #endif //RE_DEBUG
2744 break;
2745 case 0xee61:
2746 #ifdef RE_DEBUG
2747 printf("0xee61: ");
2748 for(unsigned int i = 0; i < size; i++)
2749 printf("%02x", msg[i]);
2750 printf("\n");
2751 #endif //RE_DEBUG
2752 break;
2753 case 0xdf61:
2754 #ifdef RE_DEBUG
2755 printf("0xdf61: ");
2756 for(unsigned int i = 0; i < size; i++)
2757 printf("%02x", msg[i]);
2758 printf("\n");
2759 #endif //RE_DEBUG
2760 break;
2761 case 0xe461:
2762 handleMsg2cxx . . $ CyberOroConnection#handleMsg2(e1e8b00c42c42532).(msg, size);
2763 break;
2764 case 0x62f2: //0x94 bytes, this looks a LIVE GO game listing entry
2765 /*0000 0600 5046 cc13 b91d 0303 0000 3c03 0200 4873 6965 682e 592e 4d00 0000
2766 0000 0000 5375 7a75 6b69 2e41 0000 0000 0000 0000
2767 8ed3 88cb 9ddf 0000 0000 0000 0000 0000 97e9 96d8 95e0 0000
2768 0000 0000 0000 0000 0303 c4c4 0305 0000 0000 0000
2769 91e6 3237 8afa 8f97 97ac 967b 88f6 9656 90ed 91e6 318b
2770 c700000000000000000000000000000000000000000000000100001f*/
2771 #ifdef RE_DEBUG
2772 printf("0x62f2: ");
2773 for(unsigned int i = 0; i < size; i++)
2774 printf("%02x", msg[i]);
2775 printf("\n");
2776 #endif //RE_DEBUG
2777 break;
2778 case 0x68f6:
2779 //could this mean connected?
2780 #ifdef RE_DEBUG
2781 printf("0x68f6: ");
2782 for(unsigned int i = 0; i < size; i++)
2783 printf("%02x", msg[i]);
2784 printf("\n");
2785 #endif //RE_DEBUG
2786 break;
2787 case ORO_GAMELISTcxx . . $ `src/network/cyberoroprotocol.h:26:9`!:
2788 handleGamesListcxx . . $ CyberOroConnection#handleGamesList(e1e8b00c42c42532).(msg, size);
2789 break;
2790 case ORO_PLAYERROOMJOINcxx . . $ `src/network/cyberoroprotocol.h:29:9`!:
2791 handlePlayerRoomJoincxx . . $ CyberOroConnection#handlePlayerRoomJoin(e1e8b00c42c42532).(msg, size);
2792 break;
2793 case 0x0456:
2794 handlePlayerConnectcxx . . $ CyberOroConnection#handlePlayerConnect(e1e8b00c42c42532).(msg, size);
2795 break;
2796 case 0x5ac3:
2797 handleGamePhaseUpdatecxx . . $ CyberOroConnection#handleGamePhaseUpdate(e1e8b00c42c42532).(msg, size);
2798 break;
2799 case 0x50c3:
2800 handleMsg3cxx . . $ CyberOroConnection#handleMsg3(e1e8b00c42c42532).(msg, size);
2801 break;
2802 case 0x38f4:
2803 /* FIXME, this needs to maybe open a board,
2804 * maybe not... but something needs to */
2805 handleBettingMatchStartcxx . . $ CyberOroConnection#handleBettingMatchStart(e1e8b00c42c42532).(msg, size);
2806 break;
2807 case 0x56f4:
2808 handleBettingMatchResultcxx . . $ CyberOroConnection#handleBettingMatchResult(e1e8b00c42c42532).(msg, size);
2809 break;
2810 case ORO_BROADCASTMOVEcxx . . $ `src/network/cyberoroprotocol.h:33:9`!: //betting match?
2811 case ORO_MOVEcxx . . $ `src/network/cyberoroprotocol.h:32:9`!:
2812 handleMovecxx . . $ CyberOroConnection#handleMove(e1e8b00c42c42532).(msg, size);
2813 break;
2814 case ORO_UNDOcxx . . $ `src/network/cyberoroprotocol.h:34:9`!:
2815 handleUndocxx . . $ CyberOroConnection#handleUndo(e1e8b00c42c42532).(msg, size);
2816 break;
2817 case ORO_DECLINEUNDOcxx . . $ `src/network/cyberoroprotocol.h:35:9`!:
2818 handleDeclineUndocxx . . $ CyberOroConnection#handleDeclineUndo(e1e8b00c42c42532).(msg, size);
2819 break;
2820 case ORO_ACCEPTUNDOcxx . . $ `src/network/cyberoroprotocol.h:36:9`!:
2821 handleAcceptUndocxx . . $ CyberOroConnection#handleAcceptUndo(e1e8b00c42c42532).(msg, size); //generic undo?
2822 break;
2823 case ORO_MOVELISTcxx . . $ `src/network/cyberoroprotocol.h:37:9`!:
2824 handleMoveListcxx . . $ CyberOroConnection#handleMoveList(e1e8b00c42c42532).(msg, size);
2825 break;
2826 case ORO_BROADCASTMOVELISTcxx . . $ `src/network/cyberoroprotocol.h:38:9`!:
2827 handleMoveList2cxx . . $ CyberOroConnection#handleMoveList2(e1e8b00c42c42532).(msg, size);
2828 break;
2829 case 0xd2af:
2830 handleMatchOpenedcxx . . $ CyberOroConnection#handleMatchOpened(e1e8b00c42c42532).(msg, size);
2831 break;
2832 case 0x5fc3:
2833 handleResumeMatchcxx . . $ CyberOroConnection#handleResumeMatch(e1e8b00c42c42532).(msg, size);
2834 break;
2835 //case 0x38f4:
2836 // handleObserveAfterJoining(msg, size);
2837 // break;
2838 case 0x9a65:
2839 handleInvitationSettingscxx . . $ CyberOroConnection#handleInvitationSettings(e1e8b00c42c42532).(msg, size);
2840 break;
2841 case 0xf5af:
2842 handleNigiricxx . . $ CyberOroConnection#handleNigiri(e1e8b00c42c42532).(msg, size);
2843 break;
2844 case 0x1e7d: //match invite accept
2845 handleMatchOfferPendingcxx . . $ CyberOroConnection#handleMatchOfferPending(e1e8b00c42c42532).(msg, size);
2846 break;
2847 case 0x147d:
2848 handleAcceptMatchInvitecxx . . $ CyberOroConnection#handleAcceptMatchInvite(e1e8b00c42c42532).(msg, size);
2849 break;
2850 case 0x459c:
2851 #ifdef RE_DEBUG
2852 // we send this as finish observing
2853 printf("0x459c: finish observing?");
2854 for(unsigned int i = 0; i < size; i++)
2855 printf("%02x", msg[i]);
2856 printf("\n");
2857 #endif //RE_DEBUG
2858 break;
2859 case 0x2279:
2860 handleMatchInvitecxx . . $ CyberOroConnection#handleMatchInvite(e1e8b00c42c42532).(msg, size);
2861 break;
2862 case 0x1a7d:
2863 #ifdef RE_DEBUG
2864 printf("0x1a7d: game starting? ");
2865 for(unsigned int i = 0; i < size; i++)
2866 printf("%02x", msg[i]);
2867 printf("\n");
2868 #endif //RE_DEBUG
2869 break;
2870 case 0x0a7d:
2871 handleNewRoomcxx . . $ CyberOroConnection#handleNewRoom(e1e8b00c42c42532).(msg, size);
2872 break;
2873 case 0x1a81:
2874 handleGameMsgcxx . . $ CyberOroConnection#handleGameMsg(e1e8b00c42c42532).(msg, size);
2875 break;
2876 case ORO_CREATEROOMcxx . . $ `src/network/cyberoroprotocol.h:30:9`!: //was WantsMatch
2877 handleCreateRoomcxx . . $ CyberOroConnection#handleCreateRoom(e1e8b00c42c42532).(msg, size);
2878 break;
2879 case ORO_RESIGNcxx . . $ `src/network/cyberoroprotocol.h:43:9`!:
2880 handleResigncxx . . $ CyberOroConnection#handleResign(e1e8b00c42c42532).(msg, size);
2881 break;
2882 case ORO_REMOVESTONEScxx . . $ `src/network/cyberoroprotocol.h:41:9`!:
2883 handleRemoveStonescxx . . $ CyberOroConnection#handleRemoveStones(e1e8b00c42c42532).(msg, size);
2884 break;
2885 case ORO_STONESDONEcxx . . $ `src/network/cyberoroprotocol.h:42:9`!:
2886 handleStonesDonecxx . . $ CyberOroConnection#handleStonesDone(e1e8b00c42c42532).(msg, size);
2887 break;
2888 case 0xe7b3: //response to our done
2889 handleScorecxx . . $ CyberOroConnection#handleScore(e1e8b00c42c42532).(msg, size);
2890 break;
2891 case 0x8fbb:
2892 #ifdef RE_DEBUG
2893 //thinking this is just a match result
2894 printf("0xtime: 8fbb: ");
2895 for(unsigned int i = 0; i < size; i++)
2896 printf("%02x", msg[i]);
2897 printf("\n");
2898 #endif //RE_DEBUG
2899 break;
2900 case 0x85bb:
2901 handleNewGamecxx . . $ CyberOroConnection#handleNewGame(e1e8b00c42c42532).(msg, size); //really game result?
2902 break;
2903 case 0xecb3: //something to do with done messages in matches
2904 #ifdef RE_DEBUG
2905 /* Its possible, see out151, that one of these
2906 * bytes is just supposed to be passed back
2907 * or even that the ecb3 is like an angry,
2908 * response to a bad done message*/
2909 printf("0xecb3: ");
2910 for(unsigned int i = 0; i < size; i++)
2911 printf("%02x", msg[i]);
2912 printf("\n");
2913 #endif //RE_DEBUG
2914 break;
2915 /* One of the below 6 indicates we've joined an adjourned
2916 * game that's already in score mode */
2917 /* Actually I think eede just means we've resumed the game.
2918 * we're just going to make the moveList aware of it */
2919 case 0xeede:
2920 // this looks like an end observer list msg
2921 /* Its probably this one, its immediately followed by
2922 * a game id*/
2923 #ifdef RE_DEBUG
2924 printf("0xeede: ");
2925 for(unsigned int i = 0; i < size; i++)
2926 printf("%02x", msg[i]);
2927 printf("\n");
2928 #endif //RE_DEBUG
2929 break;
2930 case 0xdfde:
2931 //probably not observer list!!!
2932 handleObserverListcxx . . $ CyberOroConnection#handleObserverList(e1e8b00c42c42532).(msg, size);
2933 break;
2934 case 0xadde:
2935 #ifdef RE_DEBUG
2936 printf("0xadde: ");
2937 for(unsigned int i = 0; i < size; i++)
2938 printf("%02x", msg[i]);
2939 printf("\n");
2940 #endif //RE_DEBUG
2941 break;
2942 case 0xa8de:
2943 #ifdef RE_DEBUG
2944 printf("a8de: ");
2945 for(unsigned int i = 0; i < size; i++)
2946 printf("%02x", msg[i]);
2947 printf("\n");
2948 #endif //RE_DEBUG
2949 break;
2950 case 0xc4fe:
2951 #ifdef RE_DEBUG
2952 printf("0xc4fe: ");
2953 for(unsigned int i = 0; i < size; i++)
2954 printf("%02x", msg[i]);
2955 printf("\n");
2956 #endif //RE_DEBUG
2957 break;
2958 case 0xedfd:
2959 #ifdef RE_DEBUG
2960 printf("0xedfd: ");
2961 for(unsigned int i = 0; i < size; i++)
2962 printf("%02x", msg[i]);
2963 printf("\n");
2964 #endif //RE_DEBUG
2965 break;
2966 case 0x06fe:
2967 #ifdef RE_DEBUG
2968 printf("0x06fe: ");
2969 for(unsigned int i = 0; i < size; i++)
2970 printf("%02x", msg[i]);
2971 printf("\n");
2972 #endif //RE_DEBUG
2973 break;
2974 case 0x01fe:
2975 #ifdef RE_DEBUG
2976 printf("0x01fe: ");
2977 for(unsigned int i = 0; i < size; i++)
2978 printf("%02x", msg[i]);
2979 printf("\n");
2980 #endif //RE_DEBUG
2981 break;
2982 case 0x0bfe:
2983 #ifdef RE_DEBUG
2984 printf("0x0bfe: ");
2985 for(unsigned int i = 0; i < size; i++)
2986 printf("%02x", msg[i]);
2987 printf("\n");
2988 #endif //RE_DEBUG
2989 break;
2990 //82c3: 0a00b60ca23a6816
2991 //***
2992 case 0x82c3:
2993 #ifdef RE_DEBUG
2994 printf("0x82c3: ");
2995 for(unsigned int i = 0; i < size; i++)
2996 printf("%02x", msg[i]);
2997 printf("\n");
2998 #endif //RE_DEBUG
2999 break;
3000 case 0xc4b3:
3001 handleRequestCountcxx . . $ CyberOroConnection#handleRequestCount(e1e8b00c42c42532).(msg, size);
3002 break;
3003 case 0xceb3:
3004 handleRejectCountRequestcxx . . $ CyberOroConnection#handleRejectCountRequest(e1e8b00c42c42532).(msg, size);
3005 break;
3006 case 0x05b4:
3007 handleRequestMatchModecxx . . $ CyberOroConnection#handleRequestMatchMode(e1e8b00c42c42532).(msg, size);
3008 break;
3009 case 0x0ab4:
3010 handleRejectMatchModeRequestcxx . . $ CyberOroConnection#handleRejectMatchModeRequest(e1e8b00c42c42532).(msg, size);
3011 break;
3012 case 0x20cb:
3013 {
3014 #ifdef RE_DEBUG
3015 PlayerListing * p = getDefaultRoom()->getPlayerListing(msg[0] + (msg[1] << 8));
3016 printf("0x20cb %s: ", (p ? p->name.toLatin1().constData() : "-"));
3017 for(unsigned int i = 0; i < size; i++)
3018 printf("%02x", msg[i]);
3019 printf("\n");
3020 #endif //RE_DEBUG
3021 }
3022 break;
3023 case ORO_TIMELOSScxx . . $ `src/network/cyberoroprotocol.h:44:9`!:
3024 handleTimeLosscxx . . $ CyberOroConnection#handleTimeLoss(e1e8b00c42c42532).(msg, size);
3025 break;
3026 case 0x69c3:
3027 handleRematchRequestcxx . . $ CyberOroConnection#handleRematchRequest(e1e8b00c42c42532).(msg, size);
3028 break;
3029 case 0x6ec3:
3030 handleRematchAcceptcxx . . $ CyberOroConnection#handleRematchAccept(e1e8b00c42c42532).(msg, size);
3031 break;
3032 case ORO_SETPHRASECHATcxx . . $ `src/network/cyberoroprotocol.h:49:9`!:
3033 handleSetPhraseChatMsgcxx . . $ CyberOroConnection#handleSetPhraseChatMsg(e1e8b00c42c42532).(msg, size);
3034 break;
3035 case 0x327d:
3036 handleMatchDeclinecxx . . $ CyberOroConnection#handleMatchDecline(e1e8b00c42c42532).(msg, size);
3037 break;
3038 case 0xbc61:
3039 #ifdef RE_DEBUG
3040 printf("0xbc61: ");
3041 for(unsigned int i = 0; i < size; i++)
3042 printf("%02x", msg[i]);
3043 printf("\n");
3044 #endif //RE_DEBUG
3045 break;
3046 case 0x162b:
3047 #ifdef RE_DEBUG
3048 printf("0x162b: ");
3049 for(unsigned int i = 0; i < size; i++)
3050 printf("%02x", msg[i]);
3051 printf("\n");
3052 #endif //RE_DEBUG
3053 break;
3054 case 0x60f4:
3055 #ifdef RE_DEBUG
3056 printf("0x60f4: ");
3057 for(unsigned int i = 0; i < size; i++)
3058 printf("%02x", msg[i]);
3059 printf("\n");
3060 #endif //RE_DEBUG
3061 break;
3062 case 0x78c3:
3063 #ifdef RE_DEBUG
3064 printf("0x78c3: ");
3065 for(unsigned int i = 0; i < size; i++)
3066 printf("%02x", msg[i]);
3067 printf("\n");
3068 #endif //RE_DEBUG
3069 break;
3070 case 0xa479:
3071 handleDeclineMatchInvitecxx . . $ CyberOroConnection#handleDeclineMatchInvite(e1e8b00c42c42532).(msg, size);
3072 break;
3073 case 0x285a: //maybe a special tournament announcement or something
3074 case ORO_SERVERANNOUNCEcxx . . $ `src/network/cyberoroprotocol.h:53:9`!:
3075 handleServerAnnouncementcxx . . $ CyberOroConnection#handleServerAnnouncement(e1e8b00c42c42532).(msg, size);
3076 break;
3077 case ORO_SERVERANNOUNCELINKcxx . . $ `src/network/cyberoroprotocol.h:54:9`!:
3078 handleServerAnnouncementwithLinkcxx . . $ CyberOroConnection#handleServerAnnouncementwithLink(e1e8b00c42c42532).(msg, size);
3079 break;
3080 case 0x0c2b:
3081 #ifdef RE_DEBUG
3082 printf("0x0c2b: ");
3083 for(unsigned int i = 0; i < size; i++)
3084 printf("%02x", msg[i]);
3085 printf("\n");
3086 #endif //RE_DEBUG
3087 break;
3088 case 0x39cb:
3089 {
3090 #ifdef RE_DEBUG
3091 PlayerListing * p = getDefaultRoom()->getPlayerListing(msg[0] + (msg[1] << 8));
3092 printf("0x39cb %s: ", (p ? p->name.toLatin1().constData() : "-"));
3093 for(unsigned int i = 0; i < size; i++)
3094 printf("%02x", msg[i]);
3095 printf("\n");
3096 #endif //RE_DEBUG
3097 }
3098 break;
3099 case 0x3ff2:
3100 #ifdef RE_DEBUG
3101 printf("0x3ff2: ");
3102 for(unsigned int i = 0; i < size; i++)
3103 printf("%02x", msg[i]);
3104 printf("\n");
3105 #endif //RE_DEBUG
3106 break;
3107 case 0x482b: //bad challenge response response?
3108 /* I think this might indicate a full server */
3109 QMessageBoxcxx . . $ QMessageBox#::informationcxx . . $ QMessageBox#information(a9e3742e6f7b4147).(0, trcxx . . $ NetworkConnection#tr(75d9f1c324b4579d).("Server full"), trcxx . . $ NetworkConnection#tr(75d9f1c324b4579d).("Server full, try another"));
3110 if(reconnectToServercxx . . $ CyberOroConnection#reconnectToServer(b126dc7c1de90089).() < 0)
3111 {
3112 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("User canceled");
3113 setStatecxx . . $ NetworkConnection#setState(41e728cff2b23034).(Canceledcxx . . $ Canceled.);
3114 return;
3115 }
3116 #ifdef RE_DEBUG
3117 printf("0x482b: ");
3118 for(unsigned int i = 0; i < size; i++)
3119 printf("%02x", msg[i]);
3120 printf("\n");
3121 #endif //RE_DEBUG
3122 break;
3123 case 0x022b:
3124 #ifdef RE_DEBUG
3125 /* This looks like its trying to correct the protocol
3126 * or something, like its giving us either the msg type
3127 * we should have sent or the last one sent */
3128 printf("0x022b: ");
3129 for(unsigned int i = 0; i < size; i++)
3130 printf("%02x", msg[i]);
3131 printf("\n");
3132 #endif //RE_DEBUG
3133 break;
3134 case 0x1356:
3135 #ifdef RE_DEBUG
3136 printf("0x1356 likely player disconnect: ");
3137 for(unsigned int i = 0; i < size; i++)
3138 printf("%02x", msg[i]);
3139 printf("\n");
3140 #endif //RE_DEBUG
3141 break;
3142 case ORO_ENTERSCORINGcxx . . $ `src/network/cyberoroprotocol.h:40:9`!:
3143 handleEnterScoringcxx . . $ CyberOroConnection#handleEnterScoring(e1e8b00c42c42532).(msg, size);
3144 break;
3145 case ORO_ADJOURNREQUESTcxx . . $ `src/network/cyberoroprotocol.h:45:9`!:
3146 handleAdjournRequestcxx . . $ CyberOroConnection#handleAdjournRequest(e1e8b00c42c42532).(msg, size);
3147 break;
3148 case ORO_ADJOURNDECLINEcxx . . $ `src/network/cyberoroprotocol.h:46:9`!:
3149 handleAdjournDeclinecxx . . $ CyberOroConnection#handleAdjournDecline(e1e8b00c42c42532).(msg ,size);
3150 break;
3151 case ORO_ADJOURNcxx . . $ `src/network/cyberoroprotocol.h:47:9`!:
3152 handleAdjourncxx . . $ CyberOroConnection#handleAdjourn(e1e8b00c42c42532).(msg, size);
3153 break;
3154 case ORO_LOBBYCHATcxx . . $ `src/network/cyberoroprotocol.h:50:9`!:
3155 handleServerRoomChatcxx . . $ CyberOroConnection#handleServerRoomChat(e1e8b00c42c42532).(msg, size);
3156 /* We'll eventually need to translate these into unicode characters
3157 * and it looks like they have a player id that comes before */
3158 break;
3159 case ORO_ROOMCHATcxx . . $ `src/network/cyberoroprotocol.h:51:9`!:
3160 handleRoomChatcxx . . $ CyberOroConnection#handleRoomChat(e1e8b00c42c42532).(msg, size);
3161 break;
3162 case ORO_PERSONALCHATcxx . . $ `src/network/cyberoroprotocol.h:52:9`!:
3163 handlePersonalChatcxx . . $ CyberOroConnection#handlePersonalChat(e1e8b00c42c42532).(msg, size);
3164 break;
3165 case 0xe1af: //FIXME maybe not
3166 handleGameEndedcxx . . $ CyberOroConnection#handleGameEnded(e1e8b00c42c42532).(msg, size);
3167 break;
3168 case 0x4a9c:
3169 handlePlayerDisconnect2cxx . . $ CyberOroConnection#handlePlayerDisconnect2(e1e8b00c42c42532).(msg, size);
3170 break;
3171 case ORO_MATCHOFFERcxx . . $ `src/network/cyberoroprotocol.h:56:9`!:
3172 handleMatchOffercxx . . $ CyberOroConnection#handleMatchOffer(e1e8b00c42c42532).(msg, size);
3173 break;
3174 default:
3175 #ifdef RE_DEBUG
3176 msg -= 4; //FIXME
3177 printf("Two bytestrange: %02x%02x: \n", msg[0], msg[1]);
3178 //#ifdef RE_DEBUG
3179 for(unsigned int i = 2; i < size + 4; i++)
3180 printf("%02x", msg[i]);
3181 printf("\n");
3182 #endif //RE_DEBUG
3183 break;
3184 }
3185 }
3186
3187 /* Last byte is a kind of initialization vector, IV */
3188 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleCodeTablecxx . . $ CyberOroConnection#handleCodeTable(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
3189 {
3190 unsigned char * p = msg;
3191 int i;
3192
3193 if(size != 1002)
3194 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("code table message of size: %d", size);
3195 if(codetablecxx . . $ CyberOroConnection#codetable.)
3196 delete[] codetablecxx . . $ CyberOroConnection#codetable.;
3197 codetablecxx . . $ CyberOroConnection#codetable. = new unsigned char[1000];
3198 for(i = 0; i < 1000; i++)
3199 codetablecxx . . $ CyberOroConnection#codetable.[i] = p[i];
3200 codetable_IVcxx . . $ CyberOroConnection#codetable_IV. = p[1000];
3201 codetable_IV2cxx . . $ CyberOroConnection#codetable_IV2. = 0;
3202
3203 sendChallengeResponsecxx . . $ CyberOroConnection#sendChallengeResponse(49f6e7a06ebc5aa8).();
3204 }
3205
3206 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleConnectedcxx . . $ CyberOroConnection#handleConnected(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
3207 {
3208 unsigned char * p = msg;
3209 if(size != 10)
3210 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("handleConnected size: %d", size);
3211 our_player_idcxx . . $ CyberOroConnection#our_player_id. = p[0] + (p[1] << 8);
3212 #ifdef RE_DEBUG
3213 qDebug("our id: %02x%02x %02x\n", p[0], p[1], p[2]);
3214 #endif //RE_DEBUG
3215 our_special_bytecxx . . $ CyberOroConnection#our_special_byte. = p[2];
3216 p += 6;
3217
3218 onReadycxx . . $ CyberOroConnection#onReady(49f6e7a06ebc5aa8).(); //is this okay?
3219
3220 //try this here
3221 //sendInvitationSettings(true); //for now
3222 // FIXME, toggle is doing this now, but is it kosher with initial state?
3223 // i.e., when we first join what happens? where does that get checked?
3224 }
3225
3226 #ifdef NEWPROTOCOL
3227 /*OROPlayerListPacket::OROPlayerListPacket(char * p)
3228 {
3229 data = p;
3230 }*/
3231
3232 //void * ZeroPaddedString::operator new[] (size_t s) { size = s; };
3233
3234 void CyberOroConnection::handlePlayerList(unsigned char * msg, unsigned int size)
3235 {
3236 unsigned char * p = msg;
3237 unsigned char name[11];
3238 int players;
3239 unsigned char rankbyte, invitebyte;
3240 int i;
3241 unsigned short id;
3242 OROPlayerListPacket packet((char *)msg);
3243 Room * room = getDefaultRoom();
3244 PlayerListing * newPlayer = new PlayerListing();
3245 PlayerListing * aPlayer;
3246 PlayerListing * backPlayer;
3247 newPlayer->online = true;
3248 newPlayer->info = "??";
3249 newPlayer->playing = 0;
3250 newPlayer->observing = 0;
3251 newPlayer->idletime = "-";
3252
3253 players = p[2];
3254
3255 #ifdef RE_DEBUG
3256 printf("%02x%02x\n", p[0], p[1]);
3257 #endif //RE_DEBUG
3258 printf("new players: %d\n", packet.h.playerRecords);
3259 p += 2;
3260 //676c696c696e6e000000 770a 16a4 02c3 0000 9b72 e607 e407 0000 0056
3261 while(p < (msg + size))
3262 {
3263 #ifdef RE_DEBUG
3264 for(i = 0; i < 28; i++)
3265 printf("%02x", p[i]);
3266 printf("\n");
3267 #endif //RE_DEBUG
3268 strncpy((char *)name, (char *)p, 10); name[10] = 0x00;
3269 #ifdef RE_DEBUG
3270 printf("%s ", name);
3271 #endif //RE_DEBUG
3272 p += 10;
3273 id = p[0] + (p[1] << 8);
3274 aPlayer = room->getPlayerListing(id);
3275 if(!aPlayer)
3276 {
3277 aPlayer = newPlayer;
3278 newPlayer->playing = 0;
3279 }
3280 aPlayer->id = id;
3281 if(strncmp((char *)name, "jguest", 6) == 0 || strncmp((char *)name, "jpguest", 7) == 0)
3282 aPlayer->hidden = true;
3283 else
3284 aPlayer->hidden = false;
3285 //aPlayer->name = QString((char*)name);
3286 aPlayer->name = serverCodec->toUnicode((const char *)name, strlen((const char *)name));
3287
3288 p += 2;
3289 //a byte here seems to be a send msg byte, or something
3290 aPlayer->specialbyte = p[0];
3291 //p++;
3292 #ifdef RE_DEBUG
3293 for(i = 0; i < 8; i++)
3294 printf("%02x", p[i]);
3295 #endif //RE_DEBUG
3296 // That's right, its the pro bit
3297 rankbyte = p[1];
3298 if(rankbyte & 0x40)
3299 {
3300 aPlayer->pro = true;
3301 }
3302 else
3303 aPlayer->pro = false;
3304
3305 //lost interest, its not the game
3306 //aPlayer->observing = p[2]; //FIXME, what is this?
3307 //this fourth byte here is country I think.
3308 // but its really unreliable, almost like its something
3309 // that clients from these countries have as a setting
3310 // or maybe part of a bit field.
3311 aPlayer->country = getCountryFromCode(p[3]);
3312 //fifth byte is their open status
3313 invitebyte = p[4];
3314 aPlayer->nmatch_settings = QString::number(p[0]) + QString(" ") + QString::number((p[1])) + QString(" ") + QString::number(p[2]) + QString(" ") + QString::number(p[3]);
3315 p += 6;
3316 aPlayer->rank_score = p[0] + (p[1] << 8);
3317 if(aPlayer->pro)
3318 aPlayer->rank = QString::number(rankbyte & 0x1f) + QString("dp");
3319 else
3320 aPlayer->rank = rating_pointsToRank(aPlayer->rank_score);
3321 aPlayer->info = getStatusFromCode(invitebyte, aPlayer->rank);
3322 aPlayer->wins = p[2] + (p[3] << 8);
3323 aPlayer->losses = p[4] + (p[5] << 8);
3324 p += 6;
3325 #ifdef RE_DEBUG
3326 printf(" RP: %d W/L: %d/%d ", aPlayer->rank_score, aPlayer->wins, aPlayer->losses);
3327 for(i = 0; i < 4; i++)
3328 printf("%02x", p[i]);
3329 printf("\n");
3330 #endif //RE_DEBUG
3331 p += 3;
3332 p++;
3333 room->recvPlayerListing(aPlayer);
3334
3335 playerlist_received++;
3336 if(playerlist_skipnumber != PLAYERLIST_SKIPNUMBER_UNSET
3337 && playerlist_skipnumber < playerlist_received)
3338 {
3339 #ifdef RE_DEBUG
3340 printf("Playerlist received %d skip number %d\n", playerlist_received, playerlist_skipnumber);
3341 #endif //RE_DEBUG
3342 /* get next room with observers */
3343 GameListing * gamelisting = room->getGameListing(playerlist_roomnumber);
3344 if(!gamelisting)
3345 goto label_playerlist_nogame;
3346 if(gamelisting->observers > 0 && playerlist_observernumber == gamelisting->observers)
3347 {
3348 playerlist_observernumber = 0;
3349 gamelisting = room->getGameListing(++playerlist_roomnumber);
3350 if(!gamelisting)
3351 goto label_playerlist_nogame;
3352 }
3353 else if(gamelisting->observers > 0)
3354 {
3355 playerlist_observernumber++;
3356 }
3357 else
3358 {
3359 while(gamelisting->observers == 0)
3360 {
3361 playerlist_roomnumber++;
3362 gamelisting = room->getGameListing(playerlist_roomnumber);
3363 if(!gamelisting)
3364 goto label_playerlist_nogame;
3365 }
3366 }
3367 backPlayer = room->getPlayerListing(aPlayer->id);
3368 if(backPlayer->playing != playerlist_roomnumber)
3369 {
3370 /* add room to player, ORO is one room per player */
3371 backPlayer->observing = playerlist_roomnumber;
3372 /* add player to room */
3373 gamelisting->observer_list.push_back(backPlayer);
3374 #ifdef RE_DEBUG
3375 printf("Adding player %s %d to game %d\n", backPlayer->name.toLatin1().constData(), backPlayer->id, playerlist_roomnumber);
3376 #endif //RE_DEBUG
3377 }
3378 }
3379 label_playerlist_nogame:
3380 /* If the game can't be found it either means that the player is not in a room
3381 * or it means we don't have the room yet because that list hasn't come in.*/
3382
3383 backPlayer = room->getPlayerListing(aPlayer->id);
3384 playerlist_inorder.push_back(backPlayer);
3385 }
3386 delete newPlayer;
3387 #ifdef RE_DEBUG
3388 printf("*** Players %d\n", players);
3389 #endif //RE_DEBUG
3390 }
3391 #endif //NEWPROTOCOL
3392
3393 #ifdef RE_DEBUG
3394 //#define PLAYERLIST_DEBUG
3395 #endif //RE_DEBUG
3396 /* I've finally realized how ORO does this safely. It waits until its received
3397 * everything, before it displays anything. Worries me a bit, the way we do it but...
3398 * we can make it safe... I just wonder if it could be better, especially if it would
3399 * be cleaner to have a "loading" dialog block user input until everything is up */
3400 void CyberOroConnectioncxx . . $ CyberOroConnection#::handlePlayerListcxx . . $ CyberOroConnection#handlePlayerList(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
3401 {
3402 unsigned char * p = msg;
3403 unsigned char name[11];
3404 unsigned char rankbyte, invitebyte;
3405 unsigned short id;
3406 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
3407 PlayerListingcxx . . $ PlayerListing# * aPlayer;
3408
3409 int players = p[2];
3410
3411 p += 2;
3412 //676c696c696e6e000000 770a 16a4 02c3 0000 9b72 e607 e407 0000 0056
3413 while(p < (msg + size))
3414 {
3415 strncpy((char *)name, (char *)p, 10);
3416 name[10] = 0x00;
3417 p += 10;
3418 id = p[0] + (p[1] << 8);
3419 aPlayer = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(id);
3420 if(strncmp((char *)name, "jguest", 6) == 0 || strncmp((char *)name, "jpguest", 7) == 0)
3421 aPlayer->hiddencxx . . $ PlayerListing#hidden. = true;
3422 else
3423 aPlayer->hiddencxx . . $ PlayerListing#hidden. = false;
3424 aPlayer->namecxx . . $ PlayerListing#name. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). serverCodeccxx . . $ CyberOroConnection#serverCodec.->toUnicodecxx . . $ QTextCodec#toUnicode(22771b2711c76a3b).((const char *)name, strlen((const char *)name));
3425
3426 p += 2;
3427 //a byte here seems to be a send msg byte, or something
3428 aPlayer->specialbytecxx . . $ PlayerListing#specialbyte. = p[0];
3429 // That's right, its the pro bit
3430 rankbyte = p[1];
3431 aPlayer->procxx . . $ PlayerListing#pro. = bool(rankbyte & 0x40);
3432
3433 //lost interest, its not the game
3434 //aPlayer->observing = p[2]; //FIXME, what is this?
3435 //this fourth byte here is country I think.
3436 // but its really unreliable, almost like its something
3437 // that clients from these countries have as a setting
3438 // or maybe part of a bit field.
3439 aPlayer->countrycxx . . $ PlayerListing#country. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). getCountryFromCodecxx . . $ CyberOroConnection#getCountryFromCode(e76153c3c184c917).(p[3]);
3440 //fifth byte is their open status
3441 invitebyte = p[4];
3442 aPlayer->nmatch_settingscxx . . $ PlayerListing#nmatch_settings. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(p[0]) +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(85c52e162fed56f9).(" ") +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).((p[1])) +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(85c52e162fed56f9).(" ") +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(p[2]) +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(85c52e162fed56f9).(" ") +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(p[3]);
3443 p += 6;
3444 aPlayer->rank_scorecxx . . $ PlayerListing#rank_score. = p[0] + (p[1] << 8);
3445 if(aPlayer->procxx . . $ PlayerListing#pro.)
3446 aPlayer->rankcxx . . $ PlayerListing#rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(rankbyte & 0x1f) +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(85c52e162fed56f9).("dp");
3447 else
3448 aPlayer->rankcxx . . $ PlayerListing#rank. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). rating_pointsToRankcxx . . $ CyberOroConnection#rating_pointsToRank(538777a873a4ab5d).(aPlayer->rank_scorecxx . . $ PlayerListing#rank_score.);
3449 aPlayer->infocxx . . $ PlayerListing#info. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). getStatusFromCodecxx . . $ CyberOroConnection#getStatusFromCode(31cb2f216a834e82).(invitebyte, aPlayercxx . . $ QString#QString(132dd6869045752b).->rankcxx . . $ PlayerListing#rank.);
3450 aPlayer->winscxx . . $ PlayerListing#wins. = p[2] + (p[3] << 8);
3451 aPlayer->lossescxx . . $ PlayerListing#losses. = p[4] + (p[5] << 8);
3452 p += 6;
3453 p += 3;
3454 p++;
3455 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! playerListingReceivedcxx . . $ NetworkConnection#playerListingReceived(122195e397f39e1b).(aPlayer);
3456 }
3457 }
3458
3459 QStringcxx . . $ QString# CyberOroConnectioncxx . . $ CyberOroConnection#::rating_pointsToRankcxx . . $ CyberOroConnection#rating_pointsToRank(538777a873a4ab5d).(unsigned int rp)
3460 {
3461 int rem = rp % 1000;
3462 rp -= rem;
3463 rp /= 1000;
3464 if(rp < 26)
3465 {
3466 rp = 26 - rp;
3467 return QStringcxx . . $ QString#::numbercxx . . $ QString#number(da83c6b4fd8c0e98).(rp) +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(85c52e162fed56f9).("k");
3468 }
3469 else
3470 {
3471 rp -= 25;
3472 return QStringcxx . . $ QString#::numbercxx . . $ QString#number(da83c6b4fd8c0e98).(rp) +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(85c52e162fed56f9).("d");
3473 }
3474 return QStringcxx . . $ QString#QString(85c52e162fed56f9).("?");
3475 }
3476
3477 unsigned int CyberOroConnectioncxx . . $ CyberOroConnection#::rankToScorecxx . . $ CyberOroConnection#rankToScore(9d92bb507a34628c).(QStringcxx . . $ QString# rank)
3478 {
3479 QStringcxx . . $ QString# buffer = rankcxx . . $ QString#QString(132dd6869045752b).;
3480 //buffer.replace(QRegExp("[pdk+?\\*\\s]"), "");
3481 buffer.replacecxx . . $ QString#replace(612862c8abff0ba5).(QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("[pdk]"cxx . . $ QString#QString(85c52e162fed56f9).), ""cxx . . $ QString#QString(85c52e162fed56f9).);
3482 int ordinal = buffer.toIntcxx . . $ QString#toInt(d7972accae11ee1f).();
3483 unsigned int rp;
3484
3485 if(rank.containscxx . . $ QString#contains(8cce4688c16f48f3).("k"cxx . . $ QString#QString(85c52e162fed56f9).))
3486 rp = (26 - ordinal) * 1000;
3487 else if(rank.containscxx . . $ QString#contains(8cce4688c16f48f3).("d"cxx . . $ QString#QString(85c52e162fed56f9).))
3488 rp = 25000 + (ordinal * 1000);
3489 else if(rank.containscxx . . $ QString#contains(8cce4688c16f48f3).("p"cxx . . $ QString#QString(85c52e162fed56f9).))
3490 rp = 36000 + (ordinal * 1000);
3491 else
3492 return 0;
3493
3494 return rp;
3495 }
3496
3497 /* FIXME What are the other bits for ?!?!?!*/
3498 QStringcxx . . $ QString# CyberOroConnectioncxx . . $ CyberOroConnection#::getCountryFromCodecxx . . $ CyberOroConnection#getCountryFromCode(e76153c3c184c917).(unsigned char code)
3499 {
3500 code &= 0x0f;
3501 switch(code)
3502 {
3503 case 1:
3504 return "KOREA"cxx . . $ QString#QString(85c52e162fed56f9).;
3505 break;
3506 case 2:
3507 return "CHINA"cxx . . $ QString#QString(85c52e162fed56f9).;
3508 break;
3509 case 3:
3510 return "JAPAN"cxx . . $ QString#QString(85c52e162fed56f9).;
3511 break;
3512 case 4:
3513 return "INTL"cxx . . $ QString#QString(85c52e162fed56f9).;
3514 break;
3515 case 5:
3516 return "THAILAND"cxx . . $ QString#QString(85c52e162fed56f9).;
3517 break;
3518 case 6:
3519 //that blue flag...
3520 return "UN?"cxx . . $ QString#QString(85c52e162fed56f9).;
3521 break;
3522 case 7:
3523 return "USA"cxx . . $ QString#QString(85c52e162fed56f9).;
3524 break;
3525 case 8:
3526 return "HONGKONG"cxx . . $ QString#QString(85c52e162fed56f9).;
3527 break;
3528 case 9:
3529 return "SINGAPORE"cxx . . $ QString#QString(85c52e162fed56f9).;
3530 break;
3531 case 0xa:
3532 return "CANADA"cxx . . $ QString#QString(85c52e162fed56f9).;
3533 break;
3534 case 0xb:
3535 return "GERMANY"cxx . . $ QString#QString(85c52e162fed56f9).;
3536 break;
3537 case 0xc:
3538 return "FRANCE"cxx . . $ QString#QString(85c52e162fed56f9).;
3539 break;
3540 case 0xd:
3541 return "AUSTRALIA"cxx . . $ QString#QString(85c52e162fed56f9).;
3542 break;
3543 case 0xe:
3544 return "RUSSIA"cxx . . $ QString#QString(85c52e162fed56f9).;
3545 break;
3546 case 0xf:
3547 return "UKRAINE"cxx . . $ QString#QString(85c52e162fed56f9).;
3548 break;
3549 }
3550 return QStringcxx . . $ QString#QString(85c52e162fed56f9).("-");
3551 }
3552
3553 //c661
3554 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleRoomListcxx . . $ CyberOroConnection#handleRoomList(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
3555 {
3556 unsigned char * p = msg;
3557 unsigned int number_of_games;
3558 unsigned short number;
3559 unsigned int i;
3560 PlayerListingcxx . . $ PlayerListing# * player;
3561 GameListingcxx . . $ GameListing# * aGameListing;
3562 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
3563 bool be_adding_observers;
3564
3565 if(playerlist_skipnumbercxx . . $ CyberOroConnection#playerlist_skipnumber. != PLAYERLIST_SKIPNUMBER_UNSETcxx . . $ `src/network/cyberoroconnection.cpp:56:9`! &&
3566 roomlist_observerscxx . . $ CyberOroConnection#roomlist_observers. < playerlist_receivedcxx . . $ CyberOroConnection#playerlist_received.)
3567 be_adding_observers = true;
3568 else
3569 be_adding_observers = false;
3570
3571 number_of_games = p[0] + (p[1] << 8);
3572 p += 4;
3573 #ifdef RE_DEBUG
3574 printf("c661 Number of games in this list: %d\n", number_of_games);
3575 printf("roomlist_observers %d versus %d\n", roomlist_observers, playerlist_received);
3576 #endif //RE_DEBUG
3577 // 4, 4 for one player, 4 for the second player, another 4
3578 while(number_of_games--)
3579 {
3580 number = p[0] + (p[1] << 8);
3581 if(number == 0)
3582 {
3583 /* There's no 0th record except maybe total number of
3584 * games and those 01 tagged records are weird, like
3585 * their either empty or they're for particular
3586 * players... they might be player stats but they
3587 * don't show up in official ORO app so who knows.*/
3588 /* FIXME, these are probably important and I just
3589 * have no idea. */
3590 unsigned char * q = p;
3591 #ifdef RE_DEBUG
3592 printf("0record:\n"); //unnecessary even for debug
3593 #endif //RE_DEBUG
3594 /* I think the third and fourth bytes here are
3595 * the number of players not in rooms, or to
3596 * skip from player lists before adding players
3597 * to games */
3598 playerlist_skipnumbercxx . . $ CyberOroConnection#playerlist_skipnumber. = p[2] + (p[3] << 8);
3599 if(playerlist_receivedcxx . . $ CyberOroConnection#playerlist_received. >= playerlist_skipnumbercxx . . $ CyberOroConnection#playerlist_skipnumber.)
3600 be_adding_observers = true;
3601 for(i = 0; i < 4; i++)
3602 {
3603 #ifdef RE_DEBUG
3604 printf("%02x%02x%02x%02x ", q[0], q[1], q[2], q[3]);
3605 #endif //RE_DEBUG
3606 q += 4;
3607 }
3608 #ifdef RE_DEBUG
3609 printf("\n");
3610 #endif //RE_DEBUG
3611 p += 16;
3612 continue;
3613 }
3614 aGameListing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(number);
3615 aGameListing->runningcxx . . $ GameListing#running. = true;
3616 unsigned char * q = p;
3617 for(i = 0; i < 4; i++)
3618 {
3619 #ifdef RE_DEBUG
3620 printf("%02x%02x%02x%02x ", q[0], q[1], q[2], q[3]);
3621 #endif //RE_DEBUG
3622 q += 4;
3623 }
3624 #ifdef RE_DEBUG
3625 printf("\n");
3626 #endif //RE_DEBUG
3627 if(p[4] & 0x70)
3628 aGameListing->isLockedcxx . . $ GameListing#isLocked. = true; //I don't think this is always the case
3629 //p[4] & 0x70 = locked game password
3630 /*
3631 3c review game records 7d replay
3632 16 waiting for pair match team even + stronger
3633 2a even pair game ongoing with p[5] == c0
3634 02 bit could be pair game, but which, even or stronger?
3635 */
3636 /* I think phase is or can be unreliable for broadcast
3637 * games, maybe others */
3638 /*FIXME, setting observers here skews setAttached*/
3639 aGameListing->observerscxx . . $ GameListing#observers. = p[2];
3640 int phase = getPhasecxx . . $ CyberOroConnection#getPhase(b27dbea426b7b93).(p[6]);
3641 if(phase != -1)
3642 aGameListing->movescxx . . $ GameListing#moves. = phase;
3643 else
3644 aGameListing->movescxx . . $ GameListing#moves. = 0;
3645 aGameListing->owner_idcxx . . $ GameListing#owner_id. = p[8] + (p[9] << 8);
3646 if(!aGameListing->whitecxx . . $ GameListing#white.)
3647 {
3648 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(aGameListing->owner_idcxx . . $ GameListing#owner_id.);
3649 aGameListing->whitecxx . . $ GameListing#white. = player;
3650 }
3651 else
3652 player = 0;
3653 /* These are really like room owners */
3654 if(!aGameListing->blackcxx . . $ GameListing#black.)
3655 {
3656 //new sets this to 0
3657 //FIXME so why even have a conditional here?
3658 //also does this get unset if its found to
3659 //be a game later?
3660 aGameListing->_black_namecxx . . $ GameListing#_black_name. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). getRoomTagcxx . . $ CyberOroConnection#getRoomTag(e76153c3c184c917).(p[4]);
3661 aGameListing->isRoomOnlycxx . . $ GameListing#isRoomOnly. = true;
3662 }
3663 else
3664 aGameListing->FRcxx . . $ GameListing#FR. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). getRoomTagcxx . . $ CyberOroConnection#getRoomTag(e76153c3c184c917).(p[4]);
3665
3666 room->recvGameListingcxx . . $ Room#recvGameListing(9a447f3b9a8a5041).(aGameListing);
3667 aGameListing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(aGameListing->numbercxx . . $ GameListing#number.);
3668 aGameListing->observer_listcxx . . $ GameListing#observer_list..clearcxx . . $ std/vector#clear(ced63f7c635d850d).();
3669
3670 if(player)
3671 {
3672 //after recv
3673 //FIXME
3674 setAttachedGamecxx . . $ CyberOroConnection#setAttachedGame(b9f1593580940ebc).(player, aGameListing->numbercxx . . $ GameListing#number.);
3675 }
3676 p += 16;
3677 #ifdef RE_DEBUG
3678 printf("Observers: %d\n", aGameListing->observers);
3679 #endif //RE_DEBUG
3680 /* Because player and room listing messages apparently
3681 * come in any order, probably because there's some
3682 * underlying MS database that spits all this stuff out
3683 * from separate places, even separate servers... : */
3684 if(be_adding_observers)
3685 {
3686 for(i = 0; i < aGameListing->observerscxx . . $ GameListing#observers.; i++)
3687 {
3688 if(roomlist_observerscxx . . $ CyberOroConnection#roomlist_observers. + playerlist_skipnumbercxx . . $ CyberOroConnection#playerlist_skipnumber. < playerlist_inordercxx . . $ CyberOroConnection#playerlist_inorder..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).())
3689 {
3690 player = playerlist_inordercxx . . $ CyberOroConnection#playerlist_inorder.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).roomlist_observerscxx . . $ CyberOroConnection#roomlist_observers. + playerlist_skipnumbercxx . . $ CyberOroConnection#playerlist_skipnumber.];
3691 if(player->playingcxx . . $ PlayerListing#playing. != number)
3692 {
3693 /* add room to player, ORO is one room per player */
3694 player->observingcxx . . $ PlayerListing#observing. = number;
3695 /* add player to room */
3696 aGameListing->observer_listcxx . . $ GameListing#observer_list..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(player);
3697 #ifdef RE_DEBUG
3698 printf("Adding player %s %d to game %d\n", player->name.toLatin1().constData(), player->id, number);
3699 #endif //RE_DEBUG
3700 }
3701 playerlist_observernumbercxx . . $ CyberOroConnection#playerlist_observernumber.++;
3702 if(playerlist_observernumbercxx . . $ CyberOroConnection#playerlist_observernumber. == aGameListing->observerscxx . . $ GameListing#observers.)
3703 {
3704 playerlist_observernumbercxx . . $ CyberOroConnection#playerlist_observernumber. = 0;
3705 playerlist_roomnumbercxx . . $ CyberOroConnection#playerlist_roomnumber. = number + 1; //at least
3706 }
3707 }
3708 roomlist_observerscxx . . $ CyberOroConnection#roomlist_observers.++;
3709 }
3710 }
3711 else
3712 roomlist_observerscxx . . $ CyberOroConnection#roomlist_observers. += aGameListing->observerscxx . . $ GameListing#observers.;
3713 }
3714 if(p != msg + size)
3715 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("handleRoomList: doesn't match size %d", size);
3716 //FIXME try without
3717 }
3718
3719 /* We might FIXME replace the return on this with a QString
3720 * when we alter the list view to handle different columns.
3721 * But for now, moves is pretty accurate for the field */
3722 int CyberOroConnectioncxx . . $ CyberOroConnection#::getPhasecxx . . $ CyberOroConnection#getPhase(b27dbea426b7b93).(unsigned char byte)
3723 {
3724 switch(byte)
3725 {
3726 case 0:
3727 return 0;
3728 //open
3729 break;
3730 case 1:
3731 return 30;
3732 //early
3733 break;
3734 case 2:
3735 return 50;
3736 //middle
3737 break;
3738 case 3:
3739 return 130;
3740 //end
3741 break;
3742 case 11:
3743 //looks like wished opponent
3744 default:
3745 return -1;
3746 break;
3747 }
3748 }
3749
3750 QStringcxx . . $ QString# CyberOroConnectioncxx . . $ CyberOroConnection#::getRoomTagcxx . . $ CyberOroConnection#getRoomTag(e76153c3c184c917).(unsigned char byte)
3751 {
3752 switch(byte)
3753 {
3754 case 0x1f:
3755 case 0x3d:
3756 //normal and broadcast in progress
3757 return QStringcxx . . $ QString#QString(ced63f7c635d850d).();
3758 break;
3759 case 0x04:
3760 return QStringcxx . . $ QString#QString(85c52e162fed56f9).("** chat 04");
3761 break;
3762 case 0x1a:
3763 return QStringcxx . . $ QString#QString(85c52e162fed56f9).("** chat 1a");
3764 break;
3765 case 0x70:
3766 //likely chat 0 locked?
3767 return QStringcxx . . $ QString#QString(85c52e162fed56f9).("** chat 70");
3768 break;
3769 case 0x3c:
3770 return QStringcxx . . $ QString#QString(85c52e162fed56f9).("** review 3c");
3771 break;
3772 case 0x19:
3773 return QStringcxx . . $ QString#QString(85c52e162fed56f9).("** chat 19");
3774 break;
3775 case 0x1c:
3776 return QStringcxx . . $ QString#QString(85c52e162fed56f9).("** quit? 19");
3777 break;
3778 case 0x0b:
3779 return QStringcxx . . $ QString#QString(85c52e162fed56f9).("** wished 0b");
3780 break;
3781 case 0x0f:
3782 return QStringcxx . . $ QString#QString(85c52e162fed56f9).("** one color 0f");
3783 break;
3784 default:
3785 return (QStringcxx . . $ QString#QString(85c52e162fed56f9).("** ") +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(byte, 16));
3786 break;
3787 }
3788 }
3789
3790 //f861 These are broadcasted games I think. They're not players on the service
3791 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleBroadcastGamesListcxx . . $ CyberOroConnection#handleBroadcastGamesList(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
3792 {
3793 unsigned char * p = msg;
3794 unsigned char * game_record;
3795 unsigned int number_of_games;
3796 int number;
3797 unsigned char name[11];
3798 name[10] = 0x00;
3799 #ifdef RE_DEBUG
3800 unsigned int i;
3801 #endif //RE_DEBUG
3802
3803 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
3804 GameListingcxx . . $ GameListing# * aGameListing;
3805
3806 number_of_games = p[0] + (p[1] << 8);
3807 p += 2;
3808 #ifdef RE_DEBUG
3809 printf("Number of games: %d\n", number_of_games);
3810 #endif //RE_DEBUG
3811 while(number_of_games--)
3812 {
3813 game_record = p;
3814 number = p[0] + (p[1] << 8);
3815 aGameListing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(number);
3816 aGameListing->runningcxx . . $ GameListing#running. = true;
3817 p += 2;
3818 aGameListing->game_codecxx . . $ GameListing#game_code. = game_record[2] + (game_record[3] << 8);
3819 p += 2;
3820 strncpy((char *)name, (char *)&(game_record[4]), 10);
3821 aGameListing->blackcxx . . $ GameListing#black. = 0;
3822 //aGameListing->_black_name = QString((char *)name);
3823 aGameListing->_black_namecxx . . $ GameListing#_black_name. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). serverCodeccxx . . $ CyberOroConnection#serverCodec.->toUnicodecxx . . $ QTextCodec#toUnicode(22771b2711c76a3b).((const char *)name, strlen((const char *)name));
3824 p += 10;
3825 strncpy((char *)name, (char *)&(game_record[14]), 10);
3826 aGameListing->whitecxx . . $ GameListing#white. = 0;
3827 //aGameListing->_white_name = QString((char *)name);
3828 aGameListing->_white_namecxx . . $ GameListing#_white_name. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). serverCodeccxx . . $ CyberOroConnection#serverCodec.->toUnicodecxx . . $ QTextCodec#toUnicode(22771b2711c76a3b).((const char *)name, strlen((const char *)name));
3829
3830 p += 10;
3831 #ifdef RE_DEBUG
3832 printf("br %02x wr %02x\n", p[0], p[1]);
3833 #endif //RE_DEBUG
3834 if((game_record[24] & 0xC0) == 0xC0)
3835 {
3836 aGameListing->_black_rankcxx . . $ GameListing#_black_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(game_record[24] & 0x0f) +cxx . . $ operator+(3d22f08efddf8107). "p";
3837 aGameListing->_black_rank_scorecxx . . $ GameListing#_black_rank_score. = 34000 + ((game_record[24] & 0x0f) * 1000);
3838 }
3839 else if((game_record[24] & 0xA0) == 0xA0)
3840 {
3841 aGameListing->_black_rankcxx . . $ GameListing#_black_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(game_record[24] & 0x0f) +cxx . . $ operator+(3d22f08efddf8107). "d";
3842 aGameListing->_black_rank_scorecxx . . $ GameListing#_black_rank_score. = 25000 + ((game_record[24] & 0x0f) * 1000);
3843 }
3844 if((game_record[25] & 0xC0) == 0xC0)
3845 {
3846 aGameListing->_white_rankcxx . . $ GameListing#_white_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(game_record[25] & 0x0f) +cxx . . $ operator+(3d22f08efddf8107). "p";
3847 aGameListing->_white_rank_scorecxx . . $ GameListing#_white_rank_score. = 34000 + ((game_record[25] & 0x0f) * 1000);
3848 }
3849 else if((game_record[25] & 0xA0) == 0xA0)
3850 {
3851 aGameListing->_white_rankcxx . . $ GameListing#_white_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(game_record[25] & 0x0f) +cxx . . $ operator+(3d22f08efddf8107). "d";
3852 aGameListing->_white_rank_scorecxx . . $ GameListing#_white_rank_score. = 25000 + ((game_record[25] & 0x0f) * 1000);
3853 }
3854 p += 2;
3855 /* The next two bytes are the country codes for each player,
3856 * but I'm not sure where to display them. FIXME */
3857 /* [K] [C] [J], let's not kid ourself about the pro game countries */
3858 QStringcxx . . $ QString# country = getCountryFromCodecxx . . $ CyberOroConnection#getCountryFromCode(e76153c3c184c917).(game_record[27]);
3859 aGameListing->_black_namecxx . . $ GameListing#_black_name. +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). ("["cxx . . $ QString#QString(85c52e162fed56f9). +cxx . . $ operator+(eab1ea5b6c36e9b2). country[cxx . . $ QString#`operator[]`(57436120916eb52c).0] +cxx . . $ operator+(3d22f08efddf8107). "]");
3860 country =cxx . . $ QString#`operator=`(4f35bf974e7f8568). getCountryFromCodecxx . . $ CyberOroConnection#getCountryFromCode(e76153c3c184c917).(p[1]);
3861 aGameListing->_white_namecxx . . $ GameListing#_white_name. +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). ("["cxx . . $ QString#QString(85c52e162fed56f9). +cxx . . $ operator+(eab1ea5b6c36e9b2). country[cxx . . $ QString#`operator[]`(57436120916eb52c).0] +cxx . . $ operator+(3d22f08efddf8107). "]");
3862 p += 2;
3863
3864 #ifdef RE_DEBUG
3865 printf("broadcast %d: ", aGameListing->number);
3866 for(i = 0; i < 48; i++)
3867 printf("%02x", (p - 28)[i]);
3868 printf("\n");
3869 #endif //RE_DEBUG
3870 aGameListing->game_codecxx . . $ GameListing#game_code. = aGameListing->numbercxx . . $ GameListing#number.; //just for these broadcasts
3871
3872 /* Looks like if the last two 4 bytes are 0xf190 ed00, then
3873 * its game-over */
3874 p += 28;
3875 /* This seems to be wrong */
3876 if(p[0] == 0xf1 && p[1] == 0x90 && p[2] == 0xed && p[3] == 0x00)
3877 {
3878 aGameListing->FRcxx . . $ GameListing#FR. =cxx . . $ QString#`operator=`(d02845eef0c33901). "Ended";
3879 //also, use moves = -1 I think FIXME
3880 }
3881 //aGameListing->FR = QString::number(p[0], 16) + QString::number(p[1], 16) + QString::number(p[2], 16) + QString::number(p[3], 16);
3882 p += 4;
3883 aGameListing->isRoomOnlycxx . . $ GameListing#isRoomOnly. = false;
3884 aGameListing->isBroadcastcxx . . $ GameListing#isBroadcast. = true;
3885 //to prevent broadcast games from closing FIXME
3886 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! gameListingReceivedcxx . . $ NetworkConnection#gameListingReceived(9a447f3b9a8a5041).(aGameListing);
3887 }
3888 if(p != (msg + size))
3889 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("bad p: line: %d", __LINE__);
3890 }
3891
3892 /* Turns out, in this initial, game joining list, its possible to get ids
3893 * from players we haven't received yet. So we need to, either postpone
3894 * posting the list or... something... until we get the full
3895 * player list. If this is only a problem initially... and I think
3896 * that is generally the case... but... I have to think about how
3897 * to handle this. (maybe if we knew total number of players?) FIXME FIXME*/
3898 //da61
3899 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleGamesListcxx . . $ CyberOroConnection#handleGamesList(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
3900 {
3901 unsigned char * p = msg;
3902 unsigned int number_of_games;
3903 unsigned int id;
3904 #ifdef RE_DEBUG
3905 unsigned int i;
3906 #endif //RE_DEBUG
3907
3908 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
3909 PlayerListingcxx . . $ PlayerListing# * white, * black;
3910 GameListingcxx . . $ GameListing# * aGameListing;
3911 int number;
3912
3913 /* Looks like the [] QList index error might be coming from this
3914 * and its fatal!!! so watch out... probably number of games is
3915 * wrong. We need to differentiate the different game list msg
3916 * types
3917 * Its like the second time we have to use the temp trick, it
3918 * bugs out... maybe the reference doesn't actually change...*/
3919 number_of_games = p[0] + (p[1] << 8);
3920 p += 2;
3921 /*printf("Number of games: %d\n", number_of_games);
3922 for(i = 0; i < size; i++)
3923 printf("%02x", msg[i]);
3924 printf("\n");
3925 return;*/
3926
3927 while(number_of_games-- && p < (msg + size - 9)) //check probably unnecessary FIXME
3928 {
3929 number = p[0] + (p[1] << 8);
3930 aGameListing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(number);
3931 aGameListing->runningcxx . . $ GameListing#running. = true;
3932 p += 2;
3933 #ifdef RE_DEBUG
3934 printf("da61: %d %02x%02x\n", aGameListing->number, p[0], p[1]);
3935 for(i = 0; i < 8; i++)
3936 printf(" %02x", p[i]);
3937 printf("\n");
3938 #endif //RE_DEBUG
3939 p += 2;
3940 aGameListing->game_codecxx . . $ GameListing#game_code. = p[0] + (p[1] << 8);
3941 game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).aGameListing->game_codecxx . . $ GameListing#game_code.] = aGameListing->numbercxx . . $ GameListing#number.; //weird?
3942 p += 2;
3943
3944 id = p[0] + (p[1] << 8);
3945 black = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(id);
3946 aGameListing->blackcxx . . $ GameListing#black. = black;
3947
3948 p += 2;
3949 id = p[0] + (p[1] << 8);
3950 white = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(id);
3951 aGameListing->whitecxx . . $ GameListing#white. = white;
3952
3953 p += 2;
3954 #ifdef RE_DEBUG
3955 if(white && black)
3956 printf("Adding listing for %s vs %s\n",
3957 white->name.toLatin1().constData(),
3958 black->name.toLatin1().constData());
3959 #endif //RE_DEBUG
3960 aGameListing->isRoomOnlycxx . . $ GameListing#isRoomOnly. = false;
3961 //aGameListing->observers = 2; //the players
3962 room->recvGameListingcxx . . $ Room#recvGameListing(9a447f3b9a8a5041).(aGameListing);
3963 //after recv
3964 #ifdef FIXME //maybe we need this here?!?
3965 owner = room->getPlayerListing(aGameListing->owner_id);
3966 if(owner != black)
3967 setAttachedGame(black, aGameListing->number);
3968 if(owner != white)
3969 setAttachedGame(white, aGameListing->number);
3970 //detach owner if any, players are attached alread
3971 if(owner && owner != black && owner != white)
3972 setAttachedGame(owner, 0);
3973 #endif //FIXME
3974 setAttachedGamecxx . . $ CyberOroConnection#setAttachedGame(b9f1593580940ebc).(black, aGameListing->numbercxx . . $ GameListing#number.);
3975 setAttachedGamecxx . . $ CyberOroConnection#setAttachedGame(b9f1593580940ebc).(white, aGameListing->numbercxx . . $ GameListing#number.);
3976 }
3977 if(p != (msg + size))
3978 printf("gameslist3 error: %d %ld\n", size, p - msg);
3979 }
3980
3981 //0456
3982 void CyberOroConnectioncxx . . $ CyberOroConnection#::handlePlayerConnectcxx . . $ CyberOroConnection#handlePlayerConnect(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
3983 {
3984 unsigned char * p = msg;
3985 unsigned char name[11];
3986 name[10] = 0x00;
3987 unsigned char name2[11];
3988 name2[10] = 0x00;
3989 unsigned char rankbyte;
3990 unsigned short id;
3991 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
3992 PlayerListingcxx . . $ PlayerListing# * aPlayer;
3993
3994 if(size != 42)
3995 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("handlePlayerConnect of size: %d\n", size);
3996 strncpy((char *)name, (char *)p, 10);
3997 #ifdef RE_DEBUG
3998 printf("0456 %s connected, ", name);
3999 #endif //RE_DEBUG
4000
4001 p += 10;
4002 strncpy((char *)name2, (char *)p, 10);
4003 #ifdef RE_DEBUG
4004 printf("or player %s, ", name2);
4005 #endif //RE_DEBUG
4006
4007
4008 p += 10; //name again;
4009 #ifdef RE_DEBUG
4010 printf("id: %02x%02x\n", p[0], p[1]);
4011 #endif //RE_DEBUG
4012 id = p[0] + (p[1] << 8);
4013 aPlayer = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(id);
4014 aPlayer->idcxx . . $ PlayerListing#id. = id;
4015 //aPlayer->name = (char *)name;
4016 if(strncmp((char *)name, "jguest", 6) == 0 || strncmp((char *)name, "jpguest", 7) == 0)
4017 aPlayer->hiddencxx . . $ PlayerListing#hidden. = true;
4018 else
4019 aPlayer->hiddencxx . . $ PlayerListing#hidden. = false;
4020 aPlayer->namecxx . . $ PlayerListing#name. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). serverCodeccxx . . $ CyberOroConnection#serverCodec.->toUnicodecxx . . $ QTextCodec#toUnicode(22771b2711c76a3b).((const char *)name2, strlen((const char *)name2));
4021 aPlayer->notnicknamecxx . . $ PlayerListing#notnickname. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). serverCodeccxx . . $ CyberOroConnection#serverCodec.->toUnicodecxx . . $ QTextCodec#toUnicode(22771b2711c76a3b).((const char *)name, strlen((const char *)name));
4022 /* It actually looks like this catches more unicode foreign names, then the
4023 * second name. But I get the feeling that one is the text username or
4024 * something... not sure */
4025 /* Yeah, FIXME, the first name appears to allow asian characters, the second is just
4026 * username. We might want an option to turn them on and off */
4027 //aPlayer->name = (char *)name2;
4028 //aPlayer->name = serverCodec->toUnicode((const char *)name2, strlen((const char *)name2));
4029
4030 /* I think we want to take the first name if we take the second
4031 * here, I think the second is allowed to be unicode or something...
4032 * done FIXME, still not sure of this, we should
4033 * really just add unicode support !!!*/
4034
4035
4036 // are you my special msg byte??? FIXME
4037 p += 2;
4038 aPlayer->specialbytecxx . . $ PlayerListing#specialbyte. = p[0];
4039 p++;
4040 rankbyte = p[0];
4041 if(rankbyte & 0x40)
4042 aPlayer->procxx . . $ PlayerListing#pro. = true;
4043 p++;
4044 aPlayer->winscxx . . $ PlayerListing#wins. = p[0] + (p[1] << 8);
4045 aPlayer->lossescxx . . $ PlayerListing#losses. = p[2] + (p[3] << 8);
4046 p += 4;
4047 p += 4;
4048 aPlayer->rank_scorecxx . . $ PlayerListing#rank_score. = p[0] + (p[1] << 8);
4049 if(aPlayer->procxx . . $ PlayerListing#pro.)
4050 aPlayer->rankcxx . . $ PlayerListing#rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(rankbyte & 0x1f) +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(85c52e162fed56f9).("dp");
4051 else
4052 aPlayer->rankcxx . . $ PlayerListing#rank. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). rating_pointsToRankcxx . . $ CyberOroConnection#rating_pointsToRank(538777a873a4ab5d).(aPlayer->rank_scorecxx . . $ PlayerListing#rank_score.);
4053 #ifdef RE_DEBUG
4054 printf(" RP: %d W/L: %d/%d ", aPlayer->rank_score, aPlayer->wins, aPlayer->losses);
4055 #endif //RE_DEBUG
4056 p += 2;
4057 #ifdef RE_DEBUG
4058 for(int i = 0; i < 8; i++)
4059 printf("%02x", p[i]);
4060 printf("\n");
4061 #endif //RE_DEBUG
4062 aPlayer->countrycxx . . $ PlayerListing#country. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). getCountryFromCodecxx . . $ CyberOroConnection#getCountryFromCode(e76153c3c184c917).(p[2]);
4063 aPlayer->infocxx . . $ PlayerListing#info. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). getStatusFromCodecxx . . $ CyberOroConnection#getStatusFromCode(31cb2f216a834e82).(p[3], aPlayercxx . . $ QString#QString(132dd6869045752b).->rankcxx . . $ PlayerListing#rank.);
4064 aPlayer->nmatch_settingscxx . . $ PlayerListing#nmatch_settings. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). QStringcxx . . $ QString#QString(85c52e162fed56f9).("-") +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(msg[23]) +cxx . . $ operator+(3d22f08efddf8107). " " +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(p[0]) +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(85c52e162fed56f9).(" ") +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).((p[1])) +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(85c52e162fed56f9).(" ") +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(p[2]) +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(85c52e162fed56f9).(" ") +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(p[3]) +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(p[4]) +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(85c52e162fed56f9).(" ") +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).((p[5])) +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(85c52e162fed56f9).(" ") +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(p[6]) +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(85c52e162fed56f9).(" ") +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(p[7]);
4065 p += 8; //other data;
4066 aPlayer->observingcxx . . $ PlayerListing#observing. = 0; //necessary?
4067 //aPlayer->playing = 0; //necessary?
4068 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! playerListingReceivedcxx . . $ NetworkConnection#playerListingReceived(122195e397f39e1b).(aPlayer);
4069 }
4070
4071 /* This is necessary as a safety precaution. Maybe if we were sure
4072 * about all aspects of protocol, but for now, let's prevent the
4073 * crashes. */
4074 /* Starting to think that we shouldn't modify observers here.
4075 * entering should be enough. That and the listing on connect */
4076 /* CyberORO does have multi 1:N games which means that there's possibly
4077 * some issues where there might be a player attached to multiple games */
4078 /* Also, FIXME, there's no real need for an observing and a playing with ORO,
4079 * we should just use observing to determine what room they're in. Its confusing
4080 * otherwise. Although I guess "playing" can be used to mean their name is in the
4081 * listing. All of these places where we close empty rooms need to be brought
4082 * together FIXME*/
4083 void CyberOroConnectioncxx . . $ CyberOroConnection#::setAttachedGamecxx . . $ CyberOroConnection#setAttachedGame(b9f1593580940ebc).(PlayerListingcxx . . $ PlayerListing# * const player, unsigned short game_id)
4084 {
4085 GameListingcxx . . $ GameListing# * game;
4086 if(player->playingcxx . . $ PlayerListing#playing. && player->playingcxx . . $ PlayerListing#playing. != game_id)
4087 {
4088 game = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(player->playingcxx . . $ PlayerListing#playing.);
4089 /* This is silly, unless its a chat room, its still the same game,
4090 * we shouldn't remove the players */
4091 if(game->whitecxx . . $ GameListing#white. == player)
4092 {
4093 game->_white_namecxx . . $ GameListing#_white_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). game->whitecxx . . $ GameListing#white.->namecxx . . $ PlayerListing#name.;
4094 game->_white_rankcxx . . $ GameListing#_white_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). game->whitecxx . . $ GameListing#white.->rankcxx . . $ PlayerListing#rank.;
4095 game->whitecxx . . $ GameListing#white. = 0;
4096 #ifdef FIXME //chat only
4097 if(game->black)
4098 {
4099 /* This is so the name is always
4100 * in the same column */
4101 game->white = game->black;
4102 game->black = 0;
4103 }
4104 else
4105 {
4106 if(game->observer_list.size())
4107 {
4108 game->white = game->observer_list[0];
4109 /* FIXME actually a game should never have no name, so I think when black leaves, black's name
4110 * is replaced by white, but in our case, since we have white than black, we'd the opposite
4111 * and then we have to pull up observernames, either alphabetical or in the order they joined
4112 * or something. Should also probably change flags to chat or something */
4113 }
4114 }
4115 #endif //FIXME
4116 }
4117 else if(game->blackcxx . . $ GameListing#black. == player)
4118 {
4119 if(game->blackcxx . . $ GameListing#black.->namecxx . . $ PlayerListing#name. ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "0")
4120 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("black name equals 0!!!!");
4121 game->_black_namecxx . . $ GameListing#_black_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). game->blackcxx . . $ GameListing#black.->namecxx . . $ PlayerListing#name.;
4122 game->_black_rankcxx . . $ GameListing#_black_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). game->blackcxx . . $ GameListing#black.->rankcxx . . $ PlayerListing#rank.;
4123 game->blackcxx . . $ GameListing#black. = 0;
4124 }
4125 /*if(!g->observers)
4126 {
4127 //broadcast games never go down, so there's FIXME
4128 //issues here
4129 qDebug("Closing game %d, no observers", g->number);
4130 g->running = false;
4131 getDefaultRoom()->recvGameListing(g);
4132 }*/
4133 }
4134 else if(player->playingcxx . . $ PlayerListing#playing. == game_id)
4135 return; //nothing to do
4136 #ifdef RE_DEBUG
4137 printf("Moving %s %p from %d to %d\n", player->name.toLatin1().constData(), player, player->playing, game_id);
4138 #endif //RE_DEBUG
4139 player->playingcxx . . $ PlayerListing#playing. = game_id;
4140
4141 /* Doesn't help. Looks like observer counts do not include the players playing themselves which makes some sense
4142 * but we need them in our little list and, well the whole thing is iffy FIXME */
4143 /* Okay, we're adding observer counts here, we can check it later. They're not in the data we get, so that's an issue */
4144
4145 if(game_id && player->observingcxx . . $ PlayerListing#observing. != game_id)
4146 {
4147 game = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(game_id);
4148 //game->observers++;
4149 game->observer_listcxx . . $ GameListing#observer_list..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(player);
4150 }
4151
4152 if(player->observingcxx . . $ PlayerListing#observing. && player->observingcxx . . $ PlayerListing#observing. != game_id)
4153 removeObserverFromGameListingcxx . . $ CyberOroConnection#removeObserverFromGameListing(cac334474c82cf3a).(player);
4154 else
4155 player->observingcxx . . $ PlayerListing#observing. = game_id;
4156 }
4157
4158 //0x55c3
4159 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleSetPhraseChatMsgcxx . . $ CyberOroConnection#handleSetPhraseChatMsg(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
4160 {
4161 if(size != 16)
4162 {
4163 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("set phrase chat msg of strange size: %d", size);
4164 }
4165 unsigned char * p = msg;
4166 //2a02ffff 0000 0000 63ea000083cedc9
4167 unsigned short id = p[0] + (p[1] << 8);
4168 unsigned short setphrase_code;
4169 PlayerListingcxx . . $ PlayerListing# * player = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(id);
4170 /* Our chat appears back in all the rooms were in???
4171 * why??
4172 * FIXME room_were_in must not be the whole picture */
4173 //if(player->name == getUsername())
4174 // return; //to prevent duplicate chats from us
4175 p += 4;
4176 bool in_room = p[0]; //doublecheck, could potentially mean its from us
4177 p += 4;
4178
4179 #ifdef RE_DEBUG
4180 printf("Directed id %d, room_were_in %d\n", directed_id, room_were_in);
4181 #endif //RE_DEBUG
4182 /* They translated a lot more phrases, but these are the major ones
4183 * it looks like */
4184 //p[1] byte is category? and then p[0] is specific msg
4185 setphrase_code = p[0] + (p[1] << 8);
4186 stdcxx . . $ std/::mapcxx . . $ std/map#<unsigned short, QString>::iteratorcxx . . $ std/map#iterator# it = ORO_setphrasecxx . . $ ORO_setphrase..findcxx . . $ std/map#find(36f8d56706583706).(setphrase_code);
4187 if(it !=cxx . . $ std/`operator!=`(be6a71a859368080). ORO_setphrasecxx . . $ ORO_setphrase..endcxx . . $ std/map#end(7e4de33083b6e738).())
4188 {
4189 if(room_were_incxx . . $ CyberOroConnection#room_were_in. && in_room)
4190 {
4191 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_were_incxx . . $ CyberOroConnection#room_were_in.);
4192 if(!boarddispatch)
4193 {
4194 // might just be a room
4195 if(console_dispatchcxx . . $ NetworkConnection#console_dispatch.)
4196 console_dispatchcxx . . $ NetworkConnection#console_dispatch.->recvTextcxx . . $ ConsoleDispatch#recvText(7df51288a9ebd664).(player->namecxx . . $ PlayerListing#name. +cxx . . $ operator+(3d22f08efddf8107). ": " +cxx . . $ operator+(fab9b4f80031f353). it->cxx . . $ std/_Rb_tree_iterator#`operator->`(34d6acfd341ba7ab).second);
4197 }
4198 else
4199 boarddispatch->recvKibitzcxx . . $ BoardDispatch#recvKibitz(3458fe3960d5051).(player->namecxx . . $ PlayerListing#name. +cxx . . $ operator+(3d22f08efddf8107). "[" +cxx . . $ operator+(fab9b4f80031f353). player->rankcxx . . $ PlayerListing#rank. +cxx . . $ operator+(3d22f08efddf8107). "]", itcxx . . $ QString#QString(132dd6869045752b).->cxx . . $ std/_Rb_tree_iterator#`operator->`(34d6acfd341ba7ab).second);
4200 }
4201 else
4202 {
4203 if(console_dispatchcxx . . $ NetworkConnection#console_dispatch.)
4204 console_dispatchcxx . . $ NetworkConnection#console_dispatch.->recvTextcxx . . $ ConsoleDispatch#recvText(7df51288a9ebd664).(player->namecxx . . $ PlayerListing#name. +cxx . . $ operator+(3d22f08efddf8107). "[" +cxx . . $ operator+(fab9b4f80031f353). player->rankcxx . . $ PlayerListing#rank. +cxx . . $ operator+(3d22f08efddf8107). "]: " +cxx . . $ operator+(fab9b4f80031f353). it->cxx . . $ std/_Rb_tree_iterator#`operator->`(34d6acfd341ba7ab).second);
4205 }
4206 }
4207 else
4208 {
4209 if(room_were_incxx . . $ CyberOroConnection#room_were_in. && in_room)
4210 {
4211 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_were_incxx . . $ CyberOroConnection#room_were_in.);
4212 if(!boarddispatch)
4213 {
4214 if(console_dispatchcxx . . $ NetworkConnection#console_dispatch.)
4215 console_dispatchcxx . . $ NetworkConnection#console_dispatch.->recvTextcxx . . $ ConsoleDispatch#recvText(7df51288a9ebd664).(player->namecxx . . $ PlayerListing#name. +cxx . . $ operator+(3d22f08efddf8107). ": " +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(setphrase_code, 16));
4216 }
4217 else
4218 boarddispatch->recvKibitzcxx . . $ BoardDispatch#recvKibitz(3458fe3960d5051).(player->namecxx . . $ PlayerListing#name. +cxx . . $ operator+(3d22f08efddf8107). "[" +cxx . . $ operator+(fab9b4f80031f353). player->rankcxx . . $ PlayerListing#rank. +cxx . . $ operator+(3d22f08efddf8107). "]", QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(setphrase_code, 16));
4219 }
4220 else
4221 {
4222 if(console_dispatchcxx . . $ NetworkConnection#console_dispatch.)
4223 console_dispatchcxx . . $ NetworkConnection#console_dispatch.->recvTextcxx . . $ ConsoleDispatch#recvText(7df51288a9ebd664).(player->namecxx . . $ PlayerListing#name. +cxx . . $ operator+(3d22f08efddf8107). "[" +cxx . . $ operator+(fab9b4f80031f353). player->rankcxx . . $ PlayerListing#rank. +cxx . . $ operator+(3d22f08efddf8107). "]: " +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(setphrase_code, 16));
4224 }
4225 }
4226 #ifdef RE_DEBUG
4227 printf("0x55c3: ");
4228 for(int i = 0; i < (int)size; i++)
4229 printf("%02x", msg[i]);
4230 printf("\n");
4231 #endif //RE_DEBUG
4232 }
4233
4234 //0xf659
4235 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleServerAnnouncementcxx . . $ CyberOroConnection#handleServerAnnouncement(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
4236 {
4237 unsigned char * p = msg;
4238
4239 #ifdef RE_DEBUG
4240 printf("0xf659: ");
4241 for(unsigned int i = 0; i < size; i++)
4242 printf("%02x", msg[i]);
4243 printf("\n");
4244 #endif //RE_DEBUG
4245 p += 2;
4246
4247 /* FIXME, likely first two bytes are something else */
4248 QStringcxx . . $ QString# ucxx . . $ QString#QString(ced63f7c635d850d).;
4249
4250 u =cxx . . $ QString#`operator=`(4f35bf974e7f8568). serverCodeccxx . . $ CyberOroConnection#serverCodec.->toUnicodecxx . . $ QTextCodec#toUnicode(22771b2711c76a3b).((const char *)p, size - 2);
4251 //u = codec->toUnicode(b, size - 4);
4252 if(console_dispatchcxx . . $ NetworkConnection#console_dispatch.)
4253 console_dispatchcxx . . $ NetworkConnection#console_dispatch.->recvTextcxx . . $ ConsoleDispatch#recvText(7df51288a9ebd664).("*** " +cxx . . $ operator+(c75c3ae4eb9af1a8). u);
4254 }
4255
4256 //645a
4257 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleServerAnnouncementwithLinkcxx . . $ CyberOroConnection#handleServerAnnouncementwithLink(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
4258 {
4259 unsigned char * p = msg;
4260
4261 #ifdef RE_DEBUG
4262 printf("645a: ");
4263 for(unsigned int i = 0; i < size; i++)
4264 printf("%02x", msg[i]);
4265 printf("\n");
4266 #endif //RE_DEBUG
4267 p += 2;
4268
4269 /* FIXME, likely first two bytes are something else */
4270 QStringcxx . . $ QString# ucxx . . $ QString#QString(ced63f7c635d850d).;
4271 QStringcxx . . $ QString# linkcxx . . $ QString#QString(ced63f7c635d850d).;
4272 unsigned int len = 0;
4273 while((msg[8 + len] || msg[9 + len])&& len + 8 < 260)
4274 len += 2;
4275 printf("Server anon len %d\n", len);
4276 u =cxx . . $ QString#`operator=`(4f35bf974e7f8568). serverCodeccxx . . $ CyberOroConnection#serverCodec.->toUnicodecxx . . $ QTextCodec#toUnicode(22771b2711c76a3b).((const char *)&(msg[8]), len);
4277 //u = codec->toUnicode(b, size - 4);
4278 len = 0;
4279 while(msg[264 + len] && len + 264 < size)
4280 len++;
4281 printf("Server anon len2 %d\n", len);
4282 link =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).((const char *)&(msg[264])); //not unicode
4283 if(console_dispatchcxx . . $ NetworkConnection#console_dispatch.)
4284 console_dispatchcxx . . $ NetworkConnection#console_dispatch.->recvTextcxx . . $ ConsoleDispatch#recvText(7df51288a9ebd664).("*** " +cxx . . $ operator+(c75c3ae4eb9af1a8). u +cxx . . $ operator+(3d22f08efddf8107). ": " +cxx . . $ operator+(fab9b4f80031f353). link);
4285 }
4286
4287 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleServerRoomChatcxx . . $ CyberOroConnection#handleServerRoomChat(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
4288 {
4289 unsigned char * p = msg;
4290 unsigned char * text = new unsigned char[size - 3];
4291 //unsigned int text_size = (size - 2) / 2;
4292 //unsigned short * text = new unsigned short[text_size];
4293 unsigned short player_id = p[0] + (p[1] << 8);
4294 #ifdef RE_DEBUG
4295 int i;
4296 #endif //RE_DEBUG
4297 /*printf("** msg size: %d: ", size);
4298 for(i = 0; i < (int)size; i++)
4299 printf("%02x", p[i]);
4300 printf("\n");*/
4301
4302 p += 2;
4303 //there's two encoding bytes here... 00 86 looks like ascii
4304
4305 p += 2;
4306 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).(); //3
4307 strncpy((char *)text, (char *)p, size - 4); text[size - 4] = 0x00;
4308 /*for(i = 0; i < text_size; i++)
4309 {
4310 text[i] = p[0] + (p[1] << 8);
4311 p += 2;
4312 }*/
4313 PlayerListingcxx . . $ PlayerListing# * player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(player_id);
4314 QStringcxx . . $ QString# u = serverCodeccxx . . $ CyberOroConnection#serverCodec.->toUnicodecxx . . $ QTextCodec#toUnicode(22771b2711c76a3b).((const char *)text, size - 4);
4315 //u = codec->toUnicode(b, size - 4);
4316 if(console_dispatchcxx . . $ NetworkConnection#console_dispatch.)
4317 console_dispatchcxx . . $ NetworkConnection#console_dispatch.->recvTextcxx . . $ ConsoleDispatch#recvText(7df51288a9ebd664).(player->namecxx . . $ PlayerListing#name. +cxx . . $ operator+(3d22f08efddf8107). "[" +cxx . . $ operator+(fab9b4f80031f353). player->rankcxx . . $ PlayerListing#rank. +cxx . . $ operator+(3d22f08efddf8107). "]: " +cxx . . $ operator+(fab9b4f80031f353). u);
4318
4319 delete[] text;
4320 }
4321
4322 //EC 59 1B 00 D3 04 00 7E 68 65 6C 6C 6F 20 63 68 .Y.....~hello ch
4323 //61 74 20 72 6F 6F 6D 20 31 35 30 at room 150
4324 //0xec59
4325 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleRoomChatcxx . . $ CyberOroConnection#handleRoomChat(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
4326 {
4327 /* Maybe this is game chat only ?!??! Its weird... I guess
4328 * its just for whatever room you're in and you can only be in
4329 * one room at a time, a game room, a club room, but only one room.*/
4330 unsigned char * p = msg;
4331
4332 #ifdef RE_DEBUG
4333 int i;
4334 #endif //RE_DEBUG
4335 /*printf("** msg size: %d: ", size);
4336 for(i = 0; i < (int)size; i++)
4337 printf("%02x", p[i]);
4338 printf("\n");*/
4339 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
4340 const PlayerListingcxx . . $ PlayerListing# * player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
4341 p += 2;
4342 if(player->namecxx . . $ PlayerListing#name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).())
4343 return; //block as echo
4344
4345 //these two bytes are font or something
4346 p += 2;
4347 // the rest is the text
4348 unsigned char * text = new unsigned char[size - 3];
4349 strncpy((char *)text, (char *)p, size - 4); text[size - 4] = 0x00;
4350
4351 if(player)
4352 {
4353 #ifdef RE_DEBUG
4354 printf("%s says to you ", player->name.toLatin1().constData());
4355 for(i = 0; i < (int)size - 4; i++)
4356 printf("%02x", text[i]);
4357 printf("\n");
4358 #endif //RE_DEBUG
4359
4360 QStringcxx . . $ QString# ucxx . . $ QString#QString(ced63f7c635d850d).;
4361
4362 u =cxx . . $ QString#`operator=`(4f35bf974e7f8568). serverCodeccxx . . $ CyberOroConnection#serverCodec.->toUnicodecxx . . $ QTextCodec#toUnicode(22771b2711c76a3b).((const char *)text, size - 4);
4363
4364 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_were_incxx . . $ CyberOroConnection#room_were_in.);
4365 if(boarddispatch)
4366 boarddispatch->recvKibitzcxx . . $ BoardDispatch#recvKibitz(3458fe3960d5051).(player->namecxx . . $ PlayerListing#name. +cxx . . $ operator+(3d22f08efddf8107). "[" +cxx . . $ operator+(fab9b4f80031f353). player->rankcxx . . $ PlayerListing#rank. +cxx . . $ operator+(3d22f08efddf8107). "]", ucxx . . $ QString#QString(132dd6869045752b).);
4367 else
4368 {
4369 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("No boarddispatch for %d", room_were_incxx . . $ CyberOroConnection#room_were_in.);
4370 if(console_dispatchcxx . . $ NetworkConnection#console_dispatch.)
4371 console_dispatchcxx . . $ NetworkConnection#console_dispatch.->recvTextcxx . . $ ConsoleDispatch#recvText(7df51288a9ebd664).(player->namecxx . . $ PlayerListing#name. +cxx . . $ operator+(3d22f08efddf8107). "(" +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(room_were_incxx . . $ CyberOroConnection#room_were_in.) +cxx . . $ operator+(3d22f08efddf8107). "): " +cxx . . $ operator+(fab9b4f80031f353). u);
4372 }
4373 }
4374 else
4375 printf("unknown player says something");
4376 delete[] text;
4377 }
4378
4379 void CyberOroConnectioncxx . . $ CyberOroConnection#::handlePersonalChatcxx . . $ CyberOroConnection#handlePersonalChat(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
4380 {
4381 unsigned char * p = msg;
4382 unsigned char * text = new unsigned char[size - 7];
4383 #ifdef RE_DEBUG
4384 unsigned int i;
4385 printf("** msg size: %d: ", size);
4386 for(i = 0; i < size; i++)
4387 printf("%02x", p[i]);
4388 printf("\n");
4389 #endif //RE_DEBUG
4390 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
4391 p += 4;
4392 PlayerListingcxx . . $ PlayerListing# * player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
4393 p += 2;
4394 p += 2;
4395 strncpy((char *)text, (char *)p, size - 8); text[size - 8] = 0x00;
4396 if(player)
4397 {
4398 #ifdef RE_DEBUG
4399 printf("%s says to you ", player->name.toLatin1().constData());
4400 for(i = 0; i < size - 8; i++)
4401 printf("%02x", text[i]);
4402 printf("\n");
4403 #endif //RE_DEBUG
4404 Talkcxx . . $ Talk# * talk = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getTalkcxx . . $ Room#getTalk(e709c6e389e35213).(player);
4405 if(talk)
4406 {
4407 talk->recvTalkcxx . . $ Talk#recvTalk(7df51288a9ebd664).(QStringcxx . . $ QString#QString(85c52e162fed56f9).((char *)text));
4408 talk->updatePlayerListingcxx . . $ Talk#updatePlayerListing(49f6e7a06ebc5aa8).();
4409 }
4410 //if(console_dispatch)
4411 // console_dispatch->recvText(player->name + "-> " + QString((char *)text));
4412 }
4413 else
4414 printf("unknown player says something");
4415 delete[] text;
4416 }
4417
4418 //not disconnect, enter lobby? 0e56, really leaning towards enterlobby
4419 // or enter anything
4420 // this is definitely an actual enter room. We might need to use this
4421 // when we join a room, especially or in particular a broadcast room
4422 // if the betting message doesn't otherwise indicate that we've actually
4423 // joined. Otherwise we get the move list and there's nothing tohandle it
4424 // FIXME
4425 void CyberOroConnectioncxx . . $ CyberOroConnection#::handlePlayerRoomJoincxx . . $ CyberOroConnection#handlePlayerRoomJoin(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
4426 {
4427 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
4428 unsigned char * p = msg;
4429 unsigned int id;
4430 unsigned short room_number;
4431 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
4432 GameListingcxx . . $ GameListing# * game;
4433
4434 if(size != 4)
4435 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("handlePlayerRoomJoin of size: %d\n", size);
4436 id = p[0] + (p[1] << 8);
4437 PlayerListingcxx . . $ PlayerListing# * aPlayer = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(id);
4438 room_number = p[2] + (p[3] << 8);
4439 #ifdef RE_DEBUG
4440 printf("%s %02x%02x entering room %d\n", aPlayer->name.toLatin1().constData(), p[0], p[1], room_number);
4441 #endif //RE_DEBUG
4442 /* We get this message before the boarddispatch is created, which
4443 * means that we won't see ourselves entering the game. If
4444 * we wanted to fix this, we could create the boarddispatch
4445 * possibly a little earlier, or just add our own name as
4446 * a listing when we observe games. Then there's matches
4447 * also. FIXME */
4448 if(room_were_incxx . . $ CyberOroConnection#room_were_in.)
4449 {
4450 if(aPlayer->observingcxx . . $ PlayerListing#observing. == room_were_incxx . . $ CyberOroConnection#room_were_in.)
4451 {
4452 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_were_incxx . . $ CyberOroConnection#room_were_in.);
4453 if(boarddispatch)
4454 boarddispatch->recvObservercxx . . $ BoardDispatch#recvObserver(fcd883ebbd0934ee).(aPlayer, false);
4455 }
4456 else if(room_number == room_were_incxx . . $ CyberOroConnection#room_were_in.)
4457 {
4458 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_were_incxx . . $ CyberOroConnection#room_were_in.);
4459 if(boarddispatch)
4460 boarddispatch->recvObservercxx . . $ BoardDispatch#recvObserver(fcd883ebbd0934ee).(aPlayer, true);
4461 }
4462 }
4463 if(aPlayer->observingcxx . . $ PlayerListing#observing.)
4464 removeObserverFromGameListingcxx . . $ CyberOroConnection#removeObserverFromGameListing(cac334474c82cf3a).(aPlayer);
4465 aPlayer->observingcxx . . $ PlayerListing#observing. = room_number;
4466 if(room_number) //0 is lobby
4467 {
4468 game = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(room_number);
4469 game->observerscxx . . $ GameListing#observers.++;
4470 game->observer_listcxx . . $ GameListing#observer_list..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(aPlayer);
4471 if(id == our_player_idcxx . . $ CyberOroConnection#our_player_id.)
4472 {
4473 if(game->gameDatacxx . . $ GameListing#gameData.) //only used on finished games where we won't receive info from server
4474 {
4475 boarddispatch = getBoardDispatchcxx . . $ NetworkConnection#getBoardDispatch(f34f0704202202).(room_number);
4476 boarddispatch->openBoardcxx . . $ BoardDispatch#openBoard(49f6e7a06ebc5aa8).();
4477 }
4478 setRoomNumbercxx . . $ CyberOroConnection#setRoomNumber(ed53e3bbd3fa2f69).(room_number);
4479 if((boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_number)))
4480 addObserverListToBoardcxx . . $ CyberOroConnection#addObserverListToBoard(f9aae4eee533680e).(boarddispatch);
4481 }
4482 }
4483 /* We set to 0 here with the idea that they aren't entering
4484 * their own game, but its a little weird FIXME */
4485 setAttachedGamecxx . . $ CyberOroConnection#setAttachedGame(b9f1593580940ebc).(aPlayer, 0);
4486 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! playerListingReceivedcxx . . $ NetworkConnection#playerListingReceived(122195e397f39e1b).(aPlayer);
4487 }
4488
4489 void CyberOroConnectioncxx . . $ CyberOroConnection#::removeObserverFromGameListingcxx . . $ CyberOroConnection#removeObserverFromGameListing(cac334474c82cf3a).(const PlayerListingcxx . . $ PlayerListing# * p)
4490 {
4491 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
4492 GameListingcxx . . $ GameListing# * game = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(p->observingcxx . . $ PlayerListing#observing.);
4493 #ifdef RE_DEBUG
4494 //printf("Removing observer from game %d with %d observers\n", game->number, game->observers);
4495 #endif //RE_DEBUG
4496 if(game->observerscxx . . $ GameListing#observers. == 0)
4497 {
4498 /* This can happen if, for instance, someone creates a broadcast game
4499 * that hangs around with 0 observers, and then leaves it and joins
4500 * another game. We just don't want negative numbers */
4501 return;
4502 }
4503 game->observerscxx . . $ GameListing#observers.--;
4504 for(stdcxx . . $ std/::vectorcxx . . $ std/vector#<PlayerListing *>::iteratorcxx . . $ std/vector#iterator# oblistit = game->observer_listcxx . . $ GameListing#observer_list..begincxx . . $ std/vector#begin(55a6de06420d4903).();
4505 oblistit != game->observer_listcxx . . $ GameListing#observer_list..endcxx . . $ std/vector#end(55a6de06420d4903).(); oblistit++)
4506 {
4507 if(*oblistit == p)
4508 {
4509 game->observer_listcxx . . $ GameListing#observer_list..erasecxx . . $ std/vector#erase(351407f384f345bc).(oblistit);
4510 break;
4511 }
4512 }
4513 if(game->observerscxx . . $ GameListing#observers. == 0 && !game->isBroadcastcxx . . $ GameListing#isBroadcast.)
4514 {
4515 /* We should probably increment an observer count here, and
4516 * decrement, and if it gets to 0, remove the room. I don't
4517 * think there's another message that does it FIXME (but this
4518 * requires accurate observer counts. */
4519 game->runningcxx . . $ GameListing#running. = false;
4520 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! gameListingReceivedcxx . . $ NetworkConnection#gameListingReceived(9a447f3b9a8a5041).(game);
4521 /* No, oro tells us elsewhere to delete game */
4522 /* Not necessarily, its possible that if the game is fully over when everyone leaves
4523 * its assumed that it gets deleted FIXME */
4524 }
4525 }
4526
4527 //4a9c likely real disconnect or maybe not!!!
4528 void CyberOroConnectioncxx . . $ CyberOroConnection#::handlePlayerDisconnect2cxx . . $ CyberOroConnection#handlePlayerDisconnect2(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
4529 {
4530 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
4531 unsigned char * p = msg;
4532 unsigned int id;
4533 unsigned short room_id;
4534 if(size != 4)
4535 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("handlePlayerDisconnect of size: %d\n", size);
4536 id = p[0] + (p[1] << 8);
4537 PlayerListingcxx . . $ PlayerListing# * aPlayer = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(id);
4538 p += 2;
4539 /* If this is the room id, its reversed... */
4540 room_id = p[0] + (p[1] << 8);
4541 #ifdef RE_DEBUG
4542 printf("%s 4a9c: %02x%02x %d %d\n", aPlayer->name.toLatin1().constData(), p[0], p[1], room_id, aPlayer->observing);
4543 #endif //RE_DEBUG
4544
4545 if(aPlayer->observingcxx . . $ PlayerListing#observing.)
4546 {
4547 room_id = aPlayer->observingcxx . . $ PlayerListing#observing.;
4548 removeObserverFromGameListingcxx . . $ CyberOroConnection#removeObserverFromGameListing(cac334474c82cf3a).(aPlayer);
4549 }
4550 else
4551 room_id = 0;
4552
4553 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_id);
4554 if(boarddispatch)
4555 {
4556 // Player left a running game? maybe observer though
4557 // but we need to check if stop clock is necessary
4558 boarddispatch->recvObservercxx . . $ BoardDispatch#recvObserver(fcd883ebbd0934ee).(aPlayer, false); //doublecheck
4559 GameDatacxx . . $ GameData# * gd = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
4560 if(gd->gameModecxx . . $ GameData#gameMode. == modeMatchcxx . . $ modeMatch. && (aPlayer->namecxx . . $ PlayerListing#name. ==cxx . . $ `operator==`(5bc2975d2d751687). gd->black_namecxx . . $ GameData#black_name. || aPlayer->namecxx . . $ PlayerListing#name. ==cxx . . $ `operator==`(5bc2975d2d751687). gd->white_namecxx . . $ GameData#white_name.))
4561 {
4562 boarddispatch->recvKibitzcxx . . $ BoardDispatch#recvKibitz(3458fe3960d5051).(QStringcxx . . $ QString#QString(ced63f7c635d850d).(), trcxx . . $ NetworkConnection#tr(75d9f1c324b4579d).("%1 has left the room.").argcxx . . $ QString#arg(bc823072288cbbb5).(aPlayer->namecxx . . $ PlayerListing#name.));
4563 if(gd->movescxx . . $ GameData#moves. < 10) //doublecheck, not 11?? FIXME
4564 {
4565 boarddispatch->recvKibitzcxx . . $ BoardDispatch#recvKibitz(3458fe3960d5051).(QStringcxx . . $ QString#QString(ced63f7c635d850d).(), trcxx . . $ NetworkConnection#tr(75d9f1c324b4579d).("Adjourned games with less than 10 moves are not counted."));
4566 GameResultcxx . . $ GameResult# aGameResultcxx . . $ GameResult#GameResult(49f6e7a06ebc5aa8).;
4567 aGameResult.resultcxx . . $ GameResult#result. = GameResultcxx . . $ GameResult#::NOGAMEcxx . . $ GameResult#NOGAME.;
4568 boarddispatch->recvResultcxx . . $ BoardDispatch#recvResult(c72a8b5aed169521).(&aGameResult);
4569 }
4570 else
4571 {
4572 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->opponentDisconnectcxx . . $ MatchNegotiationState#opponentDisconnect(49f6e7a06ebc5aa8).();
4573 boarddispatch->stopTimecxx . . $ BoardDispatch#stopTime(49f6e7a06ebc5aa8).();
4574 QStringcxx . . $ QString# q = QStringcxx . . $ QString#(trcxx . . $ NetworkConnection#tr(75d9f1c324b4579d).("Opponent Disconnected"));
4575 boarddispatch->moveControlcxx . . $ BoardDispatch#moveControl(4c89b026053e4d32).(q);
4576 }
4577 }
4578 }
4579
4580 aPlayer->onlinecxx . . $ PlayerListing#online. = false;
4581 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! playerListingReceivedcxx . . $ NetworkConnection#playerListingReceived(122195e397f39e1b).(aPlayer);
4582 }
4583
4584 //85bb
4585 // I think these are result messages... I thought they were new game
4586 // from people doing rematches... but there's no game codes in them...
4587 // they could also be player updates I guess, but that's doubtful
4588 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleNewGamecxx . . $ CyberOroConnection#handleNewGame(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
4589 {
4590 unsigned char * p = msg;
4591 unsigned short player_id = p[0] + (p[1] << 8);
4592
4593 if(size != 28)
4594 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("85bb new game of size %d", size);
4595 #ifdef RE_DEBUG
4596 Room * room = getDefaultRoom();
4597 PlayerListing * player;
4598 player = room->getPlayerListing(player_id);
4599 if(player)
4600 printf("%s ", player->name.toLatin1().constData());
4601 // 4th byte here is 01 for winner and 02 for loser
4602 // separate msg for each player result
4603 if(p[3] == 0x10)
4604 printf(" wins ");
4605 else if(p[3] == 0x20)
4606 printf(" loses ");
4607 else
4608 printf(" %02x ", p[3]);
4609 for(unsigned int i = 0; i < 28; i++)
4610 printf("%02x", p[i]);
4611 printf("\n");
4612 #endif //RE_DEBUG
4613 // we probably don't send these during pass?
4614 if(player_id == our_player_idcxx . . $ CyberOroConnection#our_player_id.)
4615 killActiveMatchTimerscxx . . $ CyberOroConnection#killActiveMatchTimers(49f6e7a06ebc5aa8).();
4616 //GameListing * g = room->getGameListing();
4617 //g->running = false;
4618 //room->recvGameListing(g);
4619 }
4620
4621 /* Below might not be observer list at all....
4622 * Maybe its for betting matches ?!?!? */
4623 //FIXME, yeah, not observer list
4624 //0xdfde
4625 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleObserverListcxx . . $ CyberOroConnection#handleObserverList(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
4626 {
4627 unsigned char * p = msg;
4628 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
4629
4630 if(!room_were_incxx . . $ CyberOroConnection#room_were_in.)
4631 {
4632 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("observer list but we're not in a room!");
4633 return;
4634 }
4635 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_were_incxx . . $ CyberOroConnection#room_were_in.);
4636 if(!boarddispatch)
4637 {
4638 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("no board dispatch for room were in");
4639 return;
4640 }
4641
4642 #ifdef RE_DEBUG
4643 printf("0xdfde: ");
4644 for(int i = 0; i < (int)size; i++)
4645 printf("%02x", msg[i]);
4646 printf("\n");
4647 #endif //RE_DEBUG
4648 // unsigned short game_code = p[0] + (p[1] << 8);
4649 p += 2;
4650 //unsigned short observer_list_index = p[0] + (p[1] << 8);
4651 p += 2;
4652 /*if(size != 10)
4653 {
4654 qDebug("GameEnded of strange size: %d", size);
4655 return;
4656 }*/
4657 p += 24; //zeroes
4658 while(p < (msg + size - 20))
4659 {
4660 p += 8;
4661 // unsigned short id = p[0] + (p[1] << 8);
4662 /*aPlayer = room->getPlayerListing(id);
4663 if(aPlayer)
4664 boarddispatch->recvObserver(aPlayer, true);
4665 else*/
4666 #ifdef RE_DEBUG
4667 printf("ol: %02x %02x\n", p[0], p[1]);
4668 #endif //RE_DEBUG
4669 p += 12;
4670 }
4671 }
4672
4673 /* What if this wasn't game ended but instead game started and we got it when
4674 * there were returns to match mode as well as rematches?!?! I'll try sending
4675 * it as an accept. FIXME*/
4676 //0xe1af:
4677 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleGameEndedcxx . . $ CyberOroConnection#handleGameEnded(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
4678 {
4679 unsigned char * p = msg;
4680 unsigned short game_code;
4681 unsigned int game_number;
4682 GameListingcxx . . $ GameListing# * game;
4683 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
4684 if(size != 10)
4685 {
4686 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("GameEnded of strange size: %d", size);
4687 return;
4688 }
4689 game_code = msg[0] + (msg[1] << 8);
4690 game_number = msg[2] + (msg[3] << 8);
4691 p += 4;
4692 #ifdef RE_DEBUG
4693 //DOUBLECHECK
4694 printf("e1af for %d %d\n", game_code, game_number);
4695 #endif //RE_DEBUG
4696 game = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(game_number);
4697 /* FIXME, what about owner_id??? this could be a room
4698 * closed message */
4699 /* Room doesn't go away after game, one can still join it until
4700 * everyone is gone */
4701 #ifdef NOTREALLY
4702 /*if(game->white)
4703 {
4704 game->white->playing = 0;
4705 game->white = 0; //just in case
4706 }
4707 if(game->black)
4708 {
4709 game->black->playing = 0;
4710 game->black = 0; //just in case
4711 }
4712 game->running = false;
4713 room->recvGameListing(game);
4714 game_code_to_number.erase(game_number); // good?*/
4715 #endif //NOTREALLY
4716 //the rest are pretty repetitive, non-specific FIXME
4717 #ifdef RE_DEBUG
4718 printf("0xe1af: ");
4719 for(int i = 0; i < (int)size; i++)
4720 printf("%02x", msg[i]);
4721 printf("\n");
4722 #endif //RE_DEBUG
4723 }
4724
4725 /* I'm thinking 0a7d may be NewMatch and ca5d is NewRoom FIXME */
4726 //0a7d
4727 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleNewRoomcxx . . $ CyberOroConnection#handleNewRoom(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
4728 {
4729 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
4730 unsigned char * p = msg;
4731 PlayerListingcxx . . $ PlayerListing# * black;
4732 PlayerListingcxx . . $ PlayerListing# * white;
4733 unsigned short id;
4734 unsigned short number;
4735 GameListingcxx . . $ GameListing# * aGameListing;
4736
4737 if(size != 6 && size != 18)
4738 {
4739 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("NewRoom of strange size: FIXME 18 %d", size);
4740 //FIXME we're having handleResume call this with size 18
4741 // fix that...
4742 //return;
4743 }
4744
4745
4746 number = p[0] + (p[1] << 8);
4747 if(!number)
4748 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("0a7d on number 0");
4749 aGameListing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(number);
4750 p += 2;
4751 /* Why does ORO 0a7d have white then black, but 1a81 has
4752 * black then white? And what about numbers and game_codes?
4753 * it seems like ORO protocol is based on two different programs,
4754 * like there's legacy code in there. And I complained about IGS
4755 * so much. I guess nothing is perfect. And I'm lazy in this all
4756 * the time too...
4757 * Okay, actually, this seems to reverse, like maybe this just means
4758 * they're in the same room or something and they're still deciding
4759 * white versus black, or there's some nigiri thing... this white
4760 * black DOESN'T matter. */
4761 /* Okay, since we changed the listing to handle numbers, game codes
4762 * on board dispatches... what's changed here ??? FIXME */
4763 aGameListing->owner_idcxx . . $ GameListing#owner_id. = p[0] + (p[1] << 8);
4764 aGameListing->observerscxx . . $ GameListing#observers. = 0; //okay?
4765 white = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(aGameListing->owner_idcxx . . $ GameListing#owner_id.);
4766 /* This is redundant, but we won't receive entering msgs
4767 * for these players */
4768 setAttachedGamecxx . . $ CyberOroConnection#setAttachedGame(b9f1593580940ebc).(white, aGameListing->numbercxx . . $ GameListing#number.);
4769 white->observingcxx . . $ PlayerListing#observing. = aGameListing->numbercxx . . $ GameListing#number.;
4770 if(aGameListing->owner_idcxx . . $ GameListing#owner_id. == our_player_idcxx . . $ CyberOroConnection#our_player_id.)
4771 setRoomNumbercxx . . $ CyberOroConnection#setRoomNumber(ed53e3bbd3fa2f69).(aGameListing->numbercxx . . $ GameListing#number.);
4772 aGameListing->observerscxx . . $ GameListing#observers.++;
4773 aGameListing->observer_listcxx . . $ GameListing#observer_list..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(white);
4774
4775 p += 2;
4776 id = p[0] + (p[1] << 8);
4777 black = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(id);
4778 if(!black)
4779 {
4780 printf("can't get black player: %02x%02x\n", p[0], p[1]);
4781 //return; //not an issue
4782 }
4783 else
4784 {
4785 setAttachedGamecxx . . $ CyberOroConnection#setAttachedGame(b9f1593580940ebc).(black, aGameListing->numbercxx . . $ GameListing#number.);
4786 black->observingcxx . . $ PlayerListing#observing. = aGameListing->numbercxx . . $ GameListing#number.;
4787 if(id == our_player_idcxx . . $ CyberOroConnection#our_player_id.)
4788 setRoomNumbercxx . . $ CyberOroConnection#setRoomNumber(ed53e3bbd3fa2f69).(aGameListing->numbercxx . . $ GameListing#number.);
4789 aGameListing->observerscxx . . $ GameListing#observers.++;
4790 aGameListing->observer_listcxx . . $ GameListing#observer_list..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(black);
4791 }
4792 /* FIXME, no recv, no game yet, maybe there should be. */
4793 aGameListing->whitecxx . . $ GameListing#white. = white;
4794 aGameListing->blackcxx . . $ GameListing#black. = black;
4795
4796 #ifdef RE_DEBUG
4797 if(newGameListing)
4798 printf("0a7d for game with no game code: %d %s size(%d) %s\n", aGameListing->number, white->name.toLatin1().constData(), size, black->name.toLatin1().constData());
4799 #endif //RE_DEBUG
4800 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! gameListingReceivedcxx . . $ NetworkConnection#gameListingReceived(9a447f3b9a8a5041).(aGameListing);
4801 }
4802
4803 //1a81
4804 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleGameMsgcxx . . $ CyberOroConnection#handleGameMsg(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
4805 {
4806 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
4807 unsigned char * p = msg;
4808 unsigned short game_code;
4809 unsigned int handicap;
4810 unsigned char byte;
4811 PlayerListingcxx . . $ PlayerListing# * black;
4812 PlayerListingcxx . . $ PlayerListing# * white;
4813 PlayerListingcxx . . $ PlayerListing# * owner;
4814 GameListingcxx . . $ GameListing# * aGameListing = 0;
4815 if(size != 22)
4816 {
4817 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("game msg of strange size %d", size);
4818 }
4819 #ifdef RE_DEBUG
4820 printf("1a81 message: ");
4821 #endif //RE_DEBUG
4822 game_code = p[0] + (p[1] << 8); //used in joining games
4823 #ifdef RE_DEBUG
4824 printf("%02x%02x {%02x ", p[0], p[1], p[2]);
4825 #endif //RE_DEBUG
4826 p += 2;
4827 //0x1f
4828 p++;
4829 handicap = p[0];
4830 p++;
4831 #ifdef RE_DEBUG
4832 for(unsigned int i = 0; i < size - 4; i++)
4833 printf("%02x", p[i]);
4834 #endif //RE_DEBUG
4835 byte = p[2];
4836 p += 2;
4837
4838 black = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
4839 #ifdef RE_DEBUG
4840 if(black)
4841 printf("} game of %s %02x%02x", black->name.toLatin1().constData(), p[0], p[1]);
4842 #endif //RE_DEBUG
4843 p += 2;
4844 white = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
4845 #ifdef RE_DEBUG
4846 if(white)
4847 printf(" and %s %02x%02x", white->name.toLatin1().constData(), p[0], p[1]);
4848 #endif //RE_DEBUG
4849 p += 2;
4850 #ifdef RE_DEBUG
4851 printf("\n");
4852 #endif //RE_DEBUG
4853 if(!black || !white)
4854 {
4855 printf("%d gamecode game is missing black or white\n", game_code);
4856 return;
4857 }
4858 /* If there's a rematch, we might be able to just use
4859 * the "attachedgame" to get the number */
4860 if(black->observingcxx . . $ PlayerListing#observing.)
4861 {
4862 aGameListing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(black->observingcxx . . $ PlayerListing#observing.);
4863 #ifdef RE_DEBUG
4864 if(aGameListing)
4865 printf("Found %d for this game\n", aGameListing->number);
4866 #endif //RE_DEBUG
4867 }
4868 if(white->observingcxx . . $ PlayerListing#observing. && !aGameListing)
4869 {
4870 aGameListing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(white->observingcxx . . $ PlayerListing#observing.);
4871 #ifdef RE_DEBUG
4872 if(aGameListing)
4873 printf("Found %d for this game\n", aGameListing->number);
4874 #endif //RE_DEBUG
4875 }
4876 if(black->playingcxx . . $ PlayerListing#playing. && !aGameListing)
4877 {
4878 aGameListing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(black->playingcxx . . $ PlayerListing#playing.);
4879 #ifdef RE_DEBUG
4880 if(aGameListing)
4881 printf("Found %d for this game\n", aGameListing->number);
4882 #endif //RE_DEBUG
4883 }
4884 if(white->playingcxx . . $ PlayerListing#playing. && !aGameListing)
4885 {
4886 aGameListing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(white->playingcxx . . $ PlayerListing#playing.);
4887 #ifdef RE_DEBUG
4888 if(aGameListing)
4889 printf("Found %d for this game\n", aGameListing->number);
4890 #endif //RE_DEBUG
4891 }
4892 if(aGameListing && aGameListing->runningcxx . . $ GameListing#running. == false)
4893 {
4894 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Found non running game in game registry !!!");
4895 return;
4896 }
4897
4898 if(!aGameListing)
4899 {
4900 printf("No 0a7d for this game\n");
4901 return;
4902 /* FIXME, if there's no room, we can't add the game. */
4903 }
4904
4905 game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code] = aGameListing->numbercxx . . $ GameListing#number.;
4906 #ifdef RE_DEBUG
4907 printf("Setting game code to game number %02x%02x %d\n", msg[0], msg[1], aGameListing->number);
4908 #endif //RE_DEBUG
4909 /* Somehow, its possible to get here with a game listing that's been erased and yet somehow comes up
4910 * from getGameListing FIXME FIXME*/
4911 aGameListing->blackcxx . . $ GameListing#black. = black;
4912 aGameListing->whitecxx . . $ GameListing#white. = white;
4913 owner = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(aGameListing->owner_idcxx . . $ GameListing#owner_id.);
4914 /* FIXME, Presumably this is where the crash comes from, we don't get entering rooms for these players
4915 * which is fine, but we need to inc the observers to prevent removing the owner from deleting it */
4916 if(owner != black)
4917 {
4918 setAttachedGamecxx . . $ CyberOroConnection#setAttachedGame(b9f1593580940ebc).(black, aGameListing->numbercxx . . $ GameListing#number.);
4919 aGameListing->observerscxx . . $ GameListing#observers.++;
4920 }
4921 if(owner != white)
4922 {
4923 setAttachedGamecxx . . $ CyberOroConnection#setAttachedGame(b9f1593580940ebc).(white, aGameListing->numbercxx . . $ GameListing#number.);
4924 aGameListing->observerscxx . . $ GameListing#observers.++;
4925 }
4926 //detach owner if any, players are attached alread
4927 if(owner && owner != black && owner != white)
4928 setAttachedGamecxx . . $ CyberOroConnection#setAttachedGame(b9f1593580940ebc).(owner, 0);
4929 /* Its crashing below FIXME because the players aren't adding to the observers list and then setAttachedGame is deleting
4930 * the game */
4931 /* FIXME we may want to swap the colors? if they're now
4932 * legit, pending on nigiri comprehension?? */
4933 aGameListing->FRcxx . . $ GameListing#FR. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(byte); //should probably just be ->flags FIXME
4934 aGameListing->game_codecxx . . $ GameListing#game_code. = game_code;
4935 aGameListing->handicapcxx . . $ GameListing#handicap. = handicap;
4936 aGameListing->isRoomOnlycxx . . $ GameListing#isRoomOnly. = false;
4937 }
4938 //1b00 2900 0100 0000 0600 2c01 6900 2500 0404 0000 1400 0400 0200 6b61 7365 697a 696e 0000
4939 //626d 7762 6d77 0000 0000 6b61 7365 697a 696e 0000 8df7 92ac 0000 0000 0000 0303 a8a8 0103
4940 //000200000000000042000000000000000000000000000000000000000000000000000000000000000000000b
4941
4942 //1b00 ffff 0100 0000 0600 8403 8403 8403 0303 0000 1e00 0300 0200 7363 6879 3837 3337 0000
4943 //7968 6c65 6564 6562 0000 bcf8 bcf6 0000 0000 0000 c8ab c0ba b0c5 bbe7 0000 0101 a7a7 0105
4944 //000200000000000000000000000000000000000000000000000000000000000000000000000000000001000b
4945
4946
4947 //1c00 ffff 0100 0000 0600 2c01 2c01 2c01 0505 0000 1400 0500 0200 7475 7266 6679 0000 0000
4948 //6c69 6831 3230 3600 0000 8b49 9656 0000 0000 0000 3132 3036 0000 0000 0000 0301 a7a7 0105
4949 //000200000000000000000000000000000000000000000000000000000000000000000000000000000001000b
4950
4951 //1c00 ffff 0100 0000 0600 2c01 2c01 2c01 0303 0000 1e00 0300 0200 696e 796f 7000 0000 0000
4952 //6b6b 3036 3239 0000 0000 c7d1 bdb4 c7d1 bdb4 0000 6b6b 3036 3239 0000 0000 0101 a7a7 0101
4953 //00020000000000000000000000000000000000000000000000000000000000000000000000000
4954 //0000001000b
4955
4956
4957 /* I think we get these when we try to observe broadcasted, or betting games
4958 * as well. */
4959 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleBettingMatchStartcxx . . $ CyberOroConnection#handleBettingMatchStart(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
4960 {
4961 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
4962 unsigned char * p = msg;
4963 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
4964 GameListingcxx . . $ GameListing# * aGameListing;
4965 GameDatacxx . . $ GameData# * aGameData, * newGameData = 0;
4966 unsigned char name[11];
4967 name[10] = 0x00;
4968 unsigned short game_number;
4969 int black_seconds, white_seconds;
4970 int black_periods, white_periods;
4971 bool black_in_byoyomi, white_in_byoyomi;
4972 bool joining = false;
4973 if(size != 116)
4974 {
4975 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Betting Match msg of strange size %d", size);
4976 }
4977 #ifdef RE_DEBUG
4978 printf("New Betting Match: ");
4979 for(unsigned int i = 0; i < size; i++)
4980 printf("%02x", p[i]);
4981 printf("\n");
4982 #endif //RE_DEBUG
4983
4984 /* We get this when we join a broadcasted game. I'm not certain when
4985 * it should open a board yet. Maybe we'll have to set something in
4986 * the observe code to do that... but I'm going to try something here */
4987 /* Oh but wait... because its a total piece of shit, the move list2
4988 * comes with game_code, rather than number. Without making things
4989 * stateful, and I'm just not ready for that kind of commitment, we'll
4990 * need to create on MoveList2. Except there's another problem.
4991 * the game info is on the listing which we get with the number.
4992 * I swear to god. I was so annoyed with IGS that they didn't
4993 * consistently transmit game ids with info. But ORO is just ridiculous,
4994 * with two different identifiers, not used consistently.*/
4995 /* Okay, final solution. We store the game number when we start to
4996 * observe and the move list picks it up. */
4997 /* We still can get time settings here and store them on the listing?? */
4998 game_number = msg[0] + (msg[1] << 8);
4999
5000 p += 2;
5001 /* The next two bytes might help. or not*/
5002 if(msg[2] == 0xff && msg[3] == 0xff)
5003 {
5004 /* If these are ffff, we can add it to the listing I think */
5005 joining = false;
5006 #ifdef RE_DEBUG
5007 printf("not for joining\n");
5008 #endif //RE_DEBUG
5009 }
5010 else if(our_player_idcxx . . $ CyberOroConnection#our_player_id. == msg[2] + (msg[3] << 8))
5011 {
5012 joining = true;
5013 #ifdef RE_DEBUG
5014 printf("joining\n");
5015 #endif //RE_DEBUG
5016 }
5017
5018 p += 2;
5019 /* FIXME Okay, I'm thinking that there's a standard game
5020 * data struct that we should just write something to convert
5021 * from. I.e., we pass it the chunk of data and done.
5022 * Check out some of the match offers and see if we can
5023 * puzzle it out */
5024 if(joining)
5025 {
5026 #ifdef RE_DEBUG
5027 //this keeps coming up, I think just to tell us there's a game but its annoying because it opens
5028 //a window FIXME
5029 qDebug("Apparently joining or not %d (%d?)", game_number, connecting_to_game_number);
5030 #endif //RE_DEBUG
5031 boarddispatch = getBoardDispatchcxx . . $ NetworkConnection#getBoardDispatch(f34f0704202202).(game_number);
5032 aGameData = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
5033 }
5034 else
5035 {
5036 aGameData = new GameDatacxx . . $ GameData#GameData(49f6e7a06ebc5aa8).();
5037 }
5038 aGameData->numbercxx . . $ GameData#number. = game_number;
5039 /* Also, we should check for connecting_to_game_number */
5040 p += 2;
5041 // our id?
5042 //0100 0000 0600 2c01 6900 2500 0404 0000 1400 0400 0200 6b61
5043 //1b00 ffff
5044 //0100 0000 0600 8403 8403 8403 0303 0000 1e00 0300 0200
5045 aGameData->handicapcxx . . $ GameData#handicap. = msg[6];
5046 if(msg[7])
5047 aGameData->komicxx . . $ GameData#komi. = -((float)(msg[8])) - 0.5;
5048 else
5049 aGameData->komicxx . . $ GameData#komi. = ((float)(msg[8])) + 0.5;
5050
5051 p += 6; //skip first time?
5052 black_seconds = msg[12] + (msg[13] << 8);
5053 p += 2;
5054 white_seconds = msg[14] + (msg[15] << 8);
5055 p += 2;
5056 black_periods = msg[16];
5057 white_periods = msg[17];
5058 p += 2;
5059 black_in_byoyomi = msg[18];
5060 white_in_byoyomi = msg[19];
5061 if(!black_in_byoyomi)
5062 black_periods = -1; //FIXME, awkward flags
5063 if(!white_in_byoyomi)
5064 white_periods = -1;
5065
5066 p += 2;
5067 aGameData->maintimecxx . . $ GameData#maintime. = black_seconds;
5068 aGameData->periodtimecxx . . $ GameData#periodtime. = msg[20] + (msg[21] << 8);
5069 p += 2;
5070 aGameData->stones_periodscxx . . $ GameData#stones_periods. = msg[22];
5071 switch(msg[23])
5072 {
5073 case 0:
5074 aGameData->timeSystemcxx . . $ GameData#timeSystem. = byoyomicxx . . $ byoyomi.;
5075 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("byoyomi %d %d\n", aGameData->stones_periodscxx . . $ GameData#stones_periods., aGameData->periodtimecxx . . $ GameData#periodtime.);
5076 break;
5077 case 1:
5078 aGameData->timeSystemcxx . . $ GameData#timeSystem. = canadiancxx . . $ canadian.;
5079 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("canadian %d %d\n", aGameData->stones_periodscxx . . $ GameData#stones_periods., aGameData->periodtimecxx . . $ GameData#periodtime.);
5080 break;
5081 case 2:
5082 aGameData->timeSystemcxx . . $ GameData#timeSystem. = tvasiacxx . . $ tvasia.;
5083 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("asia %d %d\n", aGameData->stones_periodscxx . . $ GameData#stones_periods., aGameData->periodtimecxx . . $ GameData#periodtime.);
5084 break;
5085 }
5086 p += 2;
5087 //two names
5088 p += 2;
5089 //0200
5090 //second byte could be board size, but usually 19 for Betting
5091 aGameData->board_sizecxx . . $ GameData#board_size. = 19; //FIXME?!??
5092
5093 if(1)//(add_listing)
5094 {
5095 aGameListing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(game_number);
5096 aGameListing->runningcxx . . $ GameListing#running. = true;
5097 aGameListing->isBettingcxx . . $ GameListing#isBetting. = true;
5098 aGameListing->handicapcxx . . $ GameListing#handicap. = aGameData->handicapcxx . . $ GameData#handicap.;
5099 aGameListing->game_codecxx . . $ GameListing#game_code. = aGameData->numbercxx . . $ GameData#number.; //because broadcast??
5100 aGameListing->komicxx . . $ GameListing#komi. = aGameData->komicxx . . $ GameData#komi.;
5101 strncpy((char *)name, (char *)&(msg[28]), 10);
5102 p += 10;
5103 /* First two names often seem to choke? FIXME, try second two */
5104 /*aGameListing->black = room->getPlayerListing(p[0] + (p[1] << 8));
5105 if(!aGameListing->black)
5106 {*/
5107 //aGameListing->_black_name = QString((char *)name);
5108 aGameListing->_black_namecxx . . $ GameListing#_black_name. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). serverCodeccxx . . $ CyberOroConnection#serverCodec.->toUnicodecxx . . $ QTextCodec#toUnicode(22771b2711c76a3b).((const char *)name, strlen((const char *)name));
5109 /*}
5110 p += 2;*/
5111 strncpy((char *)name, (char *)&(msg[38]), 10);
5112 p += 10;
5113 /*aGameListing->white = room->getPlayerListing(p[0] + (p[1] << 8));
5114 if(!aGameListing->white)
5115 {*/
5116 //aGameListing->_white_name = QString((char *)name);
5117 aGameListing->_white_namecxx . . $ GameListing#_white_name. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). serverCodeccxx . . $ CyberOroConnection#serverCodec.->toUnicodecxx . . $ QTextCodec#toUnicode(22771b2711c76a3b).((const char *)name, strlen((const char *)name));
5118 /*}
5119 p += 2;*/
5120 //two more names, unicode??
5121 strncpy((char *)name, (char *)&(msg[48]), 10);
5122 //aGameListing->_black_name = serverCodec->toUnicode((const char *)name, strlen((const char *)name));
5123 p += 10;
5124 //printf("Othername: %s\n", name);
5125 strncpy((char *)name, (char *)&(msg[58]), 10);
5126 //aGameListing->_white_name = serverCodec->toUnicode((const char *)name, strlen((const char *)name));
5127 p += 10;
5128 //printf("Othername2: %s\n", name);
5129 QStringcxx . . $ QString# country = getCountryFromCodecxx . . $ CyberOroConnection#getCountryFromCode(e76153c3c184c917).(msg[68]);
5130 aGameListing->_black_namecxx . . $ GameListing#_black_name. +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). ("["cxx . . $ QString#QString(85c52e162fed56f9). +cxx . . $ operator+(eab1ea5b6c36e9b2). country[cxx . . $ QString#`operator[]`(57436120916eb52c).0] +cxx . . $ operator+(3d22f08efddf8107). "]");
5131 country =cxx . . $ QString#`operator=`(4f35bf974e7f8568). getCountryFromCodecxx . . $ CyberOroConnection#getCountryFromCode(e76153c3c184c917).(p[1]);
5132 aGameListing->_white_namecxx . . $ GameListing#_white_name. +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). ("["cxx . . $ QString#QString(85c52e162fed56f9). +cxx . . $ operator+(eab1ea5b6c36e9b2). country[cxx . . $ QString#`operator[]`(57436120916eb52c).0] +cxx . . $ operator+(3d22f08efddf8107). "]");
5133 p += 2;
5134 if((msg[70] & 0xC0) == 0xC0)
5135 {
5136 aGameListing->_black_rankcxx . . $ GameListing#_black_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(msg[70] & 0x0f) +cxx . . $ operator+(3d22f08efddf8107). "p";
5137 aGameListing->_black_rank_scorecxx . . $ GameListing#_black_rank_score. = 34000 + ((msg[70] & 0x0f) * 1000);
5138 }
5139 else if((msg[70] & 0xA0) == 0xA0)
5140 {
5141 aGameListing->_black_rankcxx . . $ GameListing#_black_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(msg[70] & 0x0f) +cxx . . $ operator+(3d22f08efddf8107). "d";
5142 aGameListing->_black_rank_scorecxx . . $ GameListing#_black_rank_score. = 25000 + ((msg[70] & 0x0f) * 1000);
5143 }
5144 if((msg[71] & 0xC0) == 0xC0)
5145 {
5146 aGameListing->_white_rankcxx . . $ GameListing#_white_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(msg[71] & 0x0f) +cxx . . $ operator+(3d22f08efddf8107). "p";
5147 aGameListing->_white_rank_scorecxx . . $ GameListing#_white_rank_score. = 34000 + ((msg[71] & 0x0f) * 1000);
5148 }
5149 else if((msg[71] & 0xA0) == 0xA0)
5150 {
5151 aGameListing->_white_rankcxx . . $ GameListing#_white_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(msg[71] & 0x0f) +cxx . . $ operator+(3d22f08efddf8107). "d";
5152 aGameListing->_white_rank_scorecxx . . $ GameListing#_white_rank_score. = 25000 + ((msg[71] & 0x0f) * 1000);
5153 }
5154 #ifdef RE_DEBUG
5155 printf(" %02x%02x%02x%02x\n", msg[70], msg[71], msg[72], msg[73]);
5156 #endif //RE_DEBUG
5157 p += 2;
5158 #ifdef RE_DEBUG
5159 printf("Adding listing for %s vs %s\n",
5160 aGameListing->white_name().toLatin1().constData(),
5161 aGameListing->black_name().toLatin1().constData());
5162 #endif //RE_DEBUG
5163 //aGameListing->game_code = aGameData->game_code;
5164 aGameListing->isRoomOnlycxx . . $ GameListing#isRoomOnly. = false;
5165 room->recvGameListingcxx . . $ Room#recvGameListing(9a447f3b9a8a5041).(aGameListing);
5166 }
5167 else
5168 p += 24;
5169
5170 aGameListing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(game_number);
5171
5172 //recv game record? but what's to receive?
5173 aGameData->black_namecxx . . $ GameData#black_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). aGameListing->black_namecxx . . $ GameListing#black_name(a2fb7a6ce195d51).();
5174 aGameData->white_namecxx . . $ GameData#white_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). aGameListing->white_namecxx . . $ GameListing#white_name(a2fb7a6ce195d51).();
5175 aGameData->black_rankcxx . . $ GameData#black_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). aGameListing->black_rankcxx . . $ GameListing#black_rank(a2fb7a6ce195d51).();
5176 aGameData->white_rankcxx . . $ GameData#white_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). aGameListing->white_rankcxx . . $ GameListing#white_rank(a2fb7a6ce195d51).();
5177
5178 if(joining)
5179 {
5180 boarddispatch->openBoardcxx . . $ BoardDispatch#openBoard(49f6e7a06ebc5aa8).();
5181 boarddispatch->recvTimecxx . . $ BoardDispatch#recvTime(63f8d2dcefae8817).(TimeRecordcxx . . $ TimeRecord#TimeRecord(3e454b8ccf442868).(white_seconds, white_periods), TimeRecordcxx . . $ TimeRecord#TimeRecord(3e454b8ccf442868).(black_seconds, black_periods));
5182
5183 /* We get this upon opening a betting match */
5184 /* And observers: */
5185 if(room_were_incxx . . $ CyberOroConnection#room_were_in. == game_number) //no observing outside
5186 {
5187 #ifdef RE_DEBUG
5188 qDebug("adding observer list to betting match board...");
5189 #endif //RE_DEBUG
5190 addObserverListToBoardcxx . . $ CyberOroConnection#addObserverListToBoard(f9aae4eee533680e).(boarddispatch);
5191 }
5192 }
5193 else
5194 delete newGameData;
5195 }
5196
5197 //ca5d chat rooms also
5198 //this could potentially also be a join room
5199 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleCreateRoomcxx . . $ CyberOroConnection#handleCreateRoom(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
5200 {
5201 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
5202 unsigned char * p = msg;
5203 PlayerListingcxx . . $ PlayerListing# * aPlayer;
5204 unsigned short room_number;
5205 unsigned char room_type;
5206 if(size != 60)
5207 {
5208 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("create room msg of strange size: %d", size);
5209 }
5210 aPlayer = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(msg[0] + (msg[1] << 8));
5211 #ifdef RE_DEBUG
5212 if(aPlayer)
5213 qDebug("player %s %02x%02x chat room/match\n", aPlayer->name.toLatin1().constData(), msg[0], msg[1]);
5214 else
5215 qDebug("can't find player %02x%02x\n", msg[0], msg[1]);
5216 #endif //RE_DEBUG
5217 p += 2;
5218 room_number = msg[2] + (msg[3] << 8);
5219 GameListingcxx . . $ GameListing# * aGameListing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(room_number);
5220 aGameListing->runningcxx . . $ GameListing#running. = true;
5221 aGameListing->owner_idcxx . . $ GameListing#owner_id. = aPlayer->idcxx . . $ PlayerListing#id.;
5222
5223 #ifdef RE_DEBUG
5224 printf("room number on that chat: %d\n", room_number);
5225 #endif //RE_DEBUG
5226 p += 2;
5227 p += 3;
5228 //probably room info
5229 //0000 00
5230 //4011
5231 switch(msg[7])
5232 {
5233 case 0xc0:
5234 break;
5235 case 0x40:
5236 break;
5237 case 0x09:
5238 break;
5239 case 0x00:
5240 aGameListing->_black_namecxx . . $ GameListing#_black_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). "** wished " +cxx . . $ operator+(c75c3ae4eb9af1a8). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(msg[8], 16);
5241 break;
5242 }
5243 room_type = msg[7];
5244 aGameListing->whitecxx . . $ GameListing#white. = aPlayer;
5245
5246 aGameListing->blackcxx . . $ GameListing#black. = 0;
5247 aGameListing->_black_namecxx . . $ GameListing#_black_name. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(room_type, 16);
5248 aGameListing->observerscxx . . $ GameListing#observers. = 1; //the person who created it
5249
5250
5251 aGameListing->isRoomOnlycxx . . $ GameListing#isRoomOnly. = true;
5252 //p[1] here is time and strength wished as per create room code
5253 p += 2;
5254 p += 8;
5255 //a room byte info?
5256 p++;
5257 //title!!
5258
5259 p += 20;
5260 // and lots of zeroes
5261 p += 22;
5262 //if(p != msg + size)
5263 //{
5264 #ifdef RE_DEBUG
5265 //other than 60 ?? FIXME
5266 printf("ca5d: \n");
5267 for(unsigned int i = 0; i < size; i++)
5268 printf("%02x", msg[i]);
5269 printf("\n");
5270 #endif //RE_DEBUG
5271 //}
5272 //review game minminmin 7d
5273 //c901de00 0000 00c0 000000027d60005acdabbadc003b00003cb3a5017d60b65a68b3a501d98bcf7700e0fd7f68b3a5015a88cf770000000000000000
5274 //chat room
5275 //89041401 0000 0040 11000000000000000000000000760000000000000000000000000000000000000000000000000000000000000000000000000000
5276 //chat room
5277 //15008500 0000 0000 11000000000000000000000000b90000000000000000000000000000000000000000000000000000000000000000000000000000
5278 //980d6600 0000 0000 11000000000000000000000000bc0000000000000000000000000000000000000000000000000000000000000000000000000000
5279 //wished normal time even 1k
5280 //74099800 0000 0000 11000000000000000000000000e90000000000000000000000000000000000000000000000000000000000000000000000000000
5281 //wished normal time strong
5282 //b8052301 0000 0000 01000000000000000000000000860000000000000000000000000000000000000000000000000000000000000000000000000000
5283 //wished normal time even
5284 //8d00b100 00000000 11000000000000000000000000dd0000000000000000000000000000000000000000000000000000000000000000000000000000
5285 //wished normal time even
5286 //29093201 00000000 110000000000000000000000008e0000000000000000000000000000000000000000000000000000000000000000000000000000
5287 //74099800 00000000 11000000000000000000000000e90000000000000000000000000000000000000000000000000000000000000000000000000000
5288 //quit playing
5289 //5d0da60000000000 110000000000000000000000005b0000000000000000000000000000000000000000000000000000000000000000000000000000
5290 //locked gomoku? equal standard wished?
5291 //6d0b1201 0000 0009 11000000000000000000000000ed0000000000000000000000000000000000000000000000000000000000000000000000000000
5292
5293 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! gameListingReceivedcxx . . $ NetworkConnection#gameListingReceived(9a447f3b9a8a5041).(aGameListing);
5294
5295 /* Set the attachment right after the game list is recvd */
5296 if(aPlayer)
5297 setAttachedGamecxx . . $ CyberOroConnection#setAttachedGame(b9f1593580940ebc).(aPlayer, aGameListing->numbercxx . . $ GameListing#number.);
5298 }
5299
5300 //56f4
5301 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleBettingMatchResultcxx . . $ CyberOroConnection#handleBettingMatchResult(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
5302 {
5303 unsigned short game_code = msg[0] + (msg[1] << 8);
5304 unsigned short game_id = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
5305 //FIXME
5306 if(size != 16)
5307 {
5308 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("betting match result of strange size %d", size);
5309 }
5310 #ifdef RE_DEBUG
5311 printf("56f4: likely betting match result: %d\n", game_id);
5312 for(unsigned int i = 0; i < size; i++)
5313 printf("%02x", msg[i]);
5314 printf("\n");
5315 #endif //RE_DEBUG
5316
5317
5318 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_id);
5319 if(!boarddispatch)
5320 return;
5321 GameResultcxx . . $ GameResult# aGameResultcxx . . $ GameResult#GameResult(49f6e7a06ebc5aa8).;
5322 //3875020100000000000000000000001c B+R
5323 //35750101332e35000000000000000015 B+3.5 "3.5" //FIXME should convert and double check with what we get
5324 //37750202000000000000000000000015 W+R
5325 if(msg[2] == 0x01)
5326 {
5327 aGameResult.resultcxx . . $ GameResult#result. = GameResultcxx . . $ GameResult#::SCOREcxx . . $ GameResult#SCORE.;
5328 float margin;
5329 sscanf((char *)&(msg[4]), "%f", &margin);
5330 aGameResult.winner_scorecxx . . $ GameResult#winner_score. = margin;
5331 aGameResult.loser_scorecxx . . $ GameResult#loser_score. = 0.0;
5332 }
5333 else if(msg[2] == 0x02)
5334 {
5335 aGameResult.resultcxx . . $ GameResult#result. = GameResultcxx . . $ GameResult#::RESIGNcxx . . $ GameResult#RESIGN.;
5336 }
5337 if(msg[3] == 0x01)
5338 {
5339 aGameResult.winner_colorcxx . . $ GameResult#winner_color. = stoneBlackcxx . . $ stoneBlack.;
5340 }
5341 else if(msg[3] == 0x02)
5342 {
5343 aGameResult.winner_colorcxx . . $ GameResult#winner_color. = stoneWhitecxx . . $ stoneWhite.;
5344 }
5345 //4d75 0202 302e 3500 0000 0000 0000 0015
5346 boarddispatch->recvResultcxx . . $ BoardDispatch#recvResult(c72a8b5aed169521).(&aGameResult);
5347
5348 /* Rejoining a betting match that one had already joined after it was over, doesn't pop up the
5349 * result again that I can tell FIXME */
5350
5351 /* Sure they never hang around with the game over thing ? */
5352 //aGameListing->running = false;
5353 //room->recvGameListing(aGameListing);
5354 //game_code_to_number.erase(game_id);
5355 }
5356
5357 //5ac3
5358 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleGamePhaseUpdatecxx . . $ CyberOroConnection#handleGamePhaseUpdate(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
5359 {
5360 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
5361 unsigned char * p = msg;
5362 GameListingcxx . . $ GameListing# * aGameListing;
5363
5364 if(size != 4)
5365 {
5366 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("GamePhaseUpdate of strange size: %d", size);
5367 return;
5368 }
5369 #ifdef RE_DEBUG
5370 printf("5ac3: %d fl %02x ", p[0] + (p[1] << 8), p[2]);
5371 for(unsigned int i = 0; i < 4; i++)
5372 printf("%02x", p[i]);
5373 printf("\n");
5374 #endif //RE_DEBUG
5375 // maybe first byte is game number?, and then update?
5376 /* I'm going to pretend these are game phase status messages */
5377 aGameListing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(p[0] + (p[1] << 8));
5378 aGameListing->movescxx . . $ GameListing#moves. = getPhasecxx . . $ CyberOroConnection#getPhase(b27dbea426b7b93).(p[2]);
5379 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! gameListingReceivedcxx . . $ NetworkConnection#gameListingReceived(9a447f3b9a8a5041).(aGameListing);
5380 }
5381
5382 //50c3
5383 #ifdef RE_DEBUG
5384 void CyberOroConnection::handleMsg3(unsigned char * msg, unsigned int size)
5385 #else
5386 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleMsg3cxx . . $ CyberOroConnection#handleMsg3(e1e8b00c42c42532).(unsigned char * /*msg*/, unsigned int size)
5387 #endif //RE_DEBUG
5388 {
5389 //FIXME better name, what was this again?
5390 // maybe its the timer msg
5391
5392 if(size != 6)
5393 {
5394 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("50c3 of strange size: %d", size);
5395 }
5396 #ifdef RE_DEBUG
5397 unsigned char * p = msg;
5398 printf("**** 50c3: ");
5399 for(unsigned int i = 0; i < 4; i++)
5400 printf("%02x", p[i]);
5401 printf("\n");
5402 #endif //RE_DEBUG
5403 }
5404
5405 /* Maybe this is nigiri but it seems sent by other people's games
5406 * as well at strange times, I guess just setting colors */
5407 //f5af
5408 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleNigiricxx . . $ CyberOroConnection#handleNigiri(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
5409 {
5410 unsigned char * p = msg;
5411 unsigned char thebyte;
5412 //unsigned short game_code = msg[0] + (msg[1] << 8);
5413 unsigned short room_number = msg[2] + (msg[3] << 8);
5414 QStringcxx . . $ QString# namecxx . . $ QString#QString(ced63f7c635d850d)., rankcxx . . $ QString#QString(ced63f7c635d850d)., our_rankcxx . . $ QString#QString(ced63f7c635d850d).;
5415 GameDatacxx . . $ GameData# * gr;
5416
5417 if(size != 8)
5418 {
5419 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Nigiri message of strange size: %d\n", size);
5420 }
5421
5422 p += 4;
5423 thebyte = p[0];
5424 /* Its also possible that we'd need to do this on games that
5425 * we joined. Its even possible that this is sent all
5426 * the time for games that just started */
5427 if(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->isOurGamecxx . . $ MatchNegotiationState#isOurGame(3c978dac0e5ee2ad).(room_number))
5428 {
5429 if(we_send_nigiricxx . . $ CyberOroConnection#we_send_nigiri.) //ignore
5430 return;
5431 //QMessageBox::information(0 , tr("receiving niri"), tr("receiving ") + QString::number(thebyte, 16) + tr(" nigiri ") + QString::number(p[3], 16));
5432 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_number);
5433 if(!boarddispatch)
5434 {
5435 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("handlenigiri but no board dispatch");
5436 return;
5437 }
5438 /* "our game being played" That's got to be the worst
5439 * variable name in the history of the universe.
5440 * even "our match in progress" would be slightly better.
5441 * Or "number of current game", "currently played game number"... */
5442
5443 /* We need to start the timers here I think */
5444 gr = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
5445
5446 /* FIXME its a BIG deal if you send a move before nigiri is
5447 * fully negotiated. The move is ignored, opponent can't play
5448 * and we can't send the move again because we're waiting for it.
5449 * we need to either not set the colors or the turn or block
5450 * the start of the game or something until nigiri is
5451 * fully negotiated.
5452 * double FIXME I don't think it has anything to do with this,
5453 * we're not doing the nigiri right */
5454
5455 /* There's some other kind of problem here related to the swap.
5456 * for instance even if they get black we don't display their move
5457 * for some reason. And then sometimes we send resigns
5458 * that look different. I think... maybe the listing is over
5459 * writing the colors later or something, I just added something
5460 * to maybe fix that. */
5461
5462 /* this stuff lets us play only if opponent is black and we're white
5463 * but then it gets the resign messages flipped.
5464 * if we're black, then the resign messages are okay but we can't play */
5465 /* send nigiri fails if they play black in that we don't see their
5466 * black move and can't play ourself, names seem correct,
5467 * if we resign as that white, we get a message with (B) and opponent
5468 * thinks that white has one by resignation. */
5469 /* This is so critical but I have no idea what's wrong with it.
5470 * that (B) has to be set that way, basically by handleResign
5471 * which means that the gr->white_name, etc., are wrong, I just
5472 * don't know why this wouldn't be reflected in the score board
5473 * I consider randomly that maybe I forgot and have two copies
5474 * of the gameData running around, still not sure on that but
5475 * it looks clean.
5476 * What's really weird is that the sendResign doesn't have a
5477 * color byte, and yet the official client interprets it nonsensically
5478 * which either means it does have a color byte or we're confusing
5479 * the official client, but this is even when we handle the
5480 * nigiri ! We have nothing we can do to screw it up... maybe
5481 * the accept Match offer... maybe... but that's hard to believe
5482 * I guess that's the only other option.*/
5483 //if((thebyte % 2) == 0)
5484 /* I'm thinking that we always get the one meant
5485 * for us... that the server adds 1 or something
5486 * to tailor it for us */
5487 //if(((((thebyte & 0xe0) >> 5) + 1) % 2) == ((thebyte & 0x1f) % 2))
5488 //if((!(thebyte & 0x20)) == ((thebyte & 0x1f) % 2))
5489 if(!(thebyte & 0x80))
5490 {
5491 #ifdef RE_DEBUG
5492 qDebug("opponent nigiri successful");
5493 #endif //RE_DEBUG
5494 boarddispatch->recvKibitzcxx . . $ BoardDispatch#recvKibitz(3458fe3960d5051).(QStringcxx . . $ QString#QString(ced63f7c635d850d).(), "Opponent plays black"cxx . . $ QString#QString(85c52e162fed56f9).);
5495 if(gr->black_namecxx . . $ GameData#black_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).())
5496 boarddispatch->swapColorscxx . . $ BoardDispatch#swapColors(b45ddcbc8423892c).();
5497 else
5498 boarddispatch->swapColorscxx . . $ BoardDispatch#swapColors(b45ddcbc8423892c).(true);
5499 }
5500 else
5501 {
5502 #ifdef RE_DEBUG
5503 qDebug("opponent nigiri failure");
5504 #endif //RE_DEBUG
5505 boarddispatch->recvKibitzcxx . . $ BoardDispatch#recvKibitz(3458fe3960d5051).(QStringcxx . . $ QString#QString(ced63f7c635d850d).(), "Opponent plays white"cxx . . $ QString#QString(85c52e162fed56f9).);
5506 if(gr->white_namecxx . . $ GameData#white_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).())
5507 boarddispatch->swapColorscxx . . $ BoardDispatch#swapColors(b45ddcbc8423892c).();
5508 else
5509 boarddispatch->swapColorscxx . . $ BoardDispatch#swapColors(b45ddcbc8423892c).(true);
5510 }
5511 gr = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).(); //get again
5512 /* FIXME Don't think we start until second move */
5513 startMatchTimerscxx . . $ CyberOroConnection#startMatchTimers(b45ddcbc8423892c).(gr->black_namecxx . . $ GameData#black_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).());
5514 }
5515 else
5516 {
5517 /* We get these a lot on other games and I think they
5518 * may be part of starting a match... like we should
5519 * check the owner and swap the colors if that's an issue
5520 * FIXME */
5521 }
5522 #ifdef RE_DEBUG
5523 printf("0xf5af: ");
5524 for(unsigned int i = 0; i < size; i++)
5525 printf("%02x", msg[i]);
5526 printf("\n");
5527 #endif //RE_DEBUG
5528 }
5529
5530 /* This comes before we've gotten the ids */
5531 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleFriendscxx . . $ CyberOroConnection#handleFriends(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
5532 {
5533 unsigned short friend_records;
5534 unsigned char * p = msg;
5535 unsigned char name[11];
5536 unsigned int i;
5537
5538 friend_records = p[0] + (p[1] << 8);
5539 p += 2;
5540 //check msg size???! FIXME
5541 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("handleFriends %d %d", friend_records, size); //4 520 suggests (4 * 12) + 2 + 470
5542 for(i = 0; i < friend_records; i++)
5543 {
5544 //name padded to 10, plus two bytes for flags
5545 strncpy((char *)name, (char *)p, 10);
5546 p += 10;
5547 #ifdef RE_DEBUG
5548 printf("friend or foe? %s, %02x%02x", name, p[0], p[1]);
5549 #endif //RE_DEBUG
5550 //first byte is 01, they're probably friend
5551 //first byte is 02, probably block
5552 if(p[0] == 0x01)
5553 friendedListcxx . . $ NetworkConnection#friendedList..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(new FriendWatchListingcxx . . $ FriendWatchListing#FriendWatchListing(4e51b35ce1bea96b).(QStringcxx . . $ QString#QString(85c52e162fed56f9).((const char *)name), friendwatch_notify_defaultcxx . . $ NetworkConnection#friendwatch_notify_default.));
5554 else if(p[0] == 0x02)
5555 blockedListcxx . . $ NetworkConnection#blockedList..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(new FriendWatchListingcxx . . $ FriendWatchListing#FriendWatchListing(4e51b35ce1bea96b).(QStringcxx . . $ QString#QString(85c52e162fed56f9).((const char *)name), friendwatch_notify_defaultcxx . . $ NetworkConnection#friendwatch_notify_default.));
5556 p += 2;
5557 }
5558 //the rest is a mystery for right now
5559 #ifdef RE_DEBUG
5560 printf("0x8129: ");
5561 for(i = 0; i < size; i++)
5562 printf("%02x", msg[i]);
5563 printf("\n");
5564 #endif //RE_DEBUG
5565 }
5566
5567 /* We think this is the last, always the last of the connection lists
5568 * so we might want to clear the playerlist_inorder vector here,
5569 * if that's okay? Otherwise on connect is fine too. */
5570 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleMsg2cxx . . $ CyberOroConnection#handleMsg2(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
5571 {
5572 unsigned char * p = msg;
5573 int records = p[0] + (p[1] << 8);
5574 p += 2;
5575 #ifdef RE_DEBUG
5576 printf("Its msg2: e461\n");
5577 #endif //RE_DEBUG
5578 playerlist_inordercxx . . $ CyberOroConnection#playerlist_inorder..clearcxx . . $ std/vector#clear(ced63f7c635d850d).(); //hopefully this is a good place
5579 //each record is 18 bytes;
5580 while(records--)
5581 {
5582 #ifdef RE_DEBUG
5583 for(unsigned int i = 0; i < 18; i++)
5584 printf("%02x", p[i]);
5585 printf("\n");
5586 #endif //RE_DEBUG
5587 p += 18;
5588 }
5589 if(p != (msg + size))
5590 printf("Weird msg length: %d at line %d\n", size, __LINE__);
5591 }
5592
5593 //0x69c3:
5594 #ifdef RE_DEBUG
5595 void CyberOroConnection::handleRematchRequest(unsigned char * msg, unsigned int size)
5596 #else
5597 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleRematchRequestcxx . . $ CyberOroConnection#handleRematchRequest(e1e8b00c42c42532).(unsigned char * /*msg*/, unsigned int size)
5598 #endif //RE_DEBUG
5599 {
5600 /* In ORO win client this actually looks just like a matchinvite */
5601 if(size != 6)
5602 {
5603 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Rematch request of strange size: %d", size);
5604 return;
5605 }
5606 if(!room_were_incxx . . $ CyberOroConnection#room_were_in.)
5607 {
5608 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Got rematch request, but not in a room");
5609 return;
5610 }
5611 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_were_incxx . . $ CyberOroConnection#room_were_in.);
5612 if(!boarddispatch)
5613 {
5614 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Couldn't get board dispatch on room were in: %d", room_were_incxx . . $ CyberOroConnection#room_were_in.);
5615 return;
5616 }
5617 boarddispatch->recvRematchRequestcxx . . $ BoardDispatch#recvRematchRequest(49f6e7a06ebc5aa8).();
5618
5619 /* FIXME, we'll need to send the request and get the accept and
5620 * see what comes next... */
5621 //their id, our id, two more bytes
5622 #ifdef RE_DEBUG
5623 printf("rematch request: 69c3: ");
5624 for(unsigned int i = 0; i < size; i++)
5625 printf("%02x", msg[i]);
5626 printf("\n");
5627 #endif //RE_DEBUG
5628 }
5629
5630 //0x6ec3:
5631 #ifdef RE_DEBUG
5632 void CyberOroConnection::handleRematchAccept(unsigned char * msg, unsigned int size)
5633 #else
5634 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleRematchAcceptcxx . . $ CyberOroConnection#handleRematchAccept(e1e8b00c42c42532).(unsigned char * /*msg*/, unsigned int size)
5635 #endif //RE_DEBUG
5636 {
5637 bool were_black;
5638 if(size != 6)
5639 {
5640 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("rematch accept packet with strange size: %d", size);
5641 return;
5642 }
5643 /* FIXME, we'll need to send the request and get the accept and
5644 * see what comes next... */
5645 //their id, our id, two more bytes
5646 #ifdef RE_DEBUG
5647 printf("rematch request accept: 6ec3: ");
5648 for(int i = 0; i < (int)size; i++)
5649 printf("%02x", msg[i]);
5650 printf("\n");
5651 #endif //RE_DEBUG
5652 //610a a804 128f
5653 //we need to check our_player_id against first two bytes
5654 if(!room_were_incxx . . $ CyberOroConnection#room_were_in.)
5655 {
5656 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Not in a room for rematch accept");
5657 return;
5658 }
5659 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_were_incxx . . $ CyberOroConnection#room_were_in.);
5660 if(!boarddispatch)
5661 {
5662 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("handle rematch accept has no board dispatch");
5663 return;
5664 }
5665 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->sentRematchcxx . . $ MatchNegotiationState#sentRematch(c9857a73d68e59ba).())
5666 return;
5667
5668 MatchRequestcxx . . $ MatchRequest# * m = new MatchRequestcxx . . $ MatchRequest#();
5669 GameDatacxx . . $ GameData# * gd = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
5670 m->numbercxx . . $ MatchRequest#number. = room_were_incxx . . $ CyberOroConnection#room_were_in.;
5671 m->last_game_codecxx . . $ MatchRequest#last_game_code. = gd->game_codecxx . . $ GameData#game_code.;
5672 m->rematchcxx . . $ MatchRequest#rematch. = true;
5673 m->board_sizecxx . . $ MatchRequest#board_size. = gd->board_sizecxx . . $ GameData#board_size.;
5674 m->komicxx . . $ MatchRequest#komi. = gd->komicxx . . $ GameData#komi.;
5675 m->handicapcxx . . $ MatchRequest#handicap. = gd->handicapcxx . . $ GameData#handicap.;
5676 m->free_ratedcxx . . $ MatchRequest#free_rated. = gd->free_ratedcxx . . $ GameData#free_rated.;
5677 if(m->handicapcxx . . $ MatchRequest#handicap. == 0 && gd->komicxx . . $ GameData#komi. > 0.0)
5678 {
5679 //switch colors?
5680 //yes switch colors, we send the match offer..
5681 if(gd->black_namecxx . . $ GameData#black_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).())
5682 were_black = false;
5683 else
5684 were_black = true;
5685 }
5686 else
5687 were_black = (gd->black_namecxx . . $ GameData#black_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).());
5688 m->opponent_idcxx . . $ MatchRequest#opponent_id. = gd->opponent_idcxx . . $ GameData#opponent_id.;
5689 m->opponent_is_challengercxx . . $ MatchRequest#opponent_is_challenger. = false;
5690 if(were_black)
5691 {
5692 m->opponentcxx . . $ MatchRequest#opponent. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). gd->white_namecxx . . $ GameData#white_name.;
5693 m->their_rankcxx . . $ MatchRequest#their_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). gd->white_rankcxx . . $ GameData#white_rank.;
5694 m->our_namecxx . . $ MatchRequest#our_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). gd->black_namecxx . . $ GameData#black_name.;
5695 m->our_rankcxx . . $ MatchRequest#our_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). gd->black_rankcxx . . $ GameData#black_rank.;
5696 m->color_requestcxx . . $ MatchRequest#color_request. = MatchRequestcxx . . $ MatchRequest#::BLACKcxx . . $ MatchRequest#BLACK.;
5697 m->challenger_is_blackcxx . . $ MatchRequest#challenger_is_black. = false; //?
5698 }
5699 else
5700 {
5701 m->opponentcxx . . $ MatchRequest#opponent. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). gd->black_namecxx . . $ GameData#black_name.;
5702 m->their_rankcxx . . $ MatchRequest#their_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). gd->black_rankcxx . . $ GameData#black_rank.;
5703 m->our_namecxx . . $ MatchRequest#our_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). gd->white_namecxx . . $ GameData#white_name.;
5704 m->our_rankcxx . . $ MatchRequest#our_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). gd->white_rankcxx . . $ GameData#white_rank.;
5705 m->color_requestcxx . . $ MatchRequest#color_request. = MatchRequestcxx . . $ MatchRequest#::WHITEcxx . . $ MatchRequest#WHITE.;
5706 m->challenger_is_blackcxx . . $ MatchRequest#challenger_is_black. = false;
5707 }
5708 m->timeSystemcxx . . $ MatchRequest#timeSystem. = gd->timeSystemcxx . . $ GameData#timeSystem.;
5709 m->maintimecxx . . $ MatchRequest#maintime. = gd->maintimecxx . . $ GameData#maintime.;
5710 m->periodtimecxx . . $ MatchRequest#periodtime. = gd->periodtimecxx . . $ GameData#periodtime.;
5711 m->stones_periodscxx . . $ MatchRequest#stones_periods. = gd->stones_periodscxx . . $ GameData#stones_periods.;
5712
5713 //d2af does this:
5714 //NetworkConnection::closeBoardDispatch(room_were_in); //doesn't close window necessarily
5715
5716
5717 sendMatchOffercxx . . $ CyberOroConnection#sendMatchOffer(9a796e385859106a).(*m, false); //not counter offer
5718 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->offerMatchTermscxx . . $ MatchNegotiationState#offerMatchTerms(969a5d62d7a1bd6e).(m); //is this the right state? FIXME
5719 delete m;
5720
5721 //BoardDispatch * boarddispatch = getBoardDispatch(room_were_in); //should open new game
5722 //this needs also to send something else to trigger whatever
5723 }
5724
5725 /* This is also used during game negotiation, not just rematches */
5726 //0x327d
5727 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleMatchDeclinecxx . . $ CyberOroConnection#handleMatchDecline(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
5728 {
5729 PlayerListingcxx . . $ PlayerListing# * player;
5730 unsigned char * p = msg;
5731
5732 if(size != 6)
5733 {
5734 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("match decline message of strange size %d", size);
5735 }
5736
5737 if(p[0] + (p[1] << 8) != our_player_idcxx . . $ CyberOroConnection#our_player_id.)
5738 {
5739 //qDebug("*** Woah, 327d rematch decline not meant for us!"); //this happens FIXME
5740 return;
5741 }
5742 p += 2;
5743 player = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
5744 p += 2;
5745 // those last two bytes?
5746 #ifdef RE_DEBUG
5747 printf("0x327d: unexplained bytes: %02x %02x\n", p[0], p[1]);
5748 #endif //RE_DEBUG
5749 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->sentMatchOffercxx . . $ MatchNegotiationState#sentMatchOffer(c9857a73d68e59ba).() && !match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->sentRematchcxx . . $ MatchNegotiationState#sentRematch(c9857a73d68e59ba).())
5750 {
5751 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->resetcxx . . $ MatchNegotiationState#reset(49f6e7a06ebc5aa8).();
5752 return;
5753 }
5754 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->verifyPlayercxx . . $ MatchNegotiationState#verifyPlayer(20057ff4c3da74fc).(player))
5755 {
5756 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Bad player from rematch decline");
5757 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->resetcxx . . $ MatchNegotiationState#reset(49f6e7a06ebc5aa8).();
5758 return;
5759 }
5760 GameDialogcxx . . $ GameDialog# * gameDialogDispatch = getIfGameDialogcxx . . $ NetworkConnection#getIfGameDialog(3dcc94127826259).(player);
5761 if(gameDialogDispatch)
5762 {
5763 gameDialogDispatch->recvRefuseMatchcxx . . $ GameDialog#recvRefuseMatch(d4f767463ce0a6b3).(GD_REFUSE_DECLINEcxx . . $ `src/network/networkconnection.h:80:9`!);
5764 }
5765 else
5766 {
5767 QMessageBoxcxx . . $ QMessageBox#::informationcxx . . $ QMessageBox#information(a9e3742e6f7b4147).(0, trcxx . . $ NetworkConnection#tr(75d9f1c324b4579d).("Rematch declined"), trcxx . . $ NetworkConnection#tr(75d9f1c324b4579d).("%1 has declined rematch").argcxx . . $ QString#arg(bc823072288cbbb5).(player->namecxx . . $ PlayerListing#name.));
5768 }
5769 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->resetcxx . . $ MatchNegotiationState#reset(49f6e7a06ebc5aa8).();
5770 #ifdef RE_DEBUG
5771 printf("0x327d: ");
5772 for(int i = 0; i < (int)size; i++)
5773 printf("%02x", msg[i]);
5774 printf("\n");
5775 #endif //RE_DEBUG
5776 }
5777
5778 //b0b3
5779 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleResigncxx . . $ CyberOroConnection#handleResign(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
5780 {
5781 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
5782 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
5783 GameDatacxx . . $ GameData# * gr;
5784 unsigned char * p = msg;
5785 PlayerListingcxx . . $ PlayerListing# * player;
5786 if(size != 8)
5787 {
5788 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Resign message of strange size: %d", size);
5789 return;
5790 }
5791 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
5792 p += 2;
5793 unsigned short game_code = msg[2] + (msg[3] << 8);
5794 unsigned short game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
5795 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
5796 if(boarddispatch)
5797 {
5798 GameResultcxx . . $ GameResult# aGameResultcxx . . $ GameResult#GameResult(49f6e7a06ebc5aa8).;
5799 gr = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
5800 if(!gr)
5801 {
5802 printf("Can't get game record for resign msg\n");
5803 return;
5804 }
5805 aGameResult.resultcxx . . $ GameResult#result. = GameResultcxx . . $ GameResult#::RESIGNcxx . . $ GameResult#RESIGN.;
5806 if(gr->black_namecxx . . $ GameData#black_name. ==cxx . . $ `operator==`(5bc2975d2d751687). player->namecxx . . $ PlayerListing#name.)
5807 {
5808 aGameResult.winner_colorcxx . . $ GameResult#winner_color. = stoneWhitecxx . . $ stoneWhite.;
5809 aGameResult.winner_namecxx . . $ GameResult#winner_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). gr->white_namecxx . . $ GameData#white_name.;
5810 aGameResult.loser_namecxx . . $ GameResult#loser_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). gr->black_namecxx . . $ GameData#black_name.; //necessary FIXME???
5811 }
5812 else
5813 {
5814 aGameResult.winner_colorcxx . . $ GameResult#winner_color. = stoneBlackcxx . . $ stoneBlack.;
5815 aGameResult.winner_namecxx . . $ GameResult#winner_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). gr->black_namecxx . . $ GameData#black_name.;
5816 aGameResult.loser_namecxx . . $ GameResult#loser_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). gr->white_namecxx . . $ GameData#white_name.;
5817 }
5818 boarddispatch->recvResultcxx . . $ BoardDispatch#recvResult(c72a8b5aed169521).(&aGameResult);
5819 if(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->isOurGamecxx . . $ MatchNegotiationState#isOurGame(3c978dac0e5ee2ad).(game_number))
5820 {
5821 killActiveMatchTimerscxx . . $ CyberOroConnection#killActiveMatchTimers(49f6e7a06ebc5aa8).();
5822 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->resetcxx . . $ MatchNegotiationState#reset(49f6e7a06ebc5aa8).();
5823 //FIXME what about rematch? what about other resets?!?!?FIXME
5824 }
5825 }
5826 }
5827
5828 //I think this double as an accept count request
5829 //c9b30c00 c801 ea0c 000000f1
5830 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleEnterScoringcxx . . $ CyberOroConnection#handleEnterScoring(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
5831 {
5832 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
5833 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
5834 PlayerListingcxx . . $ PlayerListing# * player;
5835 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(msg[0] + (msg[1] << 8));
5836
5837 if(size != 8)
5838 {
5839 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Enter scoring message of strange size: %d", size);
5840 }
5841 unsigned short game_code = msg[2] + (msg[3] << 8);
5842 unsigned short game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
5843 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
5844 if(boarddispatch)
5845 {
5846 #ifdef RE_DEBUG
5847 qDebug("Entering scoring mode");
5848 #endif //RE_DEBUG
5849 boarddispatch->recvEnterScoreModecxx . . $ BoardDispatch#recvEnterScoreMode(49f6e7a06ebc5aa8).();
5850 if(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->isOurGamecxx . . $ MatchNegotiationState#isOurGame(3c978dac0e5ee2ad).(game_number))
5851 {
5852 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->enterScoreModecxx . . $ MatchNegotiationState#enterScoreMode(49f6e7a06ebc5aa8).();
5853 deadStonesListcxx . . $ CyberOroConnection#deadStonesList..clearcxx . . $ std/vector#clear(ced63f7c635d850d).();
5854 killActiveMatchTimerscxx . . $ CyberOroConnection#killActiveMatchTimers(49f6e7a06ebc5aa8).();
5855 }
5856 }
5857 }
5858
5859 //FIXME pretty sure this happens too often, like twice in
5860 //a game or something
5861 void CyberOroConnectioncxx . . $ CyberOroConnection#::killActiveMatchTimerscxx . . $ CyberOroConnection#killActiveMatchTimers(49f6e7a06ebc5aa8).(void)
5862 {
5863 #ifdef RE_DEBUG
5864 qDebug("killing timers");
5865 #endif //RE_DEBUG
5866 if(matchRequestKeepAliveTimerIDcxx . . $ CyberOroConnection#matchRequestKeepAliveTimerID.)
5867 {
5868 killTimercxx . . $ QObject#killTimer(d4f767463ce0a6b3).(matchRequestKeepAliveTimerIDcxx . . $ CyberOroConnection#matchRequestKeepAliveTimerID.);
5869 matchRequestKeepAliveTimerIDcxx . . $ CyberOroConnection#matchRequestKeepAliveTimerID. = 0;
5870 }
5871 if(matchKeepAliveTimerIDcxx . . $ CyberOroConnection#matchKeepAliveTimerID.)
5872 {
5873 killTimercxx . . $ QObject#killTimer(d4f767463ce0a6b3).(matchKeepAliveTimerIDcxx . . $ CyberOroConnection#matchKeepAliveTimerID.);
5874 matchKeepAliveTimerIDcxx . . $ CyberOroConnection#matchKeepAliveTimerID. = 0;
5875 }
5876 }
5877
5878 void CyberOroConnectioncxx . . $ CyberOroConnection#::startMatchTimerscxx . . $ CyberOroConnection#startMatchTimers(b45ddcbc8423892c).(bool ourTurn)
5879 {
5880 if(ourTurn)
5881 {
5882 #ifdef RE_DEBUG
5883 qDebug("Starting keep alive timer");
5884 #endif //RE_DEBUG
5885 matchKeepAliveTimerIDcxx . . $ CyberOroConnection#matchKeepAliveTimerID. = startTimercxx . . $ QObject#startTimer(cf5d4a693bb15cf1).(39000);
5886 matchRequestKeepAliveTimerIDcxx . . $ CyberOroConnection#matchRequestKeepAliveTimerID. = 0;
5887 }
5888 else
5889 {
5890 #ifdef RE_DEBUG
5891 qDebug("Starting request keep alive timer");
5892 #endif //RE_DEBUG
5893 matchRequestKeepAliveTimerIDcxx . . $ CyberOroConnection#matchRequestKeepAliveTimerID. = startTimercxx . . $ QObject#startTimer(cf5d4a693bb15cf1).(39000);
5894 matchKeepAliveTimerIDcxx . . $ CyberOroConnection#matchKeepAliveTimerID. = 0;
5895 }
5896 }
5897
5898 /* Final f1b31400 b006 640b 2f05 5c22 0102 1106 0804 1106
5899 * is basically the same thing... plus a couple more bytes...
5900 * makes me think we should write only one handler or something.
5901 * or maybe e7b31400 2f05 640b 2f05 5c6d 0102 1106 0804 1106
5902 * is really the final ?!?!? FIXME */
5903 //e2b31200 2f05 640b 2f05 2863 0201 1106 0804
5904
5905 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleRemoveStonescxx . . $ CyberOroConnection#handleRemoveStones(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
5906 {
5907 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
5908 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
5909 unsigned char * p = msg;
5910 bool unremove;
5911 int number_of_marks;
5912 PlayerListingcxx . . $ PlayerListing# * player;
5913 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(msg[0] + (msg[1] << 8));
5914 p += 2;
5915 unsigned short game_code = msg[2] + (msg[3] << 8);
5916 unsigned short game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
5917 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
5918 if(!boarddispatch)
5919 {
5920 printf("Can't get board dispatch for remove stones for %02x%02x\n", p[0], p[1]);
5921 return;
5922 }
5923 p += 2;
5924 //another player id
5925 p += 2;
5926 #ifdef RE_DEBUG
5927 printf("e2b3: ");
5928 for(unsigned int i = 0; i < size - 6; i++)
5929 printf("%02x", p[i]);
5930 printf("\n");
5931 #endif //RE_DEBUG
5932 //weird two bytes
5933 p += 2;
5934 // a 01 or 02
5935 unremove = (msg[8] == 2);
5936 p++;
5937 number_of_marks = msg[9];
5938 p++;
5939 MoveRecordcxx . . $ MoveRecord# aMovecxx . . $ MoveRecord#MoveRecord(49f6e7a06ebc5aa8).;
5940 aMove.xcxx . . $ MoveRecord#x. = msg[10];
5941 aMove.ycxx . . $ MoveRecord#y. = msg[11];
5942 /* First one is the new one, the rest is the full list */
5943 /* Also, I think if its an unremove, its removed from the list,
5944 * both in this packet and ensuing ones */
5945 //129d 0102 0f09 1310 0f09
5946
5947 /* Instead might be an acknowledge of previous sends. */
5948 //aMove.x = msg[size - 2]; //definitely not right
5949 //aMove.y = msg[size - 1];
5950 if(unremove)
5951 {
5952 aMove.flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::UNREMOVE_AREAcxx . . $ MoveRecord#UNREMOVE_AREA.;
5953 if(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->isOurGamecxx . . $ MatchNegotiationState#isOurGame(3c978dac0e5ee2ad).(game_number))
5954 {
5955 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->countingcxx . . $ MatchNegotiationState#counting(c9857a73d68e59ba).())
5956 return;
5957 stdcxx . . $ std/::vectorcxx . . $ std/vector# <MoveRecord>::iteratorcxx . . $ std/vector#iterator# it;
5958 for(it = deadStonesListcxx . . $ CyberOroConnection#deadStonesList..begincxx . . $ std/vector#begin(55a6de06420d4903).(); it != deadStonesListcxx . . $ CyberOroConnection#deadStonesList..endcxx . . $ std/vector#end(55a6de06420d4903).(); it++)
5959 {
5960 if(it->xcxx . . $ MoveRecord#x. == aMove.xcxx . . $ MoveRecord#x. &&
5961 it->ycxx . . $ MoveRecord#y. == aMove.ycxx . . $ MoveRecord#y.)
5962 {
5963 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("removing %d %d from dead stones list", aMove.xcxx . . $ MoveRecord#x., aMove.ycxx . . $ MoveRecord#y.);
5964 deadStonesListcxx . . $ CyberOroConnection#deadStonesList..erasecxx . . $ std/vector#erase(351407f384f345bc).(it);
5965 break;
5966 }
5967 }
5968 }
5969 }
5970 else
5971 {
5972 aMove.flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::REMOVE_AREAcxx . . $ MoveRecord#REMOVE_AREA.;
5973 if(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->isOurGamecxx . . $ MatchNegotiationState#isOurGame(3c978dac0e5ee2ad).(game_number))
5974 {
5975 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->countingcxx . . $ MatchNegotiationState#counting(c9857a73d68e59ba).())
5976 return;
5977 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("pushing %d %d onto dead stones list\n", aMove.xcxx . . $ MoveRecord#x., aMove.ycxx . . $ MoveRecord#y.);
5978 deadStonesListcxx . . $ CyberOroConnection#deadStonesList..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(aMove);
5979 }
5980 }
5981
5982 boarddispatch->recvMovecxx . . $ BoardDispatch#recvMove(d174a3d9cfb0dd75).(&aMove);
5983 /* What about mark undos??? FIXME */
5984 p += 2; //skip the rest
5985 /*
5986 while(number_of_marks--)
5987 {
5988 MoveRecord aMove;
5989 aMove.flags = MoveRecord::REMOVE;
5990 aMove.x = p[0];
5991 aMove.y = p[1];
5992 p += 2;
5993 boarddispatch->recvMove(&aMove);
5994 }
5995 */
5996 }
5997
5998 //f1b3
5999 /* This is definitely like an opponent has hit done kind of
6000 * msg, not that that means anything to us until we hit done */
6001 #ifdef RE_DEBUG
6002 void CyberOroConnection::handleStonesDone(unsigned char * msg, unsigned int size)
6003 #else
6004 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleStonesDonecxx . . $ CyberOroConnection#handleStonesDone(e1e8b00c42c42532).(unsigned char * msg, unsigned int /*size*/)
6005 #endif //RE_DEBUG
6006 {
6007 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
6008 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
6009 unsigned char * p = msg;
6010 int number_of_marks;
6011 PlayerListingcxx . . $ PlayerListing# * player;
6012 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
6013 p += 2;
6014 unsigned short game_code = p[0] + (p[1] << 8);
6015 unsigned short game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
6016 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
6017 if(!boarddispatch)
6018 {
6019 printf("Can't get board dispatch for remove stones for %02x%02x\n", p[0], p[1]);
6020 return;
6021 }
6022 p += 2;
6023 //another player id
6024 p += 2;
6025 #ifdef RE_DEBUG
6026 printf("0xf1b3: ");
6027 for(unsigned int i = 0; i < size; i++)
6028 printf("%02x", msg[i]);
6029 printf("\n");
6030 #endif //RE_DEBUG
6031 //weird two bytes
6032 if(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->isOurGamecxx . . $ MatchNegotiationState#isOurGame(3c978dac0e5ee2ad).(game_number))
6033 {
6034 unsigned short done_response = p[0] + (p[1] << 8);
6035
6036 if(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->sentDoneCountingcxx . . $ MatchNegotiationState#sentDoneCounting(c9857a73d68e59ba).())
6037 {
6038 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->verifyCountDoneMessagecxx . . $ MatchNegotiationState#verifyCountDoneMessage(3c978dac0e5ee2ad).(done_response))
6039 {
6040 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Count done fail!!\n");
6041 //FIXME
6042 }
6043 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->setDoneCountingcxx . . $ MatchNegotiationState#setDoneCounting(49f6e7a06ebc5aa8).();
6044 }
6045 else
6046 {
6047 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->setCountingVerificationcxx . . $ MatchNegotiationState#setCountingVerification(ed53e3bbd3fa2f69).(done_response);
6048 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->receiveDoneCountingcxx . . $ MatchNegotiationState#receiveDoneCounting(49f6e7a06ebc5aa8).();
6049 }
6050 }
6051 p += 2;
6052 // a 01 or 02
6053 p++;
6054 number_of_marks = p[0];
6055 p++;
6056 /* First one is the new one, the rest is the full list */
6057 MoveRecordcxx . . $ MoveRecord# aMovecxx . . $ MoveRecord#MoveRecord(49f6e7a06ebc5aa8).;
6058 aMove.flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::REMOVEcxx . . $ MoveRecord#REMOVE.;
6059 aMove.xcxx . . $ MoveRecord#x. = p[0];
6060 aMove.ycxx . . $ MoveRecord#y. = p[1];
6061 boarddispatch->recvKibitzcxx . . $ BoardDispatch#recvKibitz(3458fe3960d5051).(QStringcxx . . $ QString#QString(ced63f7c635d850d).(), QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1 has hit done...").argcxx . . $ QString#arg(bc823072288cbbb5).(player->namecxx . . $ PlayerListing#name.));
6062 //boarddispatch->recvMove(&aMove);
6063 /* What about mark undos??? FIXME */
6064 p += 2; //skip the rest
6065
6066 /* FIXME, we might actually want to just clear and readd all the stones
6067 * listed. I mean otherwise we're sort of negating the point of
6068 * the done message */
6069 /*
6070 while(number_of_marks--)
6071 {
6072 MoveRecord aMove;
6073 aMove.flags = MoveRecord::REMOVE;
6074 aMove.x = p[0];
6075 aMove.y = p[1];
6076 p += 2;
6077 boarddispatch->recvMove(&aMove);
6078 }
6079 */
6080 }
6081
6082 //e7b3
6083 #ifdef RE_DEBUG
6084 void CyberOroConnection::handleScore(unsigned char * msg, unsigned int size)
6085 #else
6086 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleScorecxx . . $ CyberOroConnection#handleScore(e1e8b00c42c42532).(unsigned char * msg, unsigned int /*size*/)
6087 #endif //RE_DEBUG
6088 {
6089 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
6090 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
6091 unsigned char * p = msg;
6092 unsigned short game_id, game_code;
6093 int number_of_marks;
6094 PlayerListingcxx . . $ PlayerListing# * player;
6095 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
6096 p += 2;
6097 game_code = p[0] + (p[1] << 8);
6098 game_id = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
6099 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_id);
6100 if(!boarddispatch)
6101 {
6102 printf("Can't get board dispatch for remove stones for %02x%02x\n", p[0], p[1]);
6103 return;
6104 }
6105 p += 2;
6106 //another player id
6107 p += 2;
6108 #ifdef RE_DEBUG
6109 printf("e7b3: ");
6110 for(unsigned int i = 0; i < size - 6; i++)
6111 printf("%02x", msg[i]);
6112 printf("\n");
6113 #endif //RE_DEBUG
6114 //weird two bytes
6115 p += 2;
6116 // a 01 or 02
6117 p++;
6118 number_of_marks = p[0];
6119 p++;
6120
6121 if(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->isOurGamecxx . . $ MatchNegotiationState#isOurGame(3c978dac0e5ee2ad).(game_id))
6122 {
6123 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->doneCountingcxx . . $ MatchNegotiationState#doneCounting(c9857a73d68e59ba).())
6124 {
6125 printf("Not done counting and e7b3\n");
6126 return;
6127 }
6128 }
6129
6130 /* First one is the new one, the rest is the full list */
6131 MoveRecordcxx . . $ MoveRecord# aMovecxx . . $ MoveRecord#MoveRecord(49f6e7a06ebc5aa8).;
6132 aMove.flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::REMOVEcxx . . $ MoveRecord#REMOVE.;
6133 aMove.xcxx . . $ MoveRecord#x. = p[0];
6134 aMove.ycxx . . $ MoveRecord#y. = p[1];
6135 //boarddispatch->recvMove(&aMove);
6136 /* What about mark undos??? FIXME */
6137 p += 2; //skip the rest
6138 /*
6139 while(number_of_marks--)
6140 {
6141 MoveRecord aMove;
6142 aMove.flags = MoveRecord::REMOVE;
6143 aMove.x = p[0];
6144 aMove.y = p[1];
6145 p += 2;
6146 boarddispatch->recvMove(&aMove);
6147 }
6148 */
6149 boarddispatch->recvResultcxx . . $ BoardDispatch#recvResult(c72a8b5aed169521).(0);
6150 #ifdef OLD
6151 //double check, this appropriate here? FIXME, we need a func for it
6152 GameListing * aGameListing = room->getGameListing(game_id);
6153 if(aGameListing)
6154 {
6155 //FIXME I doubt it
6156 //aGameListing->running = false;
6157 //room->recvGameListing(aGameListing);
6158 our_game_being_played = 0;
6159
6160 }
6161 #endif //OLD
6162 }
6163
6164 //c4b3
6165 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleRequestCountcxx . . $ CyberOroConnection#handleRequestCount(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
6166 {
6167 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
6168 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
6169 unsigned char * p = msg;
6170 PlayerListingcxx . . $ PlayerListing# * player;
6171 unsigned short game_code, game_number;
6172
6173 if(size != 8)
6174 {
6175 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Request count msg of strange size: %d", size); //should be 12 - 4
6176 }
6177
6178 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(msg[0] + (msg[1] << 8));
6179 p += 2;
6180 game_code = msg[2] + (msg[3] << 8);
6181 game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
6182
6183 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
6184 if(!boarddispatch)
6185 {
6186 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Request count: No board dispatch for %02x%02x %d", msg[2], msg[3], game_number);
6187 return;
6188 }
6189 p += 2;
6190
6191 killActiveMatchTimerscxx . . $ CyberOroConnection#killActiveMatchTimers(49f6e7a06ebc5aa8).();
6192 boarddispatch->recvRequestCountcxx . . $ BoardDispatch#recvRequestCount(49f6e7a06ebc5aa8).();
6193
6194 #ifdef RE_DEBUG
6195 printf("0x request count?: c4b3: ");
6196 for(int i = 0; i < (int)size; i++)
6197 printf("%02x", msg[i]);
6198 printf("\n");
6199 #endif //RE_DEBUG
6200 }
6201
6202 //ceb3
6203 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleRejectCountRequestcxx . . $ CyberOroConnection#handleRejectCountRequest(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
6204 {
6205 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
6206 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
6207 unsigned char * p = msg;
6208 PlayerListingcxx . . $ PlayerListing# * player;
6209 unsigned short game_code, game_number;
6210
6211 if(size != 8)
6212 {
6213 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Request count msg of strange size: %d", size); //should be 12 - 4
6214 }
6215
6216 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(msg[0] + (msg[1] << 8));
6217 p += 2;
6218 game_code = msg[2] + (p[3] << 8);
6219 game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
6220
6221 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
6222 if(!boarddispatch)
6223 {
6224 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("No board dispatch for %02x%02x", msg[2], msg[3]);
6225 return;
6226 }
6227 p += 2;
6228
6229 boarddispatch->recvRejectCountRequestcxx . . $ BoardDispatch#recvRejectCountRequest(49f6e7a06ebc5aa8).();
6230
6231 #ifdef RE_DEBUG
6232 printf("0x reject request count?: ceb3: ");
6233 for(int i = 0; i < (int)size; i++)
6234 printf("%02x", msg[i]);
6235 printf("\n");
6236 #endif //RE_DEBUG
6237 GameDatacxx . . $ GameData# * gr = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
6238 startMatchTimerscxx . . $ CyberOroConnection#startMatchTimers(b45ddcbc8423892c).(boarddispatch->getBlackTurncxx . . $ BoardDispatch#getBlackTurn(c9857a73d68e59ba).() ? (gr->black_namecxx . . $ GameData#black_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).()) : (gr->white_namecxx . . $ GameData#white_name. ==cxx . . $ `operator==`(5bc2975d2d751687). getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).()));
6239 }
6240
6241 //05b4
6242 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleRequestMatchModecxx . . $ CyberOroConnection#handleRequestMatchMode(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
6243 {
6244 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
6245 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
6246 PlayerListingcxx . . $ PlayerListing# * player;
6247 unsigned short game_code, game_number;
6248 if(size != 8)
6249 {
6250 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Request match mode msg of strange size: %d", size);
6251 }
6252
6253 //4503 d802 0000 007c
6254 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(msg[0] + (msg[1] << 8));
6255 game_code = msg[2] + (msg[3] << 8);
6256 game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
6257
6258 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
6259 if(!boarddispatch)
6260 {
6261 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("No board dispatch for %02x%02x", msg[2], msg[3]);
6262 return;
6263 }
6264
6265 killActiveMatchTimerscxx . . $ CyberOroConnection#killActiveMatchTimers(49f6e7a06ebc5aa8).(); //okay? what about cheating issues?? FIXME
6266 boarddispatch->recvRequestMatchModecxx . . $ BoardDispatch#recvRequestMatchMode(49f6e7a06ebc5aa8).();
6267
6268 #ifdef RE_DEBUG
6269 printf("0x request match mode?: 05b4: ");
6270 for(int i = 0; i < (int)size; i++)
6271 printf("%02x", msg[i]);
6272 printf("\n");
6273 #endif //RE_DEBUG
6274 }
6275
6276 //0ab4
6277 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleRejectMatchModeRequestcxx . . $ CyberOroConnection#handleRejectMatchModeRequest(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
6278 {
6279 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
6280 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
6281 unsigned char * p = msg;
6282 PlayerListingcxx . . $ PlayerListing# * player;
6283 unsigned short game_code, game_number;
6284 if(size != 8)
6285 {
6286 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Request match mode msg of strange size: %d", size);
6287 }
6288
6289 //4503 d802 0000 007c
6290 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
6291 p += 2;
6292 game_code = msg[2] + (msg[3] << 8);
6293 game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
6294
6295 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
6296 if(!boarddispatch)
6297 {
6298 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("No board dispatch for %02x%02x", msg[2], msg[3]);
6299 return;
6300 }
6301 p += 2;
6302
6303 boarddispatch->recvRejectMatchModeRequestcxx . . $ BoardDispatch#recvRejectMatchModeRequest(49f6e7a06ebc5aa8).();
6304
6305 #ifdef RE_DEBUG
6306 printf("0x decline request match mode?: 0ab4: ");
6307 for(int i = 0; i < (int)size; i++)
6308 printf("%02x", msg[i]);
6309 printf("\n");
6310 #endif //RE_DEBUG
6311 }
6312
6313 //f6b3
6314 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleTimeLosscxx . . $ CyberOroConnection#handleTimeLoss(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
6315 {
6316 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
6317 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
6318 unsigned char * p = msg;
6319 PlayerListingcxx . . $ PlayerListing# * player;
6320 unsigned short game_code, game_number;
6321
6322 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("handleTimeLoss size %d", size);
6323
6324 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
6325 p += 2;
6326 game_code = p[0] + (p[1] << 8);
6327 game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
6328
6329 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
6330 if(!boarddispatch)
6331 {
6332 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("No board dispatch for %02x%02x", p[0], p[1]);
6333 return;
6334 }
6335 p += 2;
6336 GameDatacxx . . $ GameData# * aGameData = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
6337
6338 GameResultcxx . . $ GameResult# aGameResultcxx . . $ GameResult#GameResult(49f6e7a06ebc5aa8).;
6339 aGameResult.resultcxx . . $ GameResult#result. = GameResultcxx . . $ GameResult#::TIMEcxx . . $ GameResult#TIME.;
6340 aGameResult.game_numbercxx . . $ GameResult#game_number. = game_number;
6341 aGameResult.loser_namecxx . . $ GameResult#loser_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). player->namecxx . . $ PlayerListing#name.;
6342 if(aGameData->white_namecxx . . $ GameData#white_name. ==cxx . . $ `operator==`(5bc2975d2d751687). player->namecxx . . $ PlayerListing#name.)
6343 {
6344 //winner and loser colors??!?!? FIXME FIXME
6345 aGameResult.winner_namecxx . . $ GameResult#winner_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). aGameData->black_namecxx . . $ GameData#black_name.;
6346 aGameResult.winner_colorcxx . . $ GameResult#winner_color. = stoneBlackcxx . . $ stoneBlack.;
6347 }
6348 else
6349 {
6350 aGameResult.winner_namecxx . . $ GameResult#winner_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). aGameData->white_namecxx . . $ GameData#white_name.;
6351 aGameResult.winner_colorcxx . . $ GameResult#winner_color. = stoneWhitecxx . . $ stoneWhite.;
6352 }
6353 boarddispatch->recvResultcxx . . $ BoardDispatch#recvResult(c72a8b5aed169521).(&aGameResult);
6354 /* Maybe the last 4 bytes are the remaining 1 second of time, maybe
6355 * its color or something?*/
6356 #ifdef RE_DEBUG
6357 printf("f6b3: %02x%02x%02x%02x\n", p[0], p[1], p[2], p[3]);
6358 #endif //RE_DEBUG
6359 /* What about killing the listing or something??*/
6360 }
6361
6362 //dcaf (42f4 goes here as well)
6363 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleMovecxx . . $ CyberOroConnection#handleMove(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
6364 {
6365 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
6366 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
6367 unsigned char * p = msg;
6368 GameDatacxx . . $ GameData# * gr;
6369 PlayerListingcxx . . $ PlayerListing# * player;
6370 int periods;
6371 bool inPeriodTime;
6372 unsigned short seconds;
6373 unsigned short player_id;
6374 unsigned short game_id = p[0] + (p[1] << 8);
6375 unsigned short game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_id];
6376 static bool prev_pass = false;
6377 if(size != 16)
6378 {
6379 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Move of strange size: %d", size);
6380 return;
6381 }
6382 p += 2;
6383 MoveRecordcxx . . $ MoveRecord# * aMove = new MoveRecordcxx . . $ MoveRecord#();
6384 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
6385 if(!boarddispatch)
6386 {
6387 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("No board dispatch for %02x%02x", p[0], p[1]);
6388 return;
6389 }
6390 gr = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
6391 if(!gr)
6392 {
6393 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Shouldn't be a boarddispatch here\n");
6394 return;
6395 }
6396 player_id = p[0] + (p[1] << 8);
6397 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(player_id);
6398 /* I get the feeling there's a bug around here FIXME */
6399 #ifdef RE_DEBUG
6400 printf("Move!!!: %02x%02x %02x%02x %02x%02x", p[0], p[1], p[2], p[3], p[4], p[5]);
6401 #endif //RE_DEBUG
6402 p += 2;
6403 p += 2;
6404 aMove->numbercxx . . $ MoveRecord#number. = p[0] + (p[1] << 8);
6405 /* ORO sends move 1 as first move after handicap */
6406 /* FIXME There's something weird here. For some reason
6407 * games we play have to have the first white move after
6408 * handicap (and possibly others) as what ORO sends
6409 * naturally, 1, but observing games, we have to
6410 * decrement all the move numbers by 1. This has
6411 * to have something to do with the move list because
6412 * see we don't see a move list for our own game.
6413 * perhaps if we joined a game before the first
6414 * move, we'd be just as screwed up.*/
6415 //aMove->number--; //because we expected 0 move?
6416 /* Also print out the moves we send after you fix this.
6417 aMove->flags = MoveRecord::NONE;*/
6418
6419 /* Player here is NOT reliable for color, let's try without
6420 * though I think the first two bytes 0101 vs 0000 might be
6421 * a color flag */
6422 /*if(player->name == gr->white_name)
6423 aMove->color = stoneWhite;
6424 else if(player->name == gr->black_name)
6425 aMove->color = stoneBlack;
6426 else
6427 qDebug("no color\n");*/
6428 aMove->colorcxx . . $ MoveRecord#color. = stoneNonecxx . . $ stoneNone.;
6429 p += 2;
6430 #ifdef RE_DEBUG
6431 printf("%d %d \n", p[0], p[1]);
6432 #endif //RE_DEBUG
6433 aMove->xcxx . . $ MoveRecord#x. = p[0];
6434 aMove->ycxx . . $ MoveRecord#y. = p[1];
6435 p += 2;
6436 #ifdef RE_DEBUG
6437 for(unsigned int i = 0; i < 6; i++) //8, 9 or 10?
6438 printf("%02x", p[i]);
6439 printf("\n");
6440 #endif //RE_DEBUG
6441 seconds = p[0] + (p[1] << 8);
6442 //3rd byte is periods remaining, first byte is probably seconds
6443 periods = p[2];
6444 inPeriodTime = p[3];
6445 p += 4;
6446
6447 if(!inPeriodTime)
6448 periods = -1; //for clockdisplay
6449 if(aMove->xcxx . . $ MoveRecord#x. == 0 || aMove->ycxx . . $ MoveRecord#y. == 0)
6450 aMove->flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::PASScxx . . $ MoveRecord#PASS.;
6451 boarddispatch->recvMovecxx . . $ BoardDispatch#recvMove(d174a3d9cfb0dd75).(aMove);
6452 /* FIXME color is not set!! */
6453 if(aMove->colorcxx . . $ MoveRecord#color. == stoneWhitecxx . . $ stoneWhite.)
6454 boarddispatch->recvTimecxx . . $ BoardDispatch#recvTime(63f8d2dcefae8817).(TimeRecordcxx . . $ TimeRecord#TimeRecord(3e454b8ccf442868).(seconds, periods), TimeRecordcxx . . $ TimeRecord#TimeRecord(3e454b8ccf442868).(0, -1));
6455 else
6456 boarddispatch->recvTimecxx . . $ BoardDispatch#recvTime(63f8d2dcefae8817).(TimeRecordcxx . . $ TimeRecord#TimeRecord(3e454b8ccf442868).(0, -1), TimeRecordcxx . . $ TimeRecord#TimeRecord(3e454b8ccf442868).(seconds, periods));
6457
6458
6459
6460 if(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->isOurGamecxx . . $ MatchNegotiationState#isOurGame(3c978dac0e5ee2ad).(game_number))
6461 {
6462 matchKeepAliveTimerIDcxx . . $ CyberOroConnection#matchKeepAliveTimerID. = startTimercxx . . $ QObject#startTimer(cf5d4a693bb15cf1).(39000); //keep alives
6463 if(matchRequestKeepAliveTimerIDcxx . . $ CyberOroConnection#matchRequestKeepAliveTimerID.)
6464 {
6465 killTimercxx . . $ QObject#killTimer(d4f767463ce0a6b3).(matchRequestKeepAliveTimerIDcxx . . $ CyberOroConnection#matchRequestKeepAliveTimerID.);
6466 matchRequestKeepAliveTimerIDcxx . . $ CyberOroConnection#matchRequestKeepAliveTimerID. = 0;
6467 }
6468 // FIXME if this is a pass, and the previous move
6469 // was a pass, then I think we need to sendEnterScoring()
6470 // but maybe only if we passed first and this is opp passing
6471 if(aMove->flagscxx . . $ MoveRecord#flags. == MoveRecordcxx . . $ MoveRecord#::PASScxx . . $ MoveRecord#PASS.)
6472 {
6473 if(prev_pass && player_id != our_player_idcxx . . $ CyberOroConnection#our_player_id.)
6474 sendEnterScoringcxx . . $ CyberOroConnection#sendEnterScoring(cb2f890c2fdad230).(game_id);
6475 prev_pass = true;
6476 }
6477 else
6478 prev_pass = false;
6479 }
6480 delete aMove;
6481 }
6482
6483 //e6af
6484 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleUndocxx . . $ CyberOroConnection#handleUndo(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
6485 {
6486 unsigned char * p = msg;
6487 unsigned short player_id, game_code;
6488
6489 if(size != 10)
6490 {
6491 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("undo of strange size: %d", size);
6492 return;
6493 }
6494
6495 player_id = p[0] + (p[1] << 8);
6496 game_code = p[2] + (p[3] << 8);
6497
6498 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code]);
6499 if(!boarddispatch)
6500 {
6501 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("no board dispatch for undo");
6502 return;
6503 }
6504 PlayerListingcxx . . $ PlayerListing# * player = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(player_id);
6505 p += 4;
6506 p += 2; //color byte
6507 MoveRecordcxx . . $ MoveRecord# * move = new MoveRecordcxx . . $ MoveRecord#();
6508 move->flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::REQUESTUNDOcxx . . $ MoveRecord#REQUESTUNDO.;
6509 move->numbercxx . . $ MoveRecord#number. = p[0] + (p[1] << 8);
6510
6511 //boarddispatch->recvKibitz(0, player->name + QString(" wants undo to move %1.").arg(opp_requests_undo_move_number));
6512
6513 boarddispatch->recvMovecxx . . $ BoardDispatch#recvMove(d174a3d9cfb0dd75).(move);
6514 delete move;
6515 //from sender perspective encode(e)
6516 //e6af 0e00 b50d 4c02 01 00 0a 00 00 00
6517 #ifdef RE_DEBUG
6518 printf("0xe6af undo: ");
6519 for(unsigned int i = 0; i < size; i++)
6520 printf("%02x", msg[i]);
6521 printf("\n");
6522 #endif //RE_DEBUG
6523
6524 }
6525
6526 //0xf0af
6527 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleDeclineUndocxx . . $ CyberOroConnection#handleDeclineUndo(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
6528 {
6529 unsigned short player_id, game_code;
6530 unsigned char * p = msg;
6531
6532 if(size != 10)
6533 {
6534 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("declineundo of strange size: %d", size);
6535 return;
6536 }
6537 player_id = p[0] + (p[1] << 8);
6538 game_code = p[2] + (p[3] << 8);
6539
6540 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code]);
6541 if(!boarddispatch)
6542 {
6543 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("no board dispatch for decline undo");
6544 return;
6545 }
6546 PlayerListingcxx . . $ PlayerListing# * player = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(player_id);
6547
6548 boarddispatch->recvKibitzcxx . . $ BoardDispatch#recvKibitz(3458fe3960d5051).(0cxx . . $ QString#QString(85c52e162fed56f9)., player->namecxx . . $ PlayerListing#name. +cxx . . $ operator+(3d22f08efddf8107). " refused undo.");
6549
6550 #ifdef RE_DEBUG
6551 printf("0xf0af decline undo: ");
6552 for(int i = 0; i < (int)size; i++)
6553 printf("%02x", msg[i]);
6554 printf("\n");
6555 #endif //RE_DEBUG
6556 }
6557
6558 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleAcceptUndocxx . . $ CyberOroConnection#handleAcceptUndo(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
6559 {
6560 unsigned short player_id, game_code;
6561 unsigned char * p = msg;
6562
6563 if(size != 10)
6564 {
6565 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("accept undo msg of strange size: %d", size);
6566 }
6567
6568 player_id = p[0] + (p[1] << 8);
6569 game_code = p[2] + (p[3] << 8);
6570
6571 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code]);
6572 if(!boarddispatch)
6573 {
6574 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("no board dispatch for decline undo");
6575 return;
6576 }
6577 PlayerListingcxx . . $ PlayerListing# * player = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(player_id);
6578 boarddispatch->recvKibitzcxx . . $ BoardDispatch#recvKibitz(3458fe3960d5051).(0cxx . . $ QString#QString(85c52e162fed56f9)., player->namecxx . . $ PlayerListing#name. +cxx . . $ operator+(3d22f08efddf8107). " accepted undo.");
6579
6580 p += 4;
6581 p += 2; //color byte
6582 MoveRecordcxx . . $ MoveRecord# * move = new MoveRecordcxx . . $ MoveRecord#();
6583 move->flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::UNDOcxx . . $ MoveRecord#UNDO.;
6584 move->numbercxx . . $ MoveRecord#number. = p[0] + (p[1] << 8);
6585
6586 //boarddispatch->recvKibitz(0, player->name + QString(" wants undo to move %1.").arg(opp_requests_undo_move_number));
6587
6588 boarddispatch->recvMovecxx . . $ BoardDispatch#recvMove(d174a3d9cfb0dd75).(move);
6589 delete move;
6590
6591 #ifdef RE_DEBUG
6592 printf("0xebaf accept undo: ");
6593 for(int i = 0; i < (int)size; i++)
6594 printf("%02x", msg[i]);
6595 printf("\n");
6596 #endif //RE_DEBUG
6597 }
6598
6599 //0x42f4: 4d75 bd00 0101 ea00 0d08 0200 0101 000b
6600 //0x42f4: 4d75 bd00 0101 ec00 0b02 0300 0101 000b
6601 //0x42f4: 4d75 bd00 0000 ed00 0201 0f00 0101 000b
6602
6603 //same as 4cf4, 4cf4 being for in room?
6604 //d7af
6605 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleMoveListcxx . . $ CyberOroConnection#handleMoveList(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
6606 {
6607 unsigned char * p = msg;
6608 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
6609 int number_of_moves;
6610 int i;
6611 bool pass = false;
6612 bool enterScore = false;
6613 GameDatacxx . . $ GameData# * gr;
6614 MoveRecordcxx . . $ MoveRecord# * aMove = new MoveRecordcxx . . $ MoveRecord#();
6615 unsigned short game_number;
6616 p += 2;
6617 unsigned short game_code = msg[2] + (msg[3] << 8);
6618 game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
6619 p += 2;
6620 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
6621 if(!boarddispatch)
6622 {
6623 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("No board dispatch for %02x%02x", p[0], p[1]);
6624 return;
6625 }
6626 gr = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
6627 /* FIXME This is rather unfortunate as well but until we fix
6628 * qgo_network code's move_counter nonsense, a hold over
6629 * from the old code that I just copied without completely
6630 * replacing, we do need to take this into account. FIXME */
6631
6632 number_of_moves = msg[4] + (msg[5] << 8);
6633 p += 2;
6634 p += 4;
6635 #ifdef RE_DEBUG
6636 printf("Move List!!!! %d\n", number_of_moves);
6637 #endif //RE_DEBUG
6638 //player = room->getPlayerListing(p[0] + (p[1] << 8));
6639 aMove->flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::NONEcxx . . $ MoveRecord#NONE.;
6640 //for(i = (gr->handicap ? 1 : 0) ; i < number_of_moves + (gr->handicap ? 1 : 0); i++)
6641 /* We're sending these starting with 1 because moves after
6642 * we'll be offset in that way. i.e., ORO starts with 1*/
6643 if(gr->handicapcxx . . $ GameData#handicap.)
6644 aMove->colorcxx . . $ MoveRecord#color. = stoneWhitecxx . . $ stoneWhite.;
6645 else
6646 aMove->colorcxx . . $ MoveRecord#color. = stoneBlackcxx . . $ stoneBlack.;
6647 for(i = 1; i < number_of_moves + 1; i++)
6648 {
6649 //aMove->color = stoneNone; //keep resetting this
6650 aMove->numbercxx . . $ MoveRecord#number. = i; //or i + !?
6651 aMove->xcxx . . $ MoveRecord#x. = msg[10 + (2 * (i - 1))];
6652 aMove->ycxx . . $ MoveRecord#y. = msg[11 + (2 * (i - 1))];
6653 #ifdef RE_DEBUG
6654 printf("Move: %d %d\n", msg[10 + (2 * (i - 1))], msg[11 + (2 * (i - 1))]);
6655 #endif //RE_DEBUG
6656 if(aMove->xcxx . . $ MoveRecord#x. == 0)
6657 {
6658 aMove->flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::PASScxx . . $ MoveRecord#PASS.;
6659 if(pass/* && aMove->color == stoneWhite*/) //white passes last
6660 enterScore = true;
6661 pass = true;
6662 }
6663 else
6664 pass = false;
6665 p += 2;
6666 boarddispatch->recvMovecxx . . $ BoardDispatch#recvMove(d174a3d9cfb0dd75).(aMove);
6667 if(aMove->xcxx . . $ MoveRecord#x. == 0)
6668 aMove->flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::NONEcxx . . $ MoveRecord#NONE.; //for next iteration
6669 if(aMove->colorcxx . . $ MoveRecord#color. == stoneWhitecxx . . $ stoneWhite.)
6670 aMove->colorcxx . . $ MoveRecord#color. = stoneBlackcxx . . $ stoneBlack.;
6671 else
6672 aMove->colorcxx . . $ MoveRecord#color. = stoneWhitecxx . . $ stoneWhite.;
6673 }
6674 delete aMove;
6675 if(p != (msg + size))
6676 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Move list with strange size: %d", size); //20
6677 /* We get this if we go back into match mode. Only question is whether if
6678 * we crash during score mode, we get a separate message to enter score mode */
6679 if(enterScore && !match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->isOurGamecxx . . $ MatchNegotiationState#isOurGame(3c978dac0e5ee2ad).(game_number))
6680 {
6681 printf("Enter score mode, not our game\n");
6682 boarddispatch->recvEnterScoreModecxx . . $ BoardDispatch#recvEnterScoreMode(49f6e7a06ebc5aa8).();
6683 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->enterScoreModecxx . . $ MatchNegotiationState#enterScoreMode(49f6e7a06ebc5aa8).();
6684 }
6685 }
6686
6687 //4cf4 4 zeroes different FIXME join
6688 /* I think this is like for dead games or records or something. broadcast at the least
6689 * Broadcast is extremely likely. May also start with that 38f4 betting message */
6690 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleMoveList2cxx . . $ CyberOroConnection#handleMoveList2(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
6691 {
6692 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
6693 unsigned char * p = msg;
6694 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
6695 int number_of_moves;
6696 int i;
6697 unsigned short game_id;
6698 MoveRecordcxx . . $ MoveRecord# * aMove = new MoveRecordcxx . . $ MoveRecord#();
6699
6700 p += 2;
6701 game_id = p[0] + (p[1] << 8);
6702
6703 GameListingcxx . . $ GameListing# * listing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(connecting_to_game_numbercxx . . $ CyberOroConnection#connecting_to_game_number.);
6704 listing->game_codecxx . . $ GameListing#game_code. = game_id;
6705 game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).listing->game_codecxx . . $ GameListing#game_code.] = listing->numbercxx . . $ GameListing#number.;
6706 #ifdef RE_DEBUG
6707 printf("Setting game code to number broadcast %02x%02x %d\n", p[0], p[1], listing->number);
6708 #endif //RE_DEBUG
6709 boarddispatch = getBoardDispatchcxx . . $ NetworkConnection#getBoardDispatch(f34f0704202202).(listing->numbercxx . . $ GameListing#number.);
6710
6711 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! gameListingReceivedcxx . . $ NetworkConnection#gameListingReceived(9a447f3b9a8a5041).(listing);
6712
6713 connecting_to_game_numbercxx . . $ CyberOroConnection#connecting_to_game_number. = 0;
6714
6715 p += 2;
6716
6717
6718 number_of_moves = p[0] + (p[1] << 8);
6719 p += 2;
6720 //p += 4; //doesn't have this !!!
6721 p += 2; //instead
6722 #ifdef RE_DEBUG
6723 printf("Move List Broadcast/Special %d %d!!!!\n", listing->number, listing->game_code);
6724 #endif //RE_DEBUG
6725 //player = room->getPlayerListing(p[0] + (p[1] << 8));
6726 aMove->flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::NONEcxx . . $ MoveRecord#NONE.;
6727 //for(i = (aGameData->handicap ? 1 : 0) ; i < number_of_moves + (aGameData->handicap ? 1 : 0); i++)
6728 for(i = 1; i < number_of_moves + 1; i++)
6729 {
6730
6731 aMove->colorcxx . . $ MoveRecord#color. = stoneNonecxx . . $ stoneNone.; //keep resetting this
6732 aMove->numbercxx . . $ MoveRecord#number. = i; //or i + !?
6733 aMove->xcxx . . $ MoveRecord#x. = p[0];
6734 aMove->ycxx . . $ MoveRecord#y. = p[1];
6735 #ifdef RE_DEBUG
6736 printf("Move: %d %d\n", p[0], p[1]);
6737 #endif //RE_DEBUG
6738 if(aMove->xcxx . . $ MoveRecord#x. == 0)
6739 aMove->flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::PASScxx . . $ MoveRecord#PASS.;
6740 p += 2;
6741 boarddispatch->recvMovecxx . . $ BoardDispatch#recvMove(d174a3d9cfb0dd75).(aMove);
6742 if(aMove->xcxx . . $ MoveRecord#x. == 0)
6743 aMove->flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::NONEcxx . . $ MoveRecord#NONE.; //for next iteration
6744 }
6745 delete aMove;
6746 if(p != (msg + size))
6747 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("MoveList2 strange size: %d", size);
6748 }
6749
6750 // note that we receive response on this, so likely we should
6751 // set ourself, check box there FIXME
6752 //9a65 maybe?!?!? not a result... probably invitation allowed!!!
6753 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleInvitationSettingscxx . . $ CyberOroConnection#handleInvitationSettings(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
6754 {
6755 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
6756 unsigned char * p = msg;
6757 PlayerListingcxx . . $ PlayerListing# * player;
6758
6759 if(size != 8)
6760 {
6761 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Invitation settings msg of strange size %d", size);
6762 }
6763 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
6764 #ifdef RE_DEBUG
6765 printf("%s ", player->name.toLatin1().constData());
6766 for(unsigned int i = 2; i < size; i++)
6767 printf("%02x", p[i]);
6768 printf("\n");
6769 #endif //RE_DEBUG
6770 p += 2;
6771 //3rd byte after name is invitation settings
6772 player->infocxx . . $ PlayerListing#info. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). getStatusFromCodecxx . . $ CyberOroConnection#getStatusFromCode(31cb2f216a834e82).(p[2], playercxx . . $ QString#QString(132dd6869045752b).->rankcxx . . $ PlayerListing#rank.);
6773
6774 }
6775
6776 QStringcxx . . $ QString# CyberOroConnectioncxx . . $ CyberOroConnection#::getStatusFromCodecxx . . $ CyberOroConnection#getStatusFromCode(31cb2f216a834e82).(unsigned char code, QStringcxx . . $ QString# rank)
6777 {
6778 // FIXME
6779 // What we need to do here is have a function (also for use in
6780 // strict game dialog functionality) that checks our
6781 // rank versus the target and adjusts an open flag, just one
6782 // based on that.
6783 // game dialog needed something more specific so
6784 const PlayerListingcxx . . $ PlayerListing# * us = getOurListingcxx . . $ CyberOroConnection#getOurListing(c84291d55c8466c6).();
6785 int ret_val = compareRankscxx . . $ CyberOroConnection#compareRanks(cf8c7f074bbf9512).(uscxx . . $ QString#QString(132dd6869045752b).->rankcxx . . $ PlayerListing#rank., rankcxx . . $ QString#QString(132dd6869045752b).);
6786 switch(code)
6787 {
6788 case ALLOW_ALL_INVITEScxx . . $ `src/network/cyberoroconnection.cpp:49:9`!:
6789 return "O"cxx . . $ QString#QString(85c52e162fed56f9).;
6790 break;
6791 case ALLOW_STRONGER_INVITEcxx . . $ `src/network/cyberoroconnection.cpp:50:9`!:
6792 if(ret_val == 1)
6793 return "O"cxx . . $ QString#QString(85c52e162fed56f9).;
6794 else
6795 return "X"cxx . . $ QString#QString(85c52e162fed56f9).;
6796 break;
6797 case ALLOW_EVEN_INVITEcxx . . $ `src/network/cyberoroconnection.cpp:51:9`!:
6798 if(ret_val == 0)
6799 return "O"cxx . . $ QString#QString(85c52e162fed56f9).;
6800 else
6801 return "X"cxx . . $ QString#QString(85c52e162fed56f9).;
6802 break;
6803 case ALLOW_WEAKER_INVITEcxx . . $ `src/network/cyberoroconnection.cpp:52:9`!:
6804 if(ret_val == -1)
6805 return "O"cxx . . $ QString#QString(85c52e162fed56f9).;
6806 else
6807 return "X"cxx . . $ QString#QString(85c52e162fed56f9).;
6808 break;
6809 case ALLOW_PAIR_INVITEcxx . . $ `src/network/cyberoroconnection.cpp:53:9`!:
6810 break;
6811 case IGNORE_ALL_INVITEScxx . . $ `src/network/cyberoroconnection.cpp:54:9`!:
6812 return "X"cxx . . $ QString#QString(85c52e162fed56f9).;
6813 break;
6814 }
6815 return ""cxx . . $ QString#QString(85c52e162fed56f9).;
6816 }
6817
6818 int CyberOroConnectioncxx . . $ CyberOroConnection#::compareRankscxx . . $ CyberOroConnection#compareRanks(cf8c7f074bbf9512).(QStringcxx . . $ QString# rankA, QStringcxx . . $ QString# rankB)
6819 {
6820 if(rankA.containscxx . . $ QString#contains(8cce4688c16f48f3).("p"cxx . . $ QString#QString(85c52e162fed56f9).) && !rankB.containscxx . . $ QString#contains(8cce4688c16f48f3).("p"cxx . . $ QString#QString(85c52e162fed56f9).))
6821 return 1;
6822 if(rankB.containscxx . . $ QString#contains(8cce4688c16f48f3).("p"cxx . . $ QString#QString(85c52e162fed56f9).) && !rankA.containscxx . . $ QString#contains(8cce4688c16f48f3).("p"cxx . . $ QString#QString(85c52e162fed56f9).))
6823 return -1;
6824 if(rankA.containscxx . . $ QString#contains(8cce4688c16f48f3).("d"cxx . . $ QString#QString(85c52e162fed56f9).) && !rankB.containscxx . . $ QString#contains(8cce4688c16f48f3).("d"cxx . . $ QString#QString(85c52e162fed56f9).))
6825 return 1;
6826 if(rankB.containscxx . . $ QString#contains(8cce4688c16f48f3).("d"cxx . . $ QString#QString(85c52e162fed56f9).) && !rankA.containscxx . . $ QString#contains(8cce4688c16f48f3).("d"cxx . . $ QString#QString(85c52e162fed56f9).))
6827 return -1;
6828 if(rankA.containscxx . . $ QString#contains(8cce4688c16f48f3).("k"cxx . . $ QString#QString(85c52e162fed56f9).))
6829 {
6830 QStringcxx . . $ QString# buffer = rankAcxx . . $ QString#QString(132dd6869045752b).;
6831 buffer.replacecxx . . $ QString#replace(612862c8abff0ba5).(QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("[pdk]"cxx . . $ QString#QString(85c52e162fed56f9).), ""cxx . . $ QString#QString(85c52e162fed56f9).);
6832 int ordinalA = buffer.toIntcxx . . $ QString#toInt(d7972accae11ee1f).();
6833 buffer =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). rankB;
6834 buffer.replacecxx . . $ QString#replace(612862c8abff0ba5).(QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("[pdk]"cxx . . $ QString#QString(85c52e162fed56f9).), ""cxx . . $ QString#QString(85c52e162fed56f9).);
6835 int ordinalB = buffer.toIntcxx . . $ QString#toInt(d7972accae11ee1f).();
6836 if(ordinalA > ordinalB)
6837 return -1;
6838 else if(ordinalA == ordinalB)
6839 return 0;
6840 else
6841 return 1;
6842 }
6843 else
6844 {
6845 QStringcxx . . $ QString# buffer = rankAcxx . . $ QString#QString(132dd6869045752b).;
6846 buffer.replacecxx . . $ QString#replace(612862c8abff0ba5).(QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("[pdk]"cxx . . $ QString#QString(85c52e162fed56f9).), ""cxx . . $ QString#QString(85c52e162fed56f9).);
6847 int ordinalA = buffer.toIntcxx . . $ QString#toInt(d7972accae11ee1f).();
6848 buffer =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). rankB;
6849 buffer.replacecxx . . $ QString#replace(612862c8abff0ba5).(QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("[pdk]"cxx . . $ QString#QString(85c52e162fed56f9).), ""cxx . . $ QString#QString(85c52e162fed56f9).);
6850 int ordinalB = buffer.toIntcxx . . $ QString#toInt(d7972accae11ee1f).();
6851 if(ordinalA > ordinalB)
6852 return 1;
6853 else if(ordinalA == ordinalB)
6854 return 0;
6855 else
6856 return -1;
6857 }
6858 }
6859
6860 /* It looks like when there's a rematch we get a 1a81, which we need to
6861 * make sure we recognize, and then a d2af, which should trigger
6862 * a rematch accept somehow. Also likely currently a segmentation fault
6863 * on this. */
6864 /* I'm fairly certain this also doubles as an acceptMatchModeRequest */
6865 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleMatchOpenedcxx . . $ CyberOroConnection#handleMatchOpened(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
6866 {
6867 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
6868 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch;
6869 unsigned char * p = msg;
6870 PlayerListingcxx . . $ PlayerListing# * player;
6871 PlayerListingcxx . . $ PlayerListing# * playerA, * playerB;
6872 GameDatacxx . . $ GameData# * aGameData = 0;
6873 unsigned short player_id;
6874 unsigned short game_id;
6875 unsigned short game_number;
6876 int handicap;
6877 unsigned short black_seconds, white_seconds;
6878 int black_periods, white_periods;
6879 float komi;
6880 bool white_in_byoyomi, black_in_byoyomi;
6881 bool we_are_challenger = false;
6882 int board_size;
6883 bool nigiri = false;
6884 bool memo, review, estimate;
6885 if(size != 156)
6886 {
6887 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Match Opened msg of strange size %d", size);
6888 }
6889 #ifdef RE_DEBUG
6890 printf("d2af: \n");
6891 for(unsigned int i = 0; i < size; i++)
6892 printf("%02x", msg[i]);
6893 printf("\n");
6894 #endif //RE_DEBUG
6895
6896 /* FIXME I'm not sure this is the current players turn,
6897 * it might just be the challenger or something */
6898 player_id = p[0] + (p[1] << 8);
6899 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(player_id);
6900 #ifdef RE_DEBUG
6901 if(player)
6902 printf("Currently %s's turn...\n", player->name.toLatin1().constData()); //not true for nigiri at least, FIXME
6903 else
6904 qDebug("Can't find player for for d2af\n");
6905 #endif //RE_DEBUG
6906 /* This doesn't work */
6907 //if(player_id == our_player_id)
6908 // we_are_challenger = true;
6909 //else
6910 // we_are_challenger = false;
6911 p += 2;
6912 game_id = msg[2] + (msg[3] << 8);
6913 game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_id];
6914 if(!game_number)
6915 printf("No game number for %02x%02x\n", msg[2], msg[3]);
6916 /* FIXME, its apparently possible to get this on a match we're
6917 * already observing for some reason... if we haven't set a connecting
6918 * to number, this causes us to create an unnecessary board */
6919 /* FIXME is this reliable for our games ? */
6920
6921 p += 2;
6922 //b50d 7203 0002 01f0 0201 0300 0000 3c00 3c003c00
6923 //0002
6924 //I think this is the rematch number
6925 //4 and 5 might be the ordinal of this game in a sequence (maybe not)
6926 p += 2;
6927
6928 if(connecting_to_game_numbercxx . . $ CyberOroConnection#connecting_to_game_number.)
6929 {
6930 if(connecting_to_game_numbercxx . . $ CyberOroConnection#connecting_to_game_number. != game_number)
6931 {
6932 printf("Received unexpected d2af\n");
6933 }
6934 else
6935 connecting_to_game_numbercxx . . $ CyberOroConnection#connecting_to_game_number. = 0;
6936 #ifdef RE_DEBUG
6937 //printf("d2af Setting game code to number %02x%02x %d\n", msg[2], msg[3], game_number);
6938 #endif //RE_DEBUG
6939 //game_code_to_number[game_id] = game_number;
6940 }
6941 else if(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->isOurGamecxx . . $ MatchNegotiationState#isOurGame(3c978dac0e5ee2ad).(game_number))
6942 {
6943 if(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->opponentDisconnectedcxx . . $ MatchNegotiationState#opponentDisconnected(c9857a73d68e59ba).())
6944 {
6945 if(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->getOpponentcxx . . $ MatchNegotiationState#getOpponent(d436534e89c8f252).() !=cxx . . $ `operator!=`(5bc2975d2d751687). player->namecxx . . $ PlayerListing#name.)
6946 {
6947 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Got match opened, but %s is not our opponent", player->namecxx . . $ PlayerListing#name..toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).());
6948 //return; //FIXME
6949 }
6950 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("opponent reconnected");
6951 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->setPlayercxx . . $ MatchNegotiationState#setPlayer(122195e397f39e1b).(player);
6952 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->startMatchcxx . . $ MatchNegotiationState#startMatch(49f6e7a06ebc5aa8).();
6953 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
6954 if(!boarddispatch)
6955 {
6956 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Opponent reconnected but no board!");
6957 return;
6958 }
6959 aGameData = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
6960 if(aGameData->game_codecxx . . $ GameData#game_code. != game_id) //probably won't
6961 aGameData->game_codecxx . . $ GameData#game_code. = game_id;
6962 boarddispatch->startTimecxx . . $ BoardDispatch#startTime(49f6e7a06ebc5aa8).();
6963 QStringcxx . . $ QString# qcxx . . $ QString#QString(ced63f7c635d850d).;
6964 boarddispatch->moveControlcxx . . $ BoardDispatch#moveControl(4c89b026053e4d32).(q);
6965 }
6966 else
6967 {
6968 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->verifyPlayercxx . . $ MatchNegotiationState#verifyPlayer(20057ff4c3da74fc).(player) &&
6969 (player_id != our_player_idcxx . . $ CyberOroConnection#our_player_id. || (!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->sentRematchcxx . . $ MatchNegotiationState#sentRematch(c9857a73d68e59ba).() && !match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->canEnterRematchAdjournedcxx . . $ MatchNegotiationState#canEnterRematchAdjourned(c9857a73d68e59ba).())))
6970 {
6971 //on resuming a game after being disconnected, we hit here
6972 //it could be anything but its amazing that our game is set at all?!? FIXME
6973 // actually, obviously their id changes when they resume so "verifyPlayer" will fail !!! FIXME
6974 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Would have been a rematch but some issue"); //FIXME FIXME
6975 //FIXME resetting here could be a problem with someone blocking games by causing us to reset when
6976 //we shouldn't? maybe not. I'm being paranoid, this isn't udp
6977 //match_negotiation_state->reset();
6978 //return;
6979 // so yeah, going to go ahead, assuming its okay though should still FIXME
6980 }
6981 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
6982 if(!boarddispatch)
6983 {
6984 if(player)
6985 getAndCloseGameDialogcxx . . $ NetworkConnection#getAndCloseGameDialog(847f6df3a908f59b).(player);
6986 setRoomNumbercxx . . $ CyberOroConnection#setRoomNumber(ed53e3bbd3fa2f69).(game_number);
6987 }
6988 else
6989 {
6990 aGameData = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
6991 if(aGameData->game_codecxx . . $ GameData#game_code. != game_id)
6992 {
6993 /* We're getting here when there's just a rejoin
6994 * unknown indicator 01 could be resume, but game code is different
6995 * note that we get the list of moves when they drop and rejoin!! */
6996 GameListingcxx . . $ GameListing# * listing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(game_number);
6997 delete listing->gameDatacxx . . $ GameListing#gameData.;
6998 listing->gameDatacxx . . $ GameListing#gameData. = 0;
6999 printf("our rematch\n");
7000 NetworkConnectioncxx . . $ NetworkConnection#::closeBoardDispatchcxx . . $ NetworkConnection#closeBoardDispatch(cb2f890c2fdad230).(game_number);
7001 aGameData = 0;
7002 }
7003 else
7004 {
7005
7006 #ifdef RE_DEBUG
7007 printf("Maybe a return to match mode our game\n");
7008 #endif //RE_DEBUG
7009 //if so, need to restart timers!!! FIXME, added to boarddispatch but doublecheck
7010 boarddispatch->recvLeaveScoreModecxx . . $ BoardDispatch#recvLeaveScoreMode(49f6e7a06ebc5aa8).();
7011 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->startMatchcxx . . $ MatchNegotiationState#startMatch(49f6e7a06ebc5aa8).();
7012 return;
7013 }
7014 }
7015 }
7016 }
7017 else
7018 {
7019 boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
7020 if(!boarddispatch)
7021 {
7022 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Unexpected d2af\n");
7023 return;
7024 }
7025 else
7026 {
7027 aGameData = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
7028 if(aGameData->game_codecxx . . $ GameData#game_code. != game_id)
7029 {
7030 /* FIXME should be combined with earlier deletion of this under our match.
7031 * this is ugly incidentally, that we add this strange thing to store the
7032 * gameData because ORO doesn't resend on rejoin, and then we have to go
7033 * around it like this. */
7034 /* FIXME pretty sure this can happen sometimes when there's no rematch
7035 * so there must be an additional flag */
7036 GameListingcxx . . $ GameListing# * listing = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(game_number);
7037 delete listing->gameDatacxx . . $ GameListing#gameData.;
7038 listing->gameDatacxx . . $ GameListing#gameData. = 0;
7039 printf("observer rematch\n");
7040 NetworkConnectioncxx . . $ NetworkConnection#::closeBoardDispatchcxx . . $ NetworkConnection#closeBoardDispatch(cb2f890c2fdad230).(game_number);
7041 aGameData = 0;
7042 }
7043 else
7044 {
7045 #ifdef RE_DEBUG
7046 printf("Maybe a return to match mode observer\n");
7047 #endif //RE_DEBUG
7048 boarddispatch->recvLeaveScoreModecxx . . $ BoardDispatch#recvLeaveScoreMode(49f6e7a06ebc5aa8).();
7049 return;
7050 }
7051 }
7052 }
7053 /* In case of rematches, we close the existing board
7054 * dispatch, but only through the network
7055 * connection. We don't want to send a leave msg*/
7056 /* FIXME for observed games we need to distinguish here between rematches, return to match mode
7057 * and spoofed board open packets also see match mode comment above.*/
7058
7059
7060 boarddispatch = getBoardDispatchcxx . . $ NetworkConnection#getBoardDispatch(f34f0704202202).(game_number);
7061
7062 /* Consider adding our name to observer list here: */
7063 //FIXME shouldn't some other message do this? doublecheck
7064 if(room_were_incxx . . $ CyberOroConnection#room_were_in. == game_number)
7065 {
7066 PlayerListingcxx . . $ PlayerListing# * our_player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(our_player_idcxx . . $ CyberOroConnection#our_player_id.);
7067 boarddispatch->recvObservercxx . . $ BoardDispatch#recvObserver(fcd883ebbd0934ee).(our_player, true);
7068 //if its our game and we want the 2 != 0 to stop,
7069 //we need to add ourself and opponent to game or make on 1a81 or whatever
7070 //to do it FIXME
7071 }
7072
7073 if(!aGameData)
7074 aGameData = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).();
7075
7076
7077 //FIXME make sure this doesn't enable undo button
7078 //in observed matches
7079 aGameData->undoAllowedcxx . . $ GameData#undoAllowed. = p[1] & 0x80;
7080 memo = p[1] & 0x40;
7081 review = p[1] & 0x20;
7082 estimate = p[1] & 0x10;
7083 if(p[1] & 0x08)
7084 {
7085 nigiri = true;
7086 aGameData->nigiriToBeSettledcxx . . $ GameData#nigiriToBeSettled. = true;
7087 }
7088 /* Maybe 08 is black, 00 is white? and nigiri? */
7089 p += 2;
7090 //0201 //one of these may be the board size flag, 9x9
7091 switch(p[0])
7092 {
7093 case 0:
7094 board_size = 19;
7095 break;
7096 case 1:
7097 board_size = 13;
7098 break;
7099 case 2:
7100 board_size = 9;
7101 break;
7102 case 3:
7103 board_size = 7;
7104 break;
7105 case 4:
7106 board_size = 5;
7107 break;
7108 default:
7109 printf("Strange boardsize indicator: %02x\n", p[0]);
7110 board_size = 19;
7111 break;
7112 }
7113 #ifdef RE_DEBUG
7114 printf("Unknown indicator: %02x\n", p[1]);
7115 /* very likely this means a resume after disconnect
7116 * I saw 00 for a legitimate rematch... its possible that the ones
7117 * that shouldn't open a new window are 01 but I need to verify,
7118 * note that this can be in "observer rematch" as well*/
7119 #endif //RE_DEBUG
7120 p += 2;
7121
7122 handicap = p[0];
7123
7124 if(handicap)
7125 {
7126 //maybe clear komi?
7127 if(handicap == 1)
7128 handicap = 0;
7129 }
7130
7131 p++;
7132 if(p[0])
7133 komi = -((float)(p[1])) - 0.5;
7134 else
7135 komi = ((float)(p[1])) + 0.5;
7136
7137 p += 5; //this skips one time duplicate as well
7138 black_seconds = p[0] + (p[1] << 8);
7139 p += 2;
7140 white_seconds = p[0] + (p[1] << 8);
7141 p += 2;
7142 aGameData->maintimecxx . . $ GameData#maintime. = black_seconds; //FIXME they're the same right?
7143
7144 black_periods = p[0];
7145 white_periods = p[1];
7146 p += 2;
7147 black_in_byoyomi = p[0];
7148 white_in_byoyomi = p[1];
7149 /* If maintime is set to 0, we need to jump into periods. Not
7150 * sure why this isn't set on incoming message, I guess because match
7151 * just opened. */
7152 if(!black_in_byoyomi && aGameData->maintimecxx . . $ GameData#maintime.)
7153 black_periods = -1; //FIXME, awkward flags
7154 if(!white_in_byoyomi && aGameData->maintimecxx . . $ GameData#maintime.)
7155 white_periods = -1;
7156 p += 2;
7157
7158 aGameData->periodtimecxx . . $ GameData#periodtime. = p[0] + (p[1] << 8);
7159 p += 2;
7160 aGameData->stones_periodscxx . . $ GameData#stones_periods. = p[0];
7161 switch(p[1])
7162 {
7163 case 0:
7164 aGameData->timeSystemcxx . . $ GameData#timeSystem. = byoyomicxx . . $ byoyomi.;
7165 break;
7166 case 1:
7167 aGameData->timeSystemcxx . . $ GameData#timeSystem. = canadiancxx . . $ canadian.;
7168 break;
7169 case 2:
7170 aGameData->timeSystemcxx . . $ GameData#timeSystem. = tvasiacxx . . $ tvasia.;
7171 break;
7172 }
7173 p += 2;
7174
7175 //00 00 A4 01 A4 01 A4 01 05 05 00 00 3C 00 05 00 ............<...
7176 //02 00 00 00 //these second two 00 00 might be a move number?
7177 p += 4;
7178 game_number = p[0] + (p[1] << 8);
7179 #ifdef RE_DEBUG
7180 printf("Room number : %d\n", game_number);
7181 #endif //RE_DEBUG
7182 //96 00 96 00
7183 p += 4;
7184 p += 23;
7185 p++;
7186 p += 10;
7187 playerA = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
7188 p += 2;
7189 #ifdef RE_DEBUG
7190 printf("PlayerA is %s %s\n", playerA->name.toLatin1().constData(), playerA->rank.toLatin1().constData());
7191 #endif //RE_DEBUG
7192 p += 10;
7193 playerB = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
7194 #ifdef RE_DEBUG
7195 printf("PlayerB is %s %s\n", playerB->name.toLatin1().constData(), playerB->rank.toLatin1().constData());
7196 #endif //RE_DEBUG
7197 p += 2;
7198 /* FIXME It looks like its possible to reverse the ranks here and
7199 * we need to find out why and how */
7200
7201 /* Double check for nigiri issues */
7202 if(match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->isOurGamecxx . . $ MatchNegotiationState#isOurGame(3c978dac0e5ee2ad).(game_number))
7203 {
7204 if(playerA->idcxx . . $ PlayerListing#id. == our_player_idcxx . . $ CyberOroConnection#our_player_id.)
7205 {
7206 aGameData->opponent_idcxx . . $ GameData#opponent_id. = playerB->idcxx . . $ PlayerListing#id.;
7207 if(nigiri)
7208 we_are_challenger = true;
7209 }
7210 else
7211 {
7212 aGameData->opponent_idcxx . . $ GameData#opponent_id. = playerA->idcxx . . $ PlayerListing#id.;
7213 }
7214 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->startMatchcxx . . $ MatchNegotiationState#startMatch(49f6e7a06ebc5aa8).();
7215 }
7216 aGameData->black_namecxx . . $ GameData#black_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). playerA->namecxx . . $ PlayerListing#name.;
7217 aGameData->white_namecxx . . $ GameData#white_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). playerB->namecxx . . $ PlayerListing#name.;
7218 aGameData->black_rankcxx . . $ GameData#black_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). playerA->rankcxx . . $ PlayerListing#rank.;
7219 aGameData->white_rankcxx . . $ GameData#white_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). playerB->rankcxx . . $ PlayerListing#rank.;
7220 aGameData->board_sizecxx . . $ GameData#board_size. = board_size;
7221 aGameData->handicapcxx . . $ GameData#handicap. = handicap;
7222 aGameData->numbercxx . . $ GameData#number. = game_number;
7223 aGameData->game_codecxx . . $ GameData#game_code. = game_id;
7224 aGameData->komicxx . . $ GameData#komi. = komi;
7225 boarddispatch->openBoardcxx . . $ BoardDispatch#openBoard(49f6e7a06ebc5aa8).();
7226 boarddispatch->recvTimecxx . . $ BoardDispatch#recvTime(63f8d2dcefae8817).(TimeRecordcxx . . $ TimeRecord#TimeRecord(3e454b8ccf442868).(white_seconds, white_periods), TimeRecordcxx . . $ TimeRecord#TimeRecord(3e454b8ccf442868).(black_seconds, black_periods));
7227
7228 if(playerA->idcxx . . $ PlayerListing#id. == our_player_idcxx . . $ CyberOroConnection#our_player_id. || playerB->idcxx . . $ PlayerListing#id. == our_player_idcxx . . $ CyberOroConnection#our_player_id.)
7229 {
7230 if(!nigiri)
7231 {
7232 startMatchTimerscxx . . $ CyberOroConnection#startMatchTimers(b45ddcbc8423892c).((playerA->idcxx . . $ PlayerListing#id. == our_player_idcxx . . $ CyberOroConnection#our_player_id. && !handicap) ||
7233 (playerB->idcxx . . $ PlayerListing#id. == our_player_idcxx . . $ CyberOroConnection#our_player_id. && handicap));
7234 }
7235 else if(nigiri && we_are_challenger)
7236 sendNigiricxx . . $ CyberOroConnection#sendNigiri(aa266def8759b091).(aGameData->game_codecxx . . $ GameData#game_code., true);
7237 else
7238 {
7239 boarddispatch->recvKibitzcxx . . $ BoardDispatch#recvKibitz(3458fe3960d5051).(QStringcxx . . $ QString#QString(ced63f7c635d850d).(), "Waiting for opponent nigiri..."cxx . . $ QString#QString(85c52e162fed56f9).);
7240 we_send_nigiricxx . . $ CyberOroConnection#we_send_nigiri. = false;
7241 }
7242 }
7243 /* seems like color can get reversed */
7244
7245 /* And observers: */
7246 if(room_were_incxx . . $ CyberOroConnection#room_were_in. == game_number) //no observing outside
7247 addObserverListToBoardcxx . . $ CyberOroConnection#addObserverListToBoard(f9aae4eee533680e).(boarddispatch);
7248 }
7249
7250 void CyberOroConnectioncxx . . $ CyberOroConnection#::addObserverListToBoardcxx . . $ CyberOroConnection#addObserverListToBoard(f9aae4eee533680e).(BoardDispatchcxx . . $ BoardDispatch# * boarddispatch)
7251 {
7252 GameListingcxx . . $ GameListing# * game = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).()->numbercxx . . $ GameData#number.);
7253 //sanity check: for DEBUG ing
7254 /* FIXME We're getting 2 != 1 and a crash here
7255 * also 2 != 0, has something to do with if its our game*/
7256 #ifdef RE_DEBUG
7257 if(game->observers != game->observer_list.size())
7258 qDebug("Observers and observer list size mismatch on game %d!! (%d != %d)", boarddispatch->getGameData()->number, game->observers, game->observer_list.size());
7259 #endif //RE_DEBUG
7260 for(stdcxx . . $ std/::vectorcxx . . $ std/vector#<PlayerListing *>::iteratorcxx . . $ std/vector#iterator# oblistit = game->observer_listcxx . . $ GameListing#observer_list..begincxx . . $ std/vector#begin(55a6de06420d4903).();
7261 oblistit != game->observer_listcxx . . $ GameListing#observer_list..endcxx . . $ std/vector#end(55a6de06420d4903).(); oblistit++)
7262 boarddispatch->recvObservercxx . . $ BoardDispatch#recvObserver(fcd883ebbd0934ee).(*oblistit, true);
7263 }
7264
7265 //38 F4 78 00 01 00 00 08 18 00 00 00 06 00 50 46 8.x...........PF
7266 //2A 0B 3B 00 05 01 00 01 3C 00 05 00 02 00 4B 2E *.;.....<.....K.
7267 //4B 6F 62 61 79 61 73 68 41 2E 4B 61 74 6F 00 00 KobayashA.Kato..
7268 //00 00 8F AC 97 D1 8C F5 88 EA 00 00 89 C1 93 A1 ................
7269 //8F 5B 8E 75 00 00 03 03 C9 C8 03 05 00 00 00 00 .[.u............
7270 //00 00 00 00 1F 01 96 BC 90 6C 90 ED 8D C5 8F 49 .........l.....I
7271 //97 5C 91 49 00 00 00 00 00 00 00 00 00 00 00 00 .\.I............
7272 //00 00 00 00 01 00 00 1F
7273 /* Double check that this isn't just for joining of dead matches or broadcast deads
7274 * Okay, this was a mistake altogether, it was a betting message match that got
7275 * lodged in there. */
7276 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleObserveAfterJoiningcxx . . $ CyberOroConnection#handleObserveAfterJoining(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
7277 {
7278 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
7279 //BoardDispatch * boarddispatch;
7280 unsigned char * p = msg;
7281 PlayerListingcxx . . $ PlayerListing# * player;
7282 /*GameListing * game;
7283 GameData * aGameData;
7284 unsigned short game_id;
7285 int handicap;
7286 unsigned short black_seconds, white_seconds;
7287 int black_periods, white_periods;
7288 unsigned short period_time;
7289 float komi;
7290 bool send_handicap_move = false;
7291 bool white_in_byoyomi, black_in_byoyomi;*/
7292
7293 printf("FIXME handleObserveAfterJoining size: %d\n", size);
7294
7295 player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
7296 #ifdef FIXME
7297 if(player)
7298 printf("Currently %s's turn...\n", player->name.toLatin1().constData());
7299 else
7300 printf("Can't find player for for d2af\n");
7301 printf("38f4\n");
7302 for(int i = 0; i < size; i++)
7303 printf("%02x", msg[i]);
7304 printf("\n");
7305 #endif //FIXME
7306 //FIXME
7307 }
7308
7309 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleMatchOffercxx . . $ CyberOroConnection#handleMatchOffer(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
7310 {
7311 unsigned char * p = msg;
7312 unsigned short periodtime;
7313 unsigned short room_number;
7314 int periods;
7315 bool undo, memo, review, estimate;
7316 bool nigiri = false;
7317 MatchRequestcxx . . $ MatchRequest# mrcxx . . $ MatchRequest#MatchRequest(49f6e7a06ebc5aa8).;
7318 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
7319 unsigned short id = p[0] + (p[1] << 8);
7320 if(size != 156)
7321 {
7322 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("match offer message of strange size %d", size);
7323 }
7324 if(id == our_player_idcxx . . $ CyberOroConnection#our_player_id.)
7325 mr.opponent_is_challengercxx . . $ MatchRequest#opponent_is_challenger. = false;
7326 else
7327 {
7328 mr.opponent_idcxx . . $ MatchRequest#opponent_id. = id;
7329 mr.opponent_is_challengercxx . . $ MatchRequest#opponent_is_challenger. = true;
7330 }
7331 /* FIXME I think its okay if we get this as long as we're in the same room with the opponent */
7332
7333 PlayerListingcxx . . $ PlayerListing# * player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(mr.opponent_idcxx . . $ MatchRequest#opponent_id.);
7334 PlayerListingcxx . . $ PlayerListing# * ourplayer = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(our_player_idcxx . . $ CyberOroConnection#our_player_id.);
7335
7336 mr.opponentcxx . . $ MatchRequest#opponent. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). player->namecxx . . $ PlayerListing#name.;
7337 mr.their_rankcxx . . $ MatchRequest#their_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). player->rankcxx . . $ PlayerListing#rank.;
7338 mr.our_namecxx . . $ MatchRequest#our_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). ourplayer->namecxx . . $ PlayerListing#name.;
7339 mr.our_rankcxx . . $ MatchRequest#our_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). ourplayer->rankcxx . . $ PlayerListing#rank.;
7340
7341 p += 2;
7342 #ifdef RE_DEBUG
7343 printf("last game id?: %02x %02x %d\n", p[0], p[1], p[0] + (p[1] << 8));
7344 #endif //RE_DEBUG
7345 mr.last_game_codecxx . . $ MatchRequest#last_game_code. = p[0] + (p[1] << 8);
7346 p += 2;
7347 #ifdef RE_DEBUG
7348 printf("bytes we need: %02x %02x\n", p[0], p[1]);
7349 #endif //RE_DEBUG
7350 p += 2;
7351 //01f0
7352 // first byte 01 = friendly, 00 = promotional/rated?
7353 if(p[0])
7354 mr.free_ratedcxx . . $ MatchRequest#free_rated. = FREEcxx . . $ FREE.;
7355 else
7356 mr.free_ratedcxx . . $ MatchRequest#free_rated. = RATEDcxx . . $ RATED.;
7357 //second byte contains partly bit field for settings
7358 // double check
7359 undo = p[1] & 0x80;
7360 memo = p[1] & 0x40;
7361 review = p[1] & 0x20;
7362 estimate = p[1] & 0x10;
7363 mr.flagscxx . . $ MatchRequest#flags. = p[1] & 0xf0;
7364 #ifdef RE_DEBUG
7365 printf("Possible color indicator: %02x\n", p[1] & 0x0f);
7366 #endif //RE_DEBUG
7367 /*switch(p[1] & 0x0f)
7368 {
7369 case 0:
7370 mr.color_request = MatchRequest::WHITE;
7371 break;
7372 case 8:
7373 mr.color_request = MatchRequest::BLACK;
7374 break;
7375 default:
7376 break;
7377 }*/
7378 if(p[1] & 0x08)
7379 {
7380 mr.color_requestcxx . . $ MatchRequest#color_request. = MatchRequestcxx . . $ MatchRequest#::NIGIRIcxx . . $ MatchRequest#NIGIRI.;
7381 nigiri = true;
7382 }
7383 /* Maybe 08 is black, 00 is white? and nigiri? */
7384 p += 2;
7385 //0201 //one of these may be the board size flag, 9x9
7386 switch(p[0])
7387 {
7388 case 0:
7389 mr.board_sizecxx . . $ MatchRequest#board_size. = 19;
7390 break;
7391 case 1:
7392 mr.board_sizecxx . . $ MatchRequest#board_size. = 13;
7393 break;
7394 case 2:
7395 mr.board_sizecxx . . $ MatchRequest#board_size. = 9;
7396 break;
7397 case 3:
7398 mr.board_sizecxx . . $ MatchRequest#board_size. = 7;
7399 break;
7400 case 4:
7401 mr.board_sizecxx . . $ MatchRequest#board_size. = 5;
7402 break;
7403 default:
7404 printf("Strange boardsize indicator: %02x\n", p[0]);
7405 break;
7406 }
7407 #ifdef RE_DEBUG
7408 printf("Unknown indicator: %02x\n", p[1]);
7409 #endif //RE_DEBUG
7410 /* This doesn't necessarily mean challenger is black,
7411 * I don't know what this means, I've seen it as 0,
7412 * for challenger as all colors */
7413 mr.challenger_is_blackcxx . . $ MatchRequest#challenger_is_black. = p[1];
7414 p += 2;
7415 //0300 //probably handicap
7416 mr.handicapcxx . . $ MatchRequest#handicap. = p[0];
7417 p++;
7418 if(p[0])
7419 mr.komicxx . . $ MatchRequest#komi. = -((float)(p[1])) - 0.5;
7420 else
7421 mr.komicxx . . $ MatchRequest#komi. = ((float)(p[1])) + 0.5;
7422 //0400; //probably komi
7423 p += 3;
7424 //5802 //here main time is repeated there times !?!
7425 mr.maintimecxx . . $ MatchRequest#maintime. = p[0] + (p[1] << 8);
7426 p += 6;
7427 //0505 //probably time periods, but I think we get this later as well
7428 p += 2;
7429 //0000
7430 p += 2;
7431 periodtime = p[0] + (p[1] << 8);
7432 p += 2;
7433 //0500
7434 periods = p[0];
7435 // that second byte MIGHT be the game style
7436 // 0 for byo yomi, 1 for canada, 2, for "tv asia"
7437 // pretty certain this is FIXME correct time style !!!!
7438 switch(p[1])
7439 {
7440 case 0:
7441 /* Really this is korean, but hopefully its the same thing */
7442 mr.timeSystemcxx . . $ MatchRequest#timeSystem. = byoyomicxx . . $ byoyomi.;
7443 break;
7444 case 1:
7445 mr.timeSystemcxx . . $ MatchRequest#timeSystem. = canadiancxx . . $ canadian.;
7446 break;
7447 case 2:
7448 mr.timeSystemcxx . . $ MatchRequest#timeSystem. = tvasiacxx . . $ tvasia.;
7449 break;
7450 default:
7451 printf("Unknown time style indicator %02x\n", p[1]);
7452 break;
7453 }
7454 mr.stones_periodscxx . . $ MatchRequest#stones_periods. = periods;
7455 mr.periodtimecxx . . $ MatchRequest#periodtime. = periodtime;
7456 p += 2;
7457 //0200
7458 #ifdef RE_DEBUG
7459 printf("First weird byte: %02x %02x\n", p[0], p[1]);
7460 #endif //RE_DEBUG
7461 p += 2;
7462 //0000 3900
7463 p += 2;
7464 room_number = p[0] + (p[1] << 8);
7465 #ifdef RE_DEBUG
7466 printf("mr number: %d\n", room_number);
7467 #endif //RE_DEBUG
7468 mr.numbercxx . . $ MatchRequest#number. = room_number;
7469 p += 2;
7470 p += 14; //zeroes
7471 //1f00
7472 p += 2;
7473 p += 8; //zeroes
7474 //0075
7475 #ifdef RE_DEBUG
7476 /* FIXME, not really sure what this byte is,
7477 * fairly certain its unrelated to color though*/
7478 if(p[1] & 0x10)
7479 printf("0x10 setting on\n");
7480 else
7481 printf("0x10 setting off\n");
7482 if(p[1] & 0x20)
7483 printf("0x20 setting on\n");
7484 else
7485 printf("0x20 setting off\n");
7486 if(p[1] & 0x40)
7487 printf("0x40 setting on\n");
7488 else
7489 printf("0x40 setting off\n");
7490 if(p[1] & 0x80)
7491 printf("0x80 setting on\n");
7492 else
7493 printf("0x80 setting off\n");
7494 if(p[1] & 0x01)
7495 printf("0x01 setting on\n");
7496 else
7497 printf("0x01 setting off\n");
7498 if(p[1] & 0x02)
7499 printf("0x02 setting on\n");
7500 else
7501 printf("0x02 setting off\n");
7502 if(p[1] & 0x04)
7503 printf("0x04 setting on\n");
7504 else
7505 printf("0x04 setting off\n");
7506 if(p[1] & 0x08)
7507 printf("0x08 setting on\n");
7508 else
7509 printf("0x08 setting off\n");
7510 #endif //RE_DEBUG
7511
7512
7513 p += 2;
7514 p += 10; //name and id
7515 unsigned short black_challenger_id = p[0] + (p[1] << 8);
7516 if(black_challenger_id == our_player_idcxx . . $ CyberOroConnection#our_player_id. && !nigiri)
7517 mr.color_requestcxx . . $ MatchRequest#color_request. = MatchRequestcxx . . $ MatchRequest#::BLACKcxx . . $ MatchRequest#BLACK.;
7518 else if(!nigiri)
7519 {
7520 mr.color_requestcxx . . $ MatchRequest#color_request. = MatchRequestcxx . . $ MatchRequest#::WHITEcxx . . $ MatchRequest#WHITE.;
7521 if(black_challenger_id != our_player_idcxx . . $ CyberOroConnection#our_player_id.)
7522 mr.opponent_idcxx . . $ MatchRequest#opponent_id. = black_challenger_id;
7523 }
7524 p += 2;
7525 p += 10; //name and id
7526 unsigned short white_non_challenger_id = p[0] + (p[1] << 8);
7527 if(white_non_challenger_id != our_player_idcxx . . $ CyberOroConnection#our_player_id.)
7528 mr.opponent_idcxx . . $ MatchRequest#opponent_id. = white_non_challenger_id;
7529 p += 2;
7530 /* Either challenger is second, or white is second or there's another
7531 * flag to indicate which is which */
7532 p += 22; //zeroes
7533 //1027
7534 p += 2;
7535 p += (3 * 16); //zeroes
7536
7537 #ifdef RE_DEBUG
7538 printf("0xc8af: ");
7539 for(unsigned int i = 0; i < size; i++)
7540 printf("%02x", msg[i]);
7541 printf("\n");
7542 #endif //RE_DEBUG
7543 GameDialogcxx . . $ GameDialog# * gameDialogDispatch = getGameDialogcxx . . $ NetworkConnection#getGameDialog(3dcc94127826259).(player);
7544 gameDialogDispatch->recvRequestcxx . . $ GameDialog#recvRequest(461bc273ee812ab9).(&mr, getGameDialogFlagscxx . . $ CyberOroConnection#getGameDialogFlags(f708dce9a8856c70).());
7545 }
7546
7547 //5fc3
7548 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleResumeMatchcxx . . $ CyberOroConnection#handleResumeMatch(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
7549 {
7550 unsigned char * p = msg;
7551 unsigned short room_number = p[0] + (p[1] << 8);
7552 unsigned short our_id, their_id;
7553 PlayerListingcxx . . $ PlayerListing# * opponent;
7554 p += 2;
7555 our_id = msg[2] + (msg[3] << 8);
7556 if(our_id != our_player_idcxx . . $ CyberOroConnection#our_player_id.)
7557 {
7558 #ifdef RE_DEBUG
7559 qDebug("resume game not meant for us! %02x%02x", msg[2], msg[3]); //happens often
7560 #endif //RE_DEBUG
7561 return;
7562 }
7563 their_id = msg[4] + (msg[5] << 8);
7564
7565 opponent = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(their_id);
7566 // ffs? lots of ffs?
7567 #ifdef RE_DEBUG
7568 printf("resume adjourned? 5fc3?: ");
7569 for(unsigned int i = 0; i < size; i++)
7570 printf("%02x", msg[i]);
7571 printf("\n");
7572 #endif //RE_DEBUG
7573
7574 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->setupRematchAdjournedcxx . . $ MatchNegotiationState#setupRematchAdjourned(6f89333d9b9322ae).(room_number, opponentcxx . . $ QString#QString(132dd6869045752b).->namecxx . . $ PlayerListing#name.);
7575 /* It only get set as our game if its got our name in it
7576 * and even that may not be enough but... treat like
7577 * 0a7d from here.
7578
7579 * Actually, this may be a bad idea because it can screw up
7580 * the player names !!! ours is always first regardless of color
7581 * we'd have to make sure that 0a7d is not relied on for color
7582 * and more than that that the d2af does set the color up properly.*/
7583 /* More than that, it causes NewRoom to complain about size 18 */
7584 handleNewRoomcxx . . $ CyberOroConnection#handleNewRoom(e1e8b00c42c42532).(msg, size);
7585 #ifdef RE_DEBUG
7586 qDebug("Resuming\n");
7587 #endif //RE_DEBUG
7588 }
7589 /* FIXME, combine these very common handler messages into one function */
7590
7591 //b5b3
7592 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleAdjournRequestcxx . . $ CyberOroConnection#handleAdjournRequest(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
7593 {
7594 unsigned char * p = msg;
7595
7596 if(size != 8)
7597 {
7598 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Adjourn request of strange size: %d", size);
7599 }
7600 //unsigned short opponent_id = p[0] + (p[1] << 8);
7601 unsigned short game_code = p[2] + (p[3] << 8);
7602 unsigned short game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
7603 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
7604 if(!boarddispatch)
7605 {
7606 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Received adjourn decline on nonexistent board");
7607 return;
7608 }
7609 boarddispatch->recvRequestAdjourncxx . . $ BoardDispatch#recvRequestAdjourn(49f6e7a06ebc5aa8).();
7610
7611 p += 2;
7612 //their id game id, maybe color?
7613 #ifdef RE_DEBUG
7614 qDebug("b5b3 size: %d", size);
7615 #endif //RE_DEBUG
7616 }
7617
7618 //bfb3
7619 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleAdjournDeclinecxx . . $ CyberOroConnection#handleAdjournDecline(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
7620 {
7621 unsigned char * p = msg;
7622 if(size != 8)
7623 {
7624 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Adjourn decline of strange size: %d", size);
7625 }
7626 //unsigned short opponent_id = p[0] + (p[1] << 8);
7627 unsigned short game_code = p[2] + (p[3] << 8);
7628 unsigned short game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
7629 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
7630 if(!boarddispatch)
7631 {
7632 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Received adjourn decline on nonexistent board");
7633 return;
7634 }
7635 boarddispatch->recvRefuseAdjourncxx . . $ BoardDispatch#recvRefuseAdjourn(49f6e7a06ebc5aa8).();
7636
7637 p += 2;
7638 //their id game id, maybe color?
7639 //5304 430d 0100 0071
7640 #ifdef RE_DEBUG
7641 printf("0xbfb3 likely adjourn decline: ");
7642 for(int i = 0; i < (int)size; i++)
7643 printf("%02x", msg[i]);
7644 printf("\n");
7645
7646 qDebug("bfb3 size: %d", size);
7647 #endif //RE_DEBUG
7648 }
7649
7650 //bab3
7651 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleAdjourncxx . . $ CyberOroConnection#handleAdjourn(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
7652 {
7653 unsigned char * p = msg;
7654 if(size != 8)
7655 {
7656 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Adjourn of strange size: %d", size);
7657 }
7658 //unsigned short opponent_id = p[0] + (p[1] << 8);
7659 unsigned short game_code = p[2] + (p[3] << 8);
7660 unsigned short game_number = game_code_to_numbercxx . . $ CyberOroConnection#game_code_to_number.[cxx . . $ std/map#`operator[]`(bbd415b616967878).game_code];
7661 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(game_number);
7662 if(!boarddispatch)
7663 {
7664 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Received adjourn on nonexistent board");
7665 return;
7666 }
7667 /* FIXME, why do we need to close the board dispatch, shouldn't
7668 * the adjournGame do that? or should it, maybe we can talk after? */
7669 boarddispatch->adjournGamecxx . . $ BoardDispatch#adjournGame(49f6e7a06ebc5aa8).();
7670 //connection->closeBoardDispatch(memory);
7671 #ifdef RE_DEBUG
7672 qDebug("bab3 size: %d", size);
7673 #endif //RE_DEBUG
7674 }
7675
7676 /* This pops up in a short, maybe 10 - 30 second dialog that then automatically
7677 * declines. If you hit accept, then you go into the match offer dialog.
7678 * I'm not sure if we want to auto accept (if we're looking/open) and then
7679 * let the player decline from the settings if they want to? Or maybe that
7680 * would make the client appear rude and we should instead show a popup
7681 * for this message... which is a different sort of behavior to emulate... */
7682 //2279
7683 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleMatchInvitecxx . . $ CyberOroConnection#handleMatchInvite(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
7684 {
7685 unsigned char * p = msg;
7686 if(size != 12)
7687 {
7688 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("MatchInvite of size %d\n", size);
7689 // probably should print it out and exit FIXME
7690 }
7691 Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).();
7692 PlayerListingcxx . . $ PlayerListing# * player = room->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
7693 //22 79 10 00 FC 08 27 00 00 08 09 00 00 00 00 7B
7694 p += 2;
7695 // the 00 08 is our id, 9 could be special byte but the 27 changes
7696
7697 #ifdef RE_DEBUG
7698 printf("%s requests match %02x %02x %02x\n", player->name.toLatin1().constData(), p[0], p[1], p[4]);
7699 #endif //RE_DEBUG
7700 /* FIXME, I really don't think we want to auto accept. It puts one in
7701 * a special room And then if you go to observe after joining in
7702 * another game in progress, you leave the match room. */
7703 /* FIXME blocks here right now because match_negotiation_state isn't properly reset */
7704 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->newMatchAllowedcxx . . $ MatchNegotiationState#newMatchAllowed(c9857a73d68e59ba).())
7705 return;
7706
7707 MatchInviteDialogcxx . . $ MatchInviteDialog# * mid = new MatchInviteDialogcxx . . $ MatchInviteDialog#(playercxx . . $ QString#QString(132dd6869045752b).->namecxx . . $ PlayerListing#name., playercxx . . $ QString#QString(132dd6869045752b).->rankcxx . . $ PlayerListing#rank.);
7708 int mid_return = mid->execcxx . . $ QDialog#exec(b126dc7c1de90089).();
7709
7710 if(mid_return == 1)
7711 sendMatchInvitecxx . . $ CyberOroConnection#sendMatchInvite(d77e65cb0d14bb16).(player, true);
7712 else if(mid_return == -1)
7713 sendDeclineMatchInvitecxx . . $ CyberOroConnection#sendDeclineMatchInvite(cac334474c82cf3a).(player);
7714 }
7715
7716 //0x147d
7717 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleAcceptMatchInvitecxx . . $ CyberOroConnection#handleAcceptMatchInvite(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
7718 {
7719 unsigned char * p = msg;
7720 if(size != 4)
7721 {
7722 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("MatchInviteAccept of size %d\n", size);
7723 // probably should print it out and exit FIXME
7724 }
7725 PlayerListingcxx . . $ PlayerListing# * player = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
7726 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->sentMatchInvitecxx . . $ MatchNegotiationState#sentMatchInvite(c9857a73d68e59ba).())
7727 return;
7728 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->verifyPlayercxx . . $ MatchNegotiationState#verifyPlayer(20057ff4c3da74fc).(player))
7729 return;
7730 sendMatchOfferPendingcxx . . $ CyberOroConnection#sendMatchOfferPending(cac334474c82cf3a).(player);
7731
7732 #ifdef RE_DEBUG
7733 printf("0x147d: ");
7734 for(int i = 0; i < (int)size; i++)
7735 printf("%02x", msg[i]);
7736 printf("\n");
7737 #endif //RE_DEBUG
7738 }
7739
7740 //FIXME I suspect that the a479 is the match invite decline
7741 //but 0c2b is also a candidate
7742 //0xa479: 3e0d1c02ab0000ef
7743 //0x0c2b: 3e0d1c02ab0000ef
7744
7745 //a479
7746 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleDeclineMatchInvitecxx . . $ CyberOroConnection#handleDeclineMatchInvite(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
7747 {
7748 unsigned char * p = msg;
7749 if(size != 8)
7750 {
7751 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("MatchInviteDecline of size %d\n", size);
7752 // probably should print it out and exit FIXME
7753 }
7754 PlayerListingcxx . . $ PlayerListing# * player = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(p[0] + (p[1] << 8));
7755 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->sentMatchInvitecxx . . $ MatchNegotiationState#sentMatchInvite(c9857a73d68e59ba).())
7756 return;
7757 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->verifyPlayercxx . . $ MatchNegotiationState#verifyPlayer(20057ff4c3da74fc).(player))
7758 return;
7759 match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->resetcxx . . $ MatchNegotiationState#reset(49f6e7a06ebc5aa8).();
7760 QMessageBoxcxx . . $ QMessageBox#::informationcxx . . $ QMessageBox#information(a9e3742e6f7b4147).(0, trcxx . . $ NetworkConnection#tr(75d9f1c324b4579d).("Invite declined"), trcxx . . $ NetworkConnection#tr(75d9f1c324b4579d).("%1 has declined invitation").argcxx . . $ QString#arg(bc823072288cbbb5).(player->namecxx . . $ PlayerListing#name.));
7761
7762 #ifdef RE_DEBUG
7763 printf("0xa479: ");
7764 for(int i = 0; i < (int)size; i++)
7765 printf("%02x", msg[i]);
7766 printf("\n");
7767 #endif //RE_DEBUG
7768 }
7769
7770 //0x1e7d
7771 void CyberOroConnectioncxx . . $ CyberOroConnection#::handleMatchOfferPendingcxx . . $ CyberOroConnection#handleMatchOfferPending(e1e8b00c42c42532).(unsigned char * msg, unsigned int size)
7772 {
7773 /* What's the difference between this and the accept match invite? Any ?? */
7774 /* This is the copyback of our own sendMatchOfferPending */
7775 #ifdef RE_DEBUG
7776 printf("0x1e7d: ");
7777 for(int i = 0; i < (int)size; i++)
7778 printf("%02x", msg[i]);
7779 printf("\n");
7780 #endif //RE_DEBUG
7781 //590c 2d07 00ae
7782 unsigned char * p = msg;
7783 if(size != 6)
7784 {
7785 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("MatchRoomOpen of size %d\n", size);
7786 // probably should print it out and exit FIXME
7787 }
7788 if(msg[0] + (msg[1] << 8) != our_player_idcxx . . $ CyberOroConnection#our_player_id.)
7789 {
7790 /* Actually, could this be the game id? FIXME
7791 * But we ignore it if... no, see because below, we're using it
7792 * to open the game dialog offer... */
7793 #ifdef RE_DEBUG
7794 /* Potentially this is regarding our opponent and we should also
7795 * have a standard way of printing out IDS FIXME */
7796 qDebug("Received MatchRoomOpen for someone besides us %02x%02x", p[1], p[0]);
7797 #endif //RE_DEBUG
7798 return;
7799 }
7800 p += 2;
7801 PlayerListingcxx . . $ PlayerListing# * player = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getPlayerListingcxx . . $ Room#getPlayerListing(ad2afa9294843726).(msg[2] + (msg[3] << 8));
7802 p += 2;
7803 // no idea what this is
7804 //setRoomNumber(p[0] + (p[1] << 8));
7805
7806 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->sentMatchOfferPendingcxx . . $ MatchNegotiationState#sentMatchOfferPending(c9857a73d68e59ba).())
7807 return;
7808 if(!match_negotiation_statecxx . . $ NetworkConnection#match_negotiation_state.->verifyPlayercxx . . $ MatchNegotiationState#verifyPlayer(20057ff4c3da74fc).(player))
7809 return;
7810
7811 GameDialogcxx . . $ GameDialog# * gd = getGameDialogcxx . . $ NetworkConnection#getGameDialog(3dcc94127826259).(player);
7812 gd->recvRequestcxx . . $ GameDialog#recvRequest(461bc273ee812ab9).(0, getGameDialogFlagscxx . . $ CyberOroConnection#getGameDialogFlags(f708dce9a8856c70).());
7813 }
7814
7815 /* The point of this is that we should clear out the observer lists
7816 * on rooms we leave, etc. */
7817 void CyberOroConnectioncxx . . $ CyberOroConnection#::setRoomNumbercxx . . $ CyberOroConnection#setRoomNumber(ed53e3bbd3fa2f69).(unsigned short number)
7818 {
7819 if(room_were_incxx . . $ CyberOroConnection#room_were_in. == number)
7820 return;
7821 if(room_were_incxx . . $ CyberOroConnection#room_were_in.)
7822 {
7823 BoardDispatchcxx . . $ BoardDispatch# * bd = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(room_were_incxx . . $ CyberOroConnection#room_were_in.);
7824 if(bd)
7825 bd->clearObserverscxx . . $ BoardDispatch#clearObservers(49f6e7a06ebc5aa8).();
7826 }
7827 room_were_incxx . . $ CyberOroConnection#room_were_in. = number;
7828 }
7829
7830 /* There's also FIXME FIXME FIXME,
7831 * these massive 0x8129 messages at the start of the game,
7832 * looks like an opponents records or something... maybe a picture?
7833 * I have no idea. and a 0x7c29 right before it, short but who knows?
7834 * And then after an 0x8629, again, short. check "truegame" and "truegame2".
7835 * Actually wait, I think these are coming from after a game!! like result
7836 * messages. */
7837
7838 /* These needs to be more versatile later */
7839 void CyberOroConnectioncxx . . $ CyberOroConnection#::onReadycxx . . $ CyberOroConnection#onReady(49f6e7a06ebc5aa8).(void)
7840 {
7841 //sendInvitationSettings(true); //for now
7842 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Ready!\n");
7843 NetworkConnectioncxx . . $ NetworkConnection#::onReadycxx . . $ NetworkConnection#onReady(49f6e7a06ebc5aa8).();
7844 }
7845
7846 int CyberOroConnectioncxx . . $ CyberOroConnection#::gd_verifyBoardSizecxx . . $ CyberOroConnection#gd_verifyBoardSize(7864480464b09eea).(int v)
7847 {
7848 /* If game is ranked, has to be 19x19 but right now
7849 * game dialog has an old flag that sets that up */
7850 if(v < 5)
7851 return 5;
7852 if(v > 13)
7853 return 19;
7854 if(v > 9)
7855 return 13;
7856 if(v > 7)
7857 return 9;
7858 if(v > 5)
7859 return 7;
7860 return v;
7861 }
7862
7863 QTimecxx . . $ QTime# CyberOroConnectioncxx . . $ CyberOroConnection#::gd_checkMainTimecxx . . $ CyberOroConnection#gd_checkMainTime(71240b9f3410da6b).(TimeSystemcxx . . $ TimeSystem# s, const QTimecxx . . $ QTime# & t)
7864 {
7865 int seconds = (t.minutecxx . . $ QTime#minute(455f465bc33b4cdf).() * 60) + t.secondcxx . . $ QTime#second(455f465bc33b4cdf).();
7866 switch(s)
7867 {
7868 case byoyomicxx . . $ byoyomi.: //korean
7869 if(t.hourcxx . . $ QTime#hour(455f465bc33b4cdf).() > 8 || (t.hourcxx . . $ QTime#hour(455f465bc33b4cdf).() == 8 && t.minutecxx . . $ QTime#minute(455f465bc33b4cdf).() > 20))
7870 return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(8, 20, 0);
7871 else
7872 return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(t.hourcxx . . $ QTime#hour(455f465bc33b4cdf).(), t.minutecxx . . $ QTime#minute(455f465bc33b4cdf).(), 0);
7873 break;
7874 case canadiancxx . . $ canadian.:
7875 if(t.hourcxx . . $ QTime#hour(455f465bc33b4cdf).() >= 1)
7876 return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(1, 0, 0);
7877 else
7878 return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(t.hourcxx . . $ QTime#hour(455f465bc33b4cdf).(), t.minutecxx . . $ QTime#minute(455f465bc33b4cdf).(), 0);
7879 case tvasiacxx . . $ tvasia.:
7880 if(t.minutecxx . . $ QTime#minute(455f465bc33b4cdf).() >= 5)
7881 return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(0, 5, 0);
7882 else
7883 {
7884 if(seconds % 10)
7885 seconds += (10 - (seconds % 10));
7886 int minutes = seconds;
7887 seconds %= 60;
7888 minutes -= seconds;
7889 minutes /= 60;
7890 return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(0, minutes, seconds);
7891 }
7892 break;
7893 default:
7894 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("unsupported CyberORO time type");
7895 break;
7896 }
7897 return t;
7898 }
7899
7900 QTimecxx . . $ QTime# CyberOroConnectioncxx . . $ CyberOroConnection#::gd_checkPeriodTimecxx . . $ CyberOroConnection#gd_checkPeriodTime(71240b9f3410da6b).(TimeSystemcxx . . $ TimeSystem# s, const QTimecxx . . $ QTime# & t)
7901 {
7902 int seconds = (t.minutecxx . . $ QTime#minute(455f465bc33b4cdf).() * 60) + t.secondcxx . . $ QTime#second(455f465bc33b4cdf).();
7903 switch(s)
7904 {
7905 case byoyomicxx . . $ byoyomi.:
7906 if(t.minutecxx . . $ QTime#minute(455f465bc33b4cdf).() >= 1)
7907 return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(0, 1, 0);
7908 else
7909 {
7910 if(seconds % 10)
7911 seconds += (10 - (seconds % 10));
7912 if(seconds == 60)
7913 return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(0, 1, 0);
7914 else
7915 return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(0, 0, seconds);
7916 }
7917 break;
7918 case canadiancxx . . $ canadian.:
7919 if(t.hourcxx . . $ QTime#hour(455f465bc33b4cdf).() >= 1)
7920 return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(1, 0, 0);
7921 else if(t.minutecxx . . $ QTime#minute(455f465bc33b4cdf).() == 0)
7922 return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(0, 1, 0);
7923 else
7924 return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(t.hourcxx . . $ QTime#hour(455f465bc33b4cdf).(), t.minutecxx . . $ QTime#minute(455f465bc33b4cdf).(), 0);
7925 case tvasiacxx . . $ tvasia.:
7926 if(t.minutecxx . . $ QTime#minute(455f465bc33b4cdf).() >= 5)
7927 return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(0, 5, 0);
7928 else
7929 {
7930 if(seconds % 10)
7931 seconds += (10 - (seconds % 10));
7932 int minutes = seconds;
7933 seconds %= 60;
7934 minutes -= seconds;
7935 minutes /= 60;
7936 return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(0, minutes, seconds);
7937 }
7938 break;
7939 default:
7940 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("unsupported CyberORO time type");
7941 break;
7942 }
7943 return t;
7944 }
7945
7946 unsigned int CyberOroConnectioncxx . . $ CyberOroConnection#::gd_checkPeriodscxx . . $ CyberOroConnection#gd_checkPeriods(c827b1ce4ef0d032).(TimeSystemcxx . . $ TimeSystem# s, unsigned int p)
7947 {
7948 switch(s)
7949 {
7950 case byoyomicxx . . $ byoyomi.:
7951 if(p == 0)
7952 return 1;
7953 else if(p > 15)
7954 return 15;
7955 else
7956 return p;
7957 break;
7958 case canadiancxx . . $ canadian.:
7959 if(p < 2)
7960 return 2;
7961 else if(p > 50)
7962 return 50;
7963 else
7964 return p;
7965 break;
7966 case tvasiacxx . . $ tvasia.:
7967 if(p == 0)
7968 return 1;
7969 else if(p > 10)
7970 return 10;
7971 else
7972 return p;
7973 break;
7974 default:
7975 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("unsupported CyberORO time type");
7976 break;
7977 }
7978 return p;
7979 }
7980
7981 const char * CyberOroConnectioncxx . . $ CyberOroConnection#::getCodecStringcxx . . $ CyberOroConnection#getCodecString(33a1f659e94feb42).(void)
7982 {
7983 return serverListcxx . . $ CyberOroConnection#serverList.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).current_server_indexcxx . . $ CyberOroConnection#current_server_index.]->codeccxx . . $ ServerItem#codec.;
7984 }
7985
7986 QStringcxx . . $ QString# CyberOroConnectioncxx . . $ CyberOroConnection#::getPlaceStringcxx . . $ CyberOroConnection#getPlaceString(4365c3963150523e).(void)
7987 {
7988 return "CyberOro: " +cxx . . $ operator+(c75c3ae4eb9af1a8). serverListcxx . . $ CyberOroConnection#serverList.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).current_server_indexcxx . . $ CyberOroConnection#current_server_index.]->namecxx . . $ ServerItem#name.;
7989 }
7990
7991 int CyberOroConnectioncxx . . $ CyberOroConnection#::time_to_secondscxx . . $ CyberOroConnection#time_to_seconds(645d6210e0be3a78).(const QStringcxx . . $ QString# & time)
7992 {
7993 QRegExpcxx . . $ QRegExp# re = QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("([0-9]{1,2}):([0-9]{1,2})"cxx . . $ QString#QString(85c52e162fed56f9).);
7994 int min, sec;
7995
7996 if(re.indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(time) >= 0)
7997 {
7998 min = re.capcxx . . $ QRegExp#cap(ce915ed341d4a7f0).(1).toIntcxx . . $ QString#toInt(d7972accae11ee1f).();
7999 sec = re.capcxx . . $ QRegExp#cap(ce915ed341d4a7f0).(2).toIntcxx . . $ QString#toInt(d7972accae11ee1f).();
8000 }
8001 else
8002 {
8003 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Bad time string");
8004 return 0xffff;
8005 }
8006
8007 return (60 * min) + sec;
8008 }