forked from FAForever/FA-Binary-Patches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpg_net.cpp
866 lines (837 loc) · 21 KB
/
gpg_net.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
#pragma GCC optimize("O3")
#include "include/desync_fix_global.h"
uint32_t tag_sent = 0;
uint32_t p_index = 0;
uint32_t sender_sock = 1;
uint32_t sync_buffer[17];
uint32_t discard = 0;
bool game_ended = false;
__attribute__((noinline)) void p_SetEvent()
{
LogF("Callback packet received, exit sync is over");
return;
}
__attribute__((noinline)) void p_Tag()
{
LogF("Tag packet sent");
return;
}
__attribute__((noinline)) void CheckClients()
{
register int eax asm("eax");
discard = 0;
for(int i = 0; i<(current_num_clients-1); i++)
{
if (sync_buffer[i] == eax)
{
LogF("Discarded: %p", eax);
discard = 1;
break;
}
}
return;
}
__attribute__((noinline)) void p_rptr()
{
register int eax asm("eax");
LogF("recv Ptr: %p", eax);
return;
}
__attribute__((noinline)) void p_sptr()
{
register int eax asm("eax");
LogF("send Ptr: %p", eax);
return;
}
void _recvfrom()
{
register int eax asm("eax");
asm(
"recvfrom = 0x00C0F8D8;" //WINAPI
"L0xABEL_0x0048A94C = 4761932;"
"SetEvent = 0x00C0F578;"
"push ebp;"
"mov ebp,esp;"
"and esp,0xFFFFFFF8;"
"push 0xFFFFFFFF;"
"push 0xBB3385;"
//"mov eax,dword ptr [0x0];"
"push eax;"
//"mov byte ptr [0],esp;"
"sub esp,0xB0;"
"push ebx;"
"push esi;"
"lea eax,dword ptr [esp+0x18];"
"push edi;"
"mov edi,ecx;"
"mov ecx,eax;"
"mov dword ptr [esp+0x20],eax;"
"mov dword ptr [esp+0x1C],ecx;"
"mov dword ptr [esp+0xC4],0x0;"
"mov ebx,dword ptr [esp+0x20];"
"lea edx,dword ptr [esp+0x1C];"
"cmp ebx,edx;"
"jne L0xABEL_0x0048A338;"
"lea eax,dword ptr [edi+0x2C];"
"cmp dword ptr [eax+0x4],eax;"
"jne L0xABEL_0x0048A2F3;"
"push 0x218;"
"call 0xA825B9;"
"add esp,0x4;"
"test eax,eax;"
"je L0xABEL_0x0048A2ED;"
"mov dword ptr [eax+0x4],eax;"
"mov dword ptr [eax],eax;"
"mov ebx,eax;"
"jmp L0xABEL_0x0048A30E;"
"L0xABEL_0x0048A2ED:;"
"xor eax,eax;"
"mov ebx,eax;"
"jmp L0xABEL_0x0048A30E;"
"L0xABEL_0x0048A2F3:;"
"add dword ptr [edi+0x34],0xFFFFFFFF;"
"mov ebx,dword ptr [eax+0x4];"
"mov eax,dword ptr [ebx];"
"mov ecx,dword ptr [ebx+0x4];"
"mov dword ptr [eax+0x4],ecx;"
"mov edx,dword ptr [ebx+0x4];"
"mov eax,dword ptr [ebx];"
"mov dword ptr [edx],eax;"
"mov dword ptr [ebx+0x4],ebx;"
"mov dword ptr [ebx],ebx;"
"L0xABEL_0x0048A30E:;"
"mov ecx,dword ptr [ebx];"
"mov edx,dword ptr [ebx+0x4];"
"mov dword ptr [ecx+0x4],edx;"
"mov eax,dword ptr [ebx+0x4];"
"mov ecx,dword ptr [ebx];"
"mov dword ptr [eax],ecx;"
"mov dword ptr [ebx],ebx;"
"mov dword ptr [ebx+0x4],ebx;"
"mov edx,dword ptr [esp+0x1C];"
"mov dword ptr [ebx],edx;"
"lea eax,dword ptr [esp+0x1C];"
"mov dword ptr [ebx+0x4],eax;"
"mov dword ptr [esp+0x1C],ebx;"
"mov ecx,dword ptr [ebx];"
"mov dword ptr [ecx+0x4],ebx;"
"L0xABEL_0x0048A338:;"
"lea edx,dword ptr [esp+0x4C];"
"push edx;" // (fromlen) An optional pointer to the size, in bytes, of the buffer pointed to by the from parameter.
"mov edx,dword ptr [edi+0x14];"
"lea ecx,dword ptr [esp+0xAC];"
"push ecx;" // (from) An optional pointer to a buffer in a sockaddr structure that will hold the source address upon return.
"push 0x0;" // (flags) A set of flags that specify the way in which the call is made.
"lea eax,dword ptr [ebx+0x18];"
"push 0x200;" //(len) The length, in bytes, of the data pointed to by the buf parameter.
"push eax;" //(buf) A buffer for the incoming data.
"push edx;" // (s)A descriptor identifying a bound socket.
"mov dword ptr [esp+0x64],0x10;"
"mov dword ptr [esp+0x3C],eax;"
"mov dword ptr [0x11FD247], eax;" //STORE NETWORK BUFFER POINTER (SEE REASON BELOW)
"call dword ptr [recvfrom];" //recvfrom RETURNS NUMBER OF BYTES WRITTEN TO THE NET BUFFER IN EAX REGISTER
"mov esi,eax;"
"mov eax, dword ptr [0x11FD247];" //RETREIVE NETBUFFER PTR
);
asm(
"cmp dword ptr [0x011FD243], 0x1;" // check if we are the sender
"jne not_sender;"
"cmp byte ptr [eax+0x3], 0xFE;"
"jne not_received;"
"cmp byte ptr [eax+0x2], 0x18;"
"jne not_received;"
"mov byte ptr [eax+0x3], 0x0;" //JUST IN CASE CLEAR THE VARIABLE FROM NET BUFFER
"mov byte ptr [eax+0x2], 0x0;" //JUST IN CASE CLEAR THE VARIABLE FROM NET BUFFER
"mov eax,dword ptr [esp+0xA8];" //get sender's socket
);
asm(
"call %[func];"
:
: [func] "i" (&CheckClients)
: "memory"
);
if(discard)
{
asm("jmp _skip;");
}
asm(
"call %[func];"
"mov eax,dword ptr [esp+0xA8];" //get sender's socket
:
: [func] "i" (&p_rptr)
: "memory"
);
p_index++;
sync_buffer[p_index] = eax;
if((current_num_clients-1) - p_index == 0)
{
asm(
"push dword ptr [0x11FD253];"
"call dword ptr [SetEvent];"
);
p_index = 0;
asm(
"call %[func];"
:
: [func] "i" (&p_SetEvent)
: "memory"
);
}
asm(
"jmp not_received;"
"not_sender:;"
"cmp byte ptr [eax+0x3], 0xA4;" //CHECK IF EXIT VARIABLE IS SET
"jne _skip;"
"cmp byte ptr [eax+0x2], 0x4E;" //CHECK IF EXIT VARIABLE IS SET
"jne _skip;"
"mov byte ptr [eax+0x3], 0x0;" //JUST IN CASE CLEAR THE VARIABLE FROM NET BUFFER
"mov byte ptr [eax+0x2], 0x0;" //JUST IN CASE CLEAR THE VARIABLE FROM NET BUFFER
"mov dword ptr [0x011FD23F], 0x1;" //WRITE INTO THE LOCAL MEMORY SO THAT BLOCK CAN READ IT LATER
"mov eax,dword ptr [esp+0xA8];" //get sender's socket
);
if(sender_sock == 1)
{
sender_sock = eax;
}
asm(
"_skip:;"
"not_received:;"
);
asm(
"test esi,esi;"
"mov dword ptr [esp+0x10],esi;"
"jl L0xABEL_0x0048A94C;" // function continues...
"jmp 0x0048A374;" //THERE ARE A LOT MORE CODE FURTHER BUT I AM LAZY TO WRITE IT BECAUSE THERE IS SWITCH CASE
//WHICH REQUIRES MANUAL CODING.
);
}
void _sendto()
{
register int eax asm("eax");
asm(
"htons = 0x00C0F8D0;"
"htonl = 0x00C0F8CC;"
"sendto = 0x00C0F8E0;"
"push 0xFFFFFFFF;"
"push 0xB9B638;"
//"mov eax,dword ptr [0x0];"
"push eax;"
//"mov dword ptr [0x0],esp;"
"sub esp,0x7C;"
"push ebx;"
"push ebp;"
"mov ebp,dword ptr [esp+0x94];"
"mov ax,word ptr [ebp+0x4A0];"
"push esi;"
"mov ebx,ecx;"
"push edi;"
"lea edi,dword ptr [ebx+0x18];"
"mov word ptr [edi+0x5],ax;"
"mov cx,word ptr [ebp+0x4A2];"
"mov word ptr [edi+0x7],cx;"
"movzx edx,word ptr [ebp+0x420];"
"push edx;"
"mov dword ptr [esp+0x18],edi;"
"mov word ptr [esp+0x28],0x2;"
"call dword ptr [htons];"
"mov word ptr [esp+0x26],ax;"
"mov eax,dword ptr [ebp+0x41C];"
"push eax;"
"call dword ptr [htonl];"
"mov edx,dword ptr [ebp+0x418];"
"mov ecx,dword ptr [ebx+0x14];"
"push 0x10;" // (tolen) The size, in bytes, of the address pointed to by the to parameter.
"mov dword ptr [esp+0x2C],eax;"
"mov eax,dword ptr [edx+0x14];"
"lea edx,dword ptr [esp+0x28];"
"push edx;" // (to) An optional pointer to a sockaddr structure that contains the address of the target socket.
"push 0x0;" // (flags) A set of flags that specify the way in which the call is made.
"push ecx;" //(len) The length, in bytes, of the data pointed to by the buf parameter.
"push edi;" //(buf) A pointer to a buffer containing the data to be transmitted.
"push eax;" // (s) A descriptor identifying a (possibly connected) socket.
"mov dword ptr [esp+0x28],ecx;"
"cmp dword ptr [0x011FD243], 0x1;" //CHECK IF SESSIONENDGAME WAS TRIGGERED (sender only)
"jne is_receiver;"
"mov eax, edi;" //if here, it is sender
"cmp byte ptr [eax + 0x3], 0;" //overwrite only known memory, ie 0
"jne skip;"
"cmp byte ptr [eax + 0x2], 0;"
"jne skip;"
"mov byte ptr [eax + 0x3], 0xA4;" //WRITE VAR INTO THE PACKET HEADER
"mov byte ptr [eax + 0x2], 0x4E;" //WRITE VAR INTO THE PACKET HEADER
"mov eax, dword ptr [edx];"
);
asm(
"call %[func];"
:
: [func] "i" (&p_sptr)
: "memory"
);
asm(
"jmp skip;"
"is_receiver:;"
"cmp dword ptr [0x011FD23F], 0x1;" //check if receiver got packet (block var)
"jne skip;"
"mov eax, dword ptr [edx];"
);
if(!terminated)
{
if(sender_sock == eax)
{
asm(
//"mov dword ptr [0x011FD23F+0x30],eax;"
"call %[func];"
:
: [func] "i" (&p_sptr)
: "memory"
);
asm(
"mov eax, edi;"
"cmp byte ptr [eax + 0x3], 0;" //overwrite only known memory, ie 0
"jne skip;"
"cmp byte ptr [eax + 0x2], 0;"
"jne skip;"
"mov byte ptr [eax + 0x3], 0xFE;" //if receiver got the packet, notify the sender with 0xFE
"mov byte ptr [eax + 0x2], 0x18;"
);
//sender_sock = 0;
}
}
asm(
"skip:;"
"call dword ptr [sendto];"
"mov esi,dword ptr [ebp+0x418];"
"call 0x489F30;"
"cmp byte ptr [0x10A6381],0x0;"
"mov ecx,dword ptr [ebp+0x41C];"
"mov esi,eax;"
"movzx eax,word ptr [ebp+0x420];"
"mov dword ptr [esp+0x1C],esi;"
"mov dword ptr [esp+0x20],edx;"
"je L0xABEL_0x00488E59;"
"mov edx,dword ptr [esp+0x10];"
"push edx;"
"push edi;"
"mov edi,dword ptr [ebp+0x418];"
"push eax;"
"mov eax,dword ptr [esp+0x2C];"
"push ecx;"
"push eax;"
"push esi;"
"xor ecx,ecx;"
"call 0x48B040;"
"mov edi,dword ptr [esp+0x14];"
"L0xABEL_0x00488E59:;"
"cmp byte ptr [edi],0x4;"
"jne L0xABEL_0x00488EC4;"
"mov ecx,ebx;"
"mov eax,ebp;"
"call 0x488170;"
"add eax,esi;"
"adc edx,dword ptr [esp+0x20];"
"add dword ptr [ebx+0x10],0x1;"
"mov dword ptr [ebx+0x8],eax;"
"mov dword ptr [ebx+0xC],edx;"
"mov eax,dword ptr [ebp+0x514];"
"lea ecx,dword ptr [ebp+0x510];"
"cmp eax,ecx;"
"je L0xABEL_0x00488EA0;"
"L0xABEL_0x00488E87:;"
"mov edx,dword ptr [ebx+0xC];"
"cmp edx,dword ptr [eax+0xC];"
"jl L0xABEL_0x00488EA0;"
"jg L0xABEL_0x00488E99;"
"mov edx,dword ptr [ebx+0x8];"
"cmp edx,dword ptr [eax+0x8];"
"jb L0xABEL_0x00488EA0;"
"L0xABEL_0x00488E99:;"
"mov eax,dword ptr [eax+0x4];"
"cmp eax,ecx;"
"jne L0xABEL_0x00488E87;"
"L0xABEL_0x00488EA0:;"
"mov ecx,dword ptr [ebx];"
"mov edx,dword ptr [ebx+0x4];"
"mov dword ptr [ecx+0x4],edx;"
"mov ecx,dword ptr [ebx+0x4];"
"mov edx,dword ptr [ebx];"
"mov dword ptr [ecx],edx;"
"mov dword ptr [ebx],ebx;"
"mov dword ptr [ebx+0x4],ebx;"
"mov ecx,dword ptr [eax];"
"mov dword ptr [ebx],ecx;"
"mov dword ptr [ebx+0x4],eax;"
"mov dword ptr [eax],ebx;"
"mov edx,dword ptr [ebx];"
"mov dword ptr [edx+0x4],ebx;"
"jmp L0xABEL_0x00488ED1;"
"L0xABEL_0x00488EC4:;"
"mov edx,dword ptr [ebp+0x418];"
"mov eax,ebx;"
"call 0x489ED0;"
"L0xABEL_0x00488ED1:;"
"mov ecx,dword ptr [esp+0x10];"
"mov edx,dword ptr [esp+0x20];"
"mov eax,dword ptr [ebp+0x418];"
"push ecx;"
"push edx;"
"push esi;"
"push 0x0;"
"lea edx,dword ptr [eax+0x80];"
"call 0x47D0A0;"
"cmp dword ptr [0x10A6384],0x2;"
"jl L0xABEL_0x0048901B;"
"lea eax,dword ptr [esp+0x6C];"
"push eax;"
"mov esi,ebx;"
"call 0x488BC0;"
"add esp,0x4;"
"mov ebx,eax;"
"mov dword ptr [esp+0x94],0x0;"
"mov edx,dword ptr [ebp];"
"mov edx,dword ptr [edx+0x18];"
"lea eax,dword ptr [esp+0x50];"
"push eax;"
"mov ecx,ebp;"
"call edx;"
"mov dword ptr [esp+0x14],eax;"
"mov eax,dword ptr [esp+0x20];"
"mov ecx,dword ptr [esp+0x1C];"
"push eax;"
"push ecx;"
"lea esi,dword ptr [esp+0x3C];"
"mov byte ptr [esp+0x9C],0x1;"
"call 0x485CB0;"
"add esp,0x8;"
"mov esi,0x10;"
"mov byte ptr [esp+0x94],0x2;"
"cmp dword ptr [ebx+0x18],esi;"
"jb L0xABEL_0x00488F60;"
"mov ebx,dword ptr [ebx+0x4];"
"jmp L0xABEL_0x00488F63;"
"L0xABEL_0x00488F60:;"
"add ebx,0x4;"
"L0xABEL_0x00488F63:;"
"mov ecx,dword ptr [esp+0x14];"
"cmp dword ptr [ecx+0x18],esi;"
"jb L0xABEL_0x00488F71;"
"mov ecx,dword ptr [ecx+0x4];"
"jmp L0xABEL_0x00488F74;"
"L0xABEL_0x00488F71:;"
"add ecx,0x4;"
"L0xABEL_0x00488F74:;"
"cmp dword ptr [eax+0x18],esi;"
"jb L0xABEL_0x00488F7E;"
"mov eax,dword ptr [eax+0x4];"
"jmp L0xABEL_0x00488F81;"
"L0xABEL_0x00488F7E:;"
"add eax,0x4;"
"L0xABEL_0x00488F81:;"
"push 0xE00779;"
"push ebx;"
"push ecx;"
"push eax;"
"push 0xE05AB0;"
"call 0x937C30;"
"add esp,0x14;"
"cmp dword ptr [esp+0x4C],esi;"
"jb L0xABEL_0x00488FA9;"
"mov edx,dword ptr [esp+0x38];"
"push edx;"
"call 0x957A60;"
"add esp,0x4;"
"L0xABEL_0x00488FA9:;"
"xor ebx,ebx;"
"cmp dword ptr [esp+0x68],esi;"
"mov dword ptr [esp+0x4C],0xF;"
"mov dword ptr [esp+0x48],ebx;"
"mov byte ptr [esp+0x38],bl;"
"jb L0xABEL_0x00488FCE;"
"mov eax,dword ptr [esp+0x54];"
"push eax;"
"call 0x957A60;"
"add esp,0x4;"
"L0xABEL_0x00488FCE:;"
"mov dword ptr [esp+0x94],0xFFFFFFFF;"
"cmp dword ptr [esp+0x84],esi;"
"mov dword ptr [esp+0x68],0xF;"
"mov dword ptr [esp+0x64],ebx;"
"mov byte ptr [esp+0x54],0x0;"
"jb L0xABEL_0x00489000;"
"mov ecx,dword ptr [esp+0x70];"
"push ecx;"
"call 0x957A60;"
"add esp,0x4;"
"L0xABEL_0x00489000:;"
"mov esi,dword ptr [esp+0x1C];"
"mov dword ptr [esp+0x84],0xF;"
"mov dword ptr [esp+0x80],ebx;"
"mov byte ptr [esp+0x70],0x0;"
"L0xABEL_0x0048901B:;"
"add word ptr [ebp+0x4A0],0x1;"
"xor ebx,ebx;"
"lea ecx,dword ptr [ebp+0x4B8];"
"mov word ptr [ebp+0x4A2],bx;"
"call 0x9566C0;"
"test eax,eax;"
"je L0xABEL_0x00489077;"
"mov eax,dword ptr [0xF58DE4];"
"push ebx;"
"cdq;"
"push 0x3E8;"
"push edx;"
"push eax;"
"call 0xA899A0;"
"mov esi,dword ptr [ebp+0x418];"
"mov ebx,eax;"
"mov dword ptr [esp+0x18],edx;"
"call 0x489F30;"
"mov esi,dword ptr [esp+0x1C];"
"add eax,ebx;"
"adc edx,dword ptr [esp+0x18];"
"mov dword ptr [ebp+0x4A8],eax;"
"mov dword ptr [ebp+0x4AC],edx;"
"jmp L0xABEL_0x00489083;"
"L0xABEL_0x00489077:;"
"mov dword ptr [ebp+0x4A8],ebx;"
"mov dword ptr [ebp+0x4AC],ebx;"
"L0xABEL_0x00489083:;"
"movzx eax,word ptr [edi+0x5];"
"movzx edx,ax;"
"and edx,0x8000007F;"
"jns L0xABEL_0x00489097;"
"dec edx;"
"or edx,0xFFFFFF80;"
"inc edx;"
"L0xABEL_0x00489097:;"
"shl edx,0x4;"
"mov word ptr [edx+ebp+0x518],ax;"
"movzx ecx,word ptr [edi+0x5];"
"and ecx,0x8000007F;"
"jns L0xABEL_0x004890B3;"
"dec ecx;"
"or ecx,0xFFFFFF80;"
"inc ecx;"
"L0xABEL_0x004890B3:;"
"add ecx,0x52;"
"shl ecx,0x4;"
"add ecx,ebp;"
"call 0x9556F0;"
"mov eax,dword ptr [esp+0x20];"
"push eax;"
"push esi;"
"mov esi,ebp;"
"call 0x488260;"
"add eax,dword ptr [esp+0x10];"
"mov ecx,dword ptr [esp+0x20];"
"mov dword ptr [ebp+0x438],eax;"
"mov eax,dword ptr [esp+0x1C];"
"mov dword ptr [ebp+0x430],eax;"
"mov dword ptr [ebp+0x434],ecx;"
"cmp byte ptr [edi],0x5;"
"je L0xABEL_0x004890FC;"
"mov dword ptr [ebp+0x448],eax;"
"mov dword ptr [ebp+0x44C],ecx;"
"L0xABEL_0x004890FC:;"
"cmp byte ptr [edi],0x6;"
"jne L0xABEL_0x0048910B;"
"mov dword ptr [ebp+0x450],0x1E8480;"
"L0xABEL_0x0048910B:;"
"mov ecx,dword ptr [esp+0x8C];"
"pop edi;"
"pop esi;"
"pop ebp;"
//"mov dword ptr [0x0],ecx;"
"pop ebx;"
"add esp,0x88;"
"ret 0x4;"
);
}
void Gpg_Net_Entry()
{
asm(
"GetCurrentThread = 0x00C0F588;"
"SetThreadPriority = 0x00C0F52C;"
"WSAWaitForMultipleEvents = 0x00C0F930;"
"WSAResetEvent = 0x00C0F8FC;"
"CreateEvent = 0x00C0F57C;"
"push 0xFFFFFFFF;"
"push 0xBB33B8;"
// "mov eax,dword ptr [0x0];"
"push eax;"
// "mov dword ptr [0x0],esp;"
"sub esp,0x58;"
"push ebx;"
"push ebp;"
"push esi;"
"push edi;"
"mov edi,ecx;"
"mov dword ptr [esp+0x14],edi;"
"mov dword ptr [esp+0x70],0x0;"
"mov eax,dword ptr [edi];"
"mov edx,dword ptr [eax+0xC];"
"call edx;"
"movzx eax,ax;"
"push eax;"
"lea ecx,dword ptr [esp+0x34];"
"push 0xE05B04;"
"push ecx;"
"call 0x938F10;"
"add esp,0xC;"
"mov byte ptr [esp+0x70],0x1;"
"cmp dword ptr [esp+0x48],0x10;"
"mov eax,dword ptr [esp+0x34];"
"jae L0xABEL_0x00489FEB;"
"lea eax,dword ptr [esp+0x34];"
"L0xABEL_0x00489FEB:;"
"push eax;"
"push 0xFFFFFFFF;"
"call 0x9071D0;"
"add esp,0x8;"
"xor bl,bl;"
"call 0x4141A0;"
"push 0x2;"
"call dword ptr [GetCurrentThread];"
"push eax;"
"call dword ptr [SetThreadPriority];"
"xor ecx, ecx;"
"push ecx;"
"push ecx;"
"push ecx;"
"push ecx;"
"call dword ptr [CreateEvent];"
"mov dword ptr [0x11FD253], eax;"
"lea ecx,dword ptr [edi+0x8];"
"mov dword ptr [esp+0x1C],ecx;"
"call 0xAC51B0;"
"mov byte ptr [esp+0x20],0x1;"
"mov byte ptr [esp+0x70],0x2;"
"L0xABEL_0x0048A022:;"
"cmp byte ptr [0x10A6381],0x0;"
"jne L0xABEL_0x0048A048;"
"mov eax,dword ptr [edi+0x18088];"
"test eax,eax;"
"je L0xABEL_0x0048A048;"
"push eax;"
"call 0xA8540F;"
"add esp,0x4;"
"mov dword ptr [edi+0x18088],0x0;"
"L0xABEL_0x0048A048:;"
"mov ecx,edi;"
"call 0x48A280;"
"mov ecx,edi;"
"call 0x48AC40;"
"cmp byte ptr [edi+0x50],0x0;"
"mov ebx,eax;"
"mov dword ptr [esp+0x18],ebx;"
"je L0xABEL_0x0048A0AC;"
"cmp byte ptr [edi+0x51],0x0;"
"jne L0xABEL_0x0048A0AC;"
"mov esi,dword ptr [edi+0x28];"
"lea ebx,dword ptr [edi+0x24];"
"cmp esi,ebx;"
"je L0xABEL_0x0048A09F;"
"L0xABEL_0x0048A072:;"
"test esi,esi;"
"je L0xABEL_0x0048A07E;"
"lea ebp,dword ptr [esi-0x410];"
"jmp L0xABEL_0x0048A080;"
"L0xABEL_0x0048A07E:;"
"xor ebp,ebp;"
"L0xABEL_0x0048A080:;"
"cmp byte ptr [ebp+0xE41],0x0;"
"mov esi,dword ptr [esi+0x4];"
"je L0xABEL_0x0048A09B;"
"push ebp;"
"call 0x486150;"
"push ebp;"
"call 0x957A60;"
"add esp,0x4;"
"L0xABEL_0x0048A09B:;"
"cmp esi,ebx;"
"jne L0xABEL_0x0048A072;"
"L0xABEL_0x0048A09F:;"
"cmp dword ptr [ebx+0x4],ebx;"
"je L0xABEL_0x0048A1D5;"
"mov ebx,dword ptr [esp+0x18];"
"L0xABEL_0x0048A0AC:;"
"mov ecx,dword ptr [esp+0x1C];"
"call 0xAC5200;"
"cmp byte ptr [0x10A6380],0x0;"
"mov byte ptr [esp+0x20],0x0;"
"je L0xABEL_0x0048A0CA;"
"mov dword ptr [0x0], eax;"
"L0xABEL_0x0048A0CA:;"
"xor ebp,ebp;"
"cmp dword ptr [0x10A6384],0x3;"
"mov dword ptr [esp+0x28],ebp;"
"jl L0xABEL_0x0048A132;"
"mov esi,edi;"
"call 0x489F30;"
"mov ebp,eax;"
"push edx;"
"push ebp;"
"lea esi,dword ptr [esp+0x54];"
"mov dword ptr [esp+0x30],edx;"
"call 0x485CB0;"
"add esp,0x8;"
"mov esi,0x10;"
"mov byte ptr [esp+0x70],0x3;"
"cmp dword ptr [eax+0x18],esi;"
"jb L0xABEL_0x0048A108;"
"mov eax,dword ptr [eax+0x4];"
"jmp L0xABEL_0x0048A10B;"
"L0xABEL_0x0048A108:;"
"add eax,0x4;"
"L0xABEL_0x0048A10B:;"
"push ebx;"
"push eax;"
"push 0xE05B24;"
"call 0x937C30;"
"add esp,0xC;"
"mov byte ptr [esp+0x70],0x2;"
"cmp dword ptr [esp+0x64],esi;"
"jb L0xABEL_0x0048A132;"
"mov edx,dword ptr [esp+0x50];"
"push edx;"
"call 0x957A60;"
"add esp,0x4;"
"L0xABEL_0x0048A132:;"
"push 0x1;"
"push ebx;"
"push 0x0;"
"lea eax,dword ptr [edi+0x18];"
"push eax;"
"push 0x1;"
"call dword ptr [WSAWaitForMultipleEvents];"
"mov eax,ebp;"
"or eax,dword ptr [esp+0x28];"
"je L0xABEL_0x0048A1B8;"
"mov esi,edi;"
"call 0x489F30;"
"mov ebx,edx;"
"mov edi,eax;"
"push ebx;"
"push edi;"
"lea esi,dword ptr [esp+0x54];"
"call 0x485CB0;"
"add esp,0x8;"
"mov byte ptr [esp+0x70],0x4;"
"cmp dword ptr [eax+0x18],0x10;"
"jb L0xABEL_0x0048A174;"
"mov esi,dword ptr [eax+0x4];"
"jmp L0xABEL_0x0048A177;"
"L0xABEL_0x0048A174:;"
"lea esi,dword ptr [eax+0x4];"
"L0xABEL_0x0048A177:;"
"push 0x0;"
"sub edi,ebp;"
"sbb ebx,dword ptr [esp+0x2C];"
"push 0x3E8;"
"push ebx;"
"push edi;"
"call 0xA8EB30;"
"push edx;"
"push eax;"
"push esi;"
"push 0xE05B40;"
"call 0x937C30;"
"add esp,0x10;"
"mov byte ptr [esp+0x70],0x2;"
"cmp dword ptr [esp+0x64],0x10;"
"jb L0xABEL_0x0048A1B4;"
"mov ecx,dword ptr [esp+0x50];"
"push ecx;"
"call 0x957A60;"
"add esp,0x4;"
"L0xABEL_0x0048A1B4:;"
"mov edi,dword ptr [esp+0x14];"
"L0xABEL_0x0048A1B8:;"
"mov ecx,dword ptr [esp+0x1C];"
"call 0xAC51B0;"
"mov edx,dword ptr [edi+0x18];"
"push edx;"
"mov byte ptr [esp+0x24],0x1;"
"call dword ptr [WSAResetEvent];"
"jmp L0xABEL_0x0048A022;"
"L0xABEL_0x0048A1D5:;"
"mov ecx,dword ptr [esp+0x1C];"
"call 0xAC5200;"
"cmp dword ptr [esp+0x48],0x10;"
"jb L0xABEL_0x0048A1F2;"
"mov eax,dword ptr [esp+0x34];"
"push eax;"
"call 0x957A60;"
"add esp,0x4;"
"L0xABEL_0x0048A1F2:;"
"mov dword ptr [esp+0x70],0xFFFFFFFF;"
"mov esi,dword ptr [esp+0x7C];"
"test esi,esi;"
"mov dword ptr [esp+0x48],0xF;"
"mov dword ptr [esp+0x44],0x0;"
"mov byte ptr [esp+0x34],0x0;"
"je L0xABEL_0x0048A241;"
"lea ecx,dword ptr [esi+0x4];"
"or edx,0xFFFFFFFF;"
"lock xadd dword ptr [ecx],edx;"
"jne L0xABEL_0x0048A241;"
"mov eax,dword ptr [esi];"
"mov edx,dword ptr [eax+0x4];"
"mov ecx,esi;"
"call edx;"
"lea eax,dword ptr [esi+0x8];"
"or ecx,0xFFFFFFFF;"
"lock xadd dword ptr [eax],ecx;"
"jne L0xABEL_0x0048A241;"
"mov edx,dword ptr [esi];"
"mov eax,dword ptr [edx+0x8];"
"mov ecx,esi;"
"call eax;"
"L0xABEL_0x0048A241:;"
"mov ecx,dword ptr [esp+0x68];"
"pop edi;"
"pop esi;"
"pop ebp;"
//"mov dword ptr [0x0],ecx;"
"pop ebx;"
"add esp,0x64;"
"ret 0x8;"
);
}
void EndGame()
{
game_ended = true;
asm("mov dword ptr [0x011FD23F], 0xB;"); //remove block when last player remains.
asm(
"push esi;"
"mov esi,eax;"
"mov eax,dword ptr [esi];"
"push edi;"
"mov edi,dword ptr [0x10BA600];"
"push eax;"
"call 0x90C590;"
"add esp,0x4;"
"test eax,eax;"
"je L0xABEL_0x0074B8DB;"
"push eax;"
"push 0x0;"
"push edi;"
"push 0xE0A220;"
"push esi;"
"call 0x90C1D0;"
"add esp,0x14;"
"L0xABEL_0x0074B8DB:;"
"mov esi,dword ptr [esi];"
"push esi;"
"call 0x924050;"
"mov edx,dword ptr [eax];"
"mov ecx,eax;"
"mov eax,dword ptr [edx+0x5C];"
"add esp,0x4;"
"call eax;"
"pop edi;"
"xor eax,eax;"
"pop esi;"
"ret;"
);
}
#pragma GCC reset_options