-
Notifications
You must be signed in to change notification settings - Fork 9
/
GM9Megascript.gm9
1960 lines (1538 loc) · 59.2 KB
/
GM9Megascript.gm9
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
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nCredits:\nd0k3\n8bitwonder\nwindows_server_2003\nSvenDaHacker64\nMyLegGuy\nemillois\nAnalogMan151\nTurdPooCharger\netc."
set GM9IN "0:/gm9/in"
if not find $[GM9IN] NULL
mkdir $[GM9IN]
end
#####################Main Menu####################
@Start
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nCredits:\nd0k3\n8bitwonder\nwindows_server_2003\nSvenDaHacker64\nMyLegGuy\nemillois\nAnalogMan151\nTurdPooCharger\netc."
labelsel -o -s "Choose an Option." MainMenu_*
goto Start
##################Backup Options##################
@MainMenu_Backup_Options
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nBackup Options"
labelsel -o -s "Choose an Option." Backup_Options_*
goto Start
##################SysNAND Backup##################
@Backup_Options_SysNAND_Backup
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nBackup Options\n>SysNAND Backup"
if not ask "Create a SysNAND backup in $[GM9OUT]?\n \nPlease make sure you have\nenough storage space."
goto MainMenu_Backup_Options
end
findnot $[GM9OUT]/$[DATESTAMP]_$[SERIAL]_sysnand_??.bin OUTPATH
if cp -h S:/nand_minsize.bin $[OUTPATH]
echo "Backup created successfully:\n$[OUTPATH]"
else
echo "Backup failed."
end
goto MainMenu_Backup_Options
##################EmuNAND Backup##################
@Backup_Options_EmuNAND_Backup
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nBackup Options\n>EmuNAND Backup"
if not ask "Create a EmuNAND backup in $[GM9OUT]?\n \nPlease make sure you have\nenough storage space."
goto MainMenu_Backup_Options
end
findnot $[GM9OUT]/$[DATESTAMP]_$[SERIAL]_emunand_??.bin OUTPATH
if cp -h E:/nand_minsize.bin $[OUTPATH]
echo "Backup created successfully:\n$[OUTPATH]"
else
echo "Backup failed."
end
goto MainMenu_Backup_Options
##################Restore Options#################
@MainMenu_Restore_Options
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nRestore Options"
labelsel -o -s "Choose an Option." Restore_Options_*
goto Start
##############SysNAND Restore (full)##############
@Restore_Options_SysNAND_Restore_(full)
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nRestore Options\n>SysNAND Restore (full)"
if not ask "!!WARNING!!\nSystem exploit will not be protected!\nProceed only if you know what you're doing!\n \nContinue?"
goto MainMenu_Restore_Options
end
if not filesel "Select NAND Backup." $[GM9OUT]/*nand_??.bin NANDBAK
echo "Operation cancelled."
goto MainMenu_Restore_Options
end
if not ask "Full Restore?\n$[NANDBAK]"
echo "Operation cancelled."
goto MainMenu_Restore_Options
end
if not allow -a S:
echo "Permissions denied. Aborting"
goto MainMenu_Restore_Options
end
imgmount $[NANDBAK]
if not verify I:/nand_minsize.bin
echo "Not a valid NAND backup. Aborting."
goto MainMenu_Restore_Options
end
if inject -n I:/nand_minsize.bin S:/nand.bin@0
imgumount
echo "$[NANDBAK]\nsuccessfully restored to SysNAND."
else
echo "An error occurred during the transfer\nPlease try again."
end
goto MainMenu_Restore_Options
##############SysNAND Restore (safe)##############
@Restore_Options_SysNAND_Restore_(safe)
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nRestore Options\n>SysNAND Restore (safe)"
if chk $[HAX] ""
echo "No qualifying exploit was found.\nAborting to avoid bricking the unit."
goto MainMenu_Restore_Options
elif chk $[HAX] "ntrboot"
echo "Safe restore is not available on\nntrboot. Aborting to avoid a brick."
goto MainMenu_Restore_Options
end
if not filesel "Select NAND Backup." $[GM9OUT]/*nand_??.bin NANDBAK
echo "Operation cancelled."
goto MainMenu_Restore_Options
end
if not allow -a S:
echo "Permissions denied. Aborting"
goto MainMenu_Restore_Options
end
imgmount $[NANDBAK]
find I:/ctrnand_full.bin NULL
find I:/twln.bin NULL
find I:/twlp.bin NULL
cp -w -n I:/ctrnand_full.bin S:/ctrnand_full.bin
cp -w -n I:/twln.bin S:/twln.bin
cp -w -n I:/twlp.bin S:/twlp.bin
imgumount
echo "$[NANDBAK]\nsuccessfully restored to SysNAND."
goto MainMenu_Restore_Options
##################EmuNAND Restore#################
@Restore_Options_EmuNAND_Restore
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nRestore Options\n>EmuNAND Restore"
if findnot E:/ NULL
echo "No EmuNAND detected. Aborting."
goto MainMenu_Restore_Options
end
if not filesel "Select NAND Backup." $[GM9OUT]/*nand_??.bin NANDBAK
goto MainMenu_Restore_Options
end
if not ask "Restore\n$[NANDBAK]\nto EmuNAND?"
echo "Operation cancelled."
goto MainMenu_Restore_Options
end
if not allow -a E:
echo "Permissions denied. Aborting."
goto MainMenu_Restore_Options
end
imgmount $[NANDBAK]
inject -n I:/nand_minsize.bin E:/nand.bin@0
imgumount
echo "$[NANDBAK] successfully restored to EmuNAND."
goto MainMenu_Restore_Options
#################CTRNAND Transfer#################
@MainMenu_CTRNAND_Transfer
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nCTRNAND Transfer"
if not filesel "Select a CTRNAND transfer file.\nCTRNAND transfer file should be located in\n$[GM9IN] folder." $[GM9IN]/*ctrtransfer*.bin CTRNAND
goto Start
end
if not ask "CTRTransfer\n$[CTRNAND]\nto sysNAND?"
goto Start
end
strsplit ACTYPE $[CTRNAND] "_"
strsplit -b -f ACTYPE $[ACTYPE] "."
if chk $[ACTYPE] $[ONTYPE]
else
if ask "!!WARNING!!\nIt seems like the CTRTransfer file is\nintended for $[ACTYPE]!\n \nContinue anyway?"
else
goto Start
end
end
if not allow -a 1:
echo "Permissions denied. Aborting."
goto Start
end
if find 1:/rw/sys/SecureInfo_A SECNFO
elif find 1:/rw/sys/SecureInfo_B SECNFO
else
cp -n 1:/rw/sys/SecureInfo_C 1:/rw/sys/SecureInfo_A
end
cp -n -w -o -s $[SECNFO] 1:/rw/sys/SecureInfo_C
imgmount $[CTRNAND]
inject 7:/rw/sys/SecureInfo_A@100:1 1:/rw/sys/SecureInfo_C@100
rm -o -s 1:/dbs/ticket.bak
mv 1:/dbs/ticket.db 1:/ticket.bak
rm 1:/dbs
rm 1:/title
mkdir 1:/dbs
mkdir 1:/title
cp -n -w 7:/dbs 1:/dbs
cp -n -w 7:/title 1:/title
fixcmac 1:/dbs
fixcmac 1:/title
mv -n -w 1:/ticket.bak 1:/dbs/ticket.bak
imgumount
echo "CTRNAND transfer successful."
goto Start
####################Hax Options###################
@MainMenu_Hax_Options
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nHax Options"
labelsel -o -s "Choose an Option." Hax_Options_*
goto Start
############Boot9Strap Install Options############
@Hax_Options_Install_Boot9Strap
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nHax Options\n>Boot9strap Install Options"
labelsel -o -s "Choose an Option." Install_Boot9Strap_*
goto MainMenu_Hax_Options
#############Normal Boot9Strap Install############
@Install_Boot9Strap_Normal_Install
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nHax Options\n>Boot9strap Install Options\n>>Normal Boot9strap Install"
if not ask "Install Boot9Strap Normally?\nYou should have the boot9strap files in\n0:/boot9strap/ before proceeding."
goto Hax_Options_Install_Boot9Strap
end
if not find 0:/boot9strap/boot9stra*.firm B9S
echo "Boot9Strap file not found! Aborting."
goto Hax_Options_Install_Boot9Strap
end
if not sha $[B9S] $[B9S].sha
echo "Hash check failed on Boot9Strap file. Aborting."
goto Hax_Options_Install_Boot9Strap
end
if chk $[ONTYPE] "N3DS"
if not sha S:/sector0x96.bin 82F2730D2C2DA3F30165F987FDCCAC5CBAB24B4E5F65C981CD7BE6F438E6D9D3
if not find 0:/boot9strap/secret_sector.bin SECRET
echo "Sector 0x96 is not genuine.\nYou must have the secret_sector.bin file in the\nboot9strap folder first then try again.\n \nAborting."
goto Hax_Options_Install_Boot9Strap
end
if not allow -a S:
echo "Permissions denied. Aborting."
goto Hax_Options_Install_Boot9Strap
end
cp -n -w S:/sector0x96.bin $[SECRET].bak
cp -n -w $[SECRET] S:/sector0x96.bin
echo "sector 0x96 successfully fixed.\nProceeding with B9S Install."
end
end
if allow -a S:
allow -a 0:
cp -w -o -s -n S:/firm0.bin $[GM9OUT]/$[SERIAL]_firm0.bin
cp -w -o -s -n S:/firm1.bin $[GM9OUT]/$[SERIAL]_firm1.bin
cp -w -n $[B9S] S:/firm0.bin
cp -w -n $[B9S] S:/firm1.bin
echo "Boot9Strap successfully installed."
else
echo "Permissions denied. Aborting."
end
goto Hax_Options_Install_Boot9Strap
############PC-Less Boot9Strap Install############
@Install_Boot9Strap_PC-Less_Install
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nHax Options\n>Boot9strap Install Options\n>>PC-Less Boot9strap Install"
if not ask "Proceed with PC-Less B9S Installation?\nYou should have the in-files in you SDMC.\nSee GM9Megascript Repo for more details."
goto Hax_Options_Install_Boot9Strap
end
if not find $[GM9IN]/boot9strap/boot9stra*.firm B9S
echo "Boot9Strap file not found! Aborting."
goto Hax_Options_Install_Boot9Strap
end
if not find $[GM9IN]/Luma3DS LUMA
echo "Luma3DS not found! Aborting."
goto Hax_Options_Install_Boot9Strap
end
if not find $[GM9IN]/sdcompiled SDCOMP
echo "SD compiled files not found! Aborting."
goto Hax_Options_Install_Boot9Strap
end
if not sha $[B9S] $[B9S].sha
echo "Hash check failed on Boot9Strap file. Aborting."
goto Hax_Options_Install_Boot9Strap
end
if not ask "All checks passed. Proceed?\n(No turning back after this point.)"
echo "User aborted."
goto Hax_Options_Install_Boot9Strap
end
if chk $[ONTYPE] "N3DS"
if not sha S:/sector0x96.bin 82F2730D2C2DA3F30165F987FDCCAC5CBAB24B4E5F65C981CD7BE6F438E6D9D3
if not find $[GM9IN]/boot9strap/secret_sector.bin SECRET
echo "Sector 0x96 is not genuine.\nYou must have the secret_sector.bin file in the\nboot9strap folder first then try again.\n \nAborting."
goto Hax_Options_Install_Boot9Strap
end
if not allow -a S:
echo "Permissions denied. Aborting."
goto Hax_Options_Install_Boot9Strap
end
cp -n -w S:/sector0x96.bin $[SECRET].bak
cp -n -w $[SECRET] S:/sector0x96.bin
echo "sector 0x96 successfully fixed.\nProceeding with B9S Install."
end
end
if allow -a S:
allow -a 0:
allow -a 1:
allow -a 9:
else
echo "Permissions denied. Aborting."
goto Hax_Options_Install_Boot9Strap
end
cp -w -o -s -n S:/firm0.bin 9:/sdcompiled/gm9/out/$[SERIAL]_firm0.bin
cp -w -o -s -n S:/firm1.bin 9:/sdcompiled/gm9/out/$[SERIAL]_firm1.bin
cp -w -n $[B9S] S:/firm0.bin
cp -w -n $[B9S] S:/firm1.bin
rm -o -s 1:/boot.*
rm -o -s 1:/rw/luma
cp -w -n $[LUMA] 1:/
mv -w -n 1:/luma 1:rw/luma
cp -w -n $[SDCOMP] 9:/sdcompiled
cp -w -n $[LUMA] 9:/sdcompiled
cp -w -n -o -s $[GM9IN]/FBI 9:/sdcompiled/1cia/hb
@SwapSD
if switchsd "Swap SD card now."
if find $[GM9IN] NULL
if not ask "Seems like SD cards are not swapped, continue anyway?"
goto SwapSD
end
end
echo "Moving compiled files from RAM to target SD."
mv -w -n 9:/sdcompiled 0:/
echo "Boot9strap successfully installed."
if ask "Do you want to inject FBI to H&S?"
goto FBI_Inject_FBI_to_H&S
end
else
echo "SD read error!\nPlease try again."
goto SwapSD
end
goto Hax_Options_Install_Boot9Strap
###################Hax Uninstall##################
@Hax_Options_Un-install_Hax
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nHax Options\n>Hax Un-install"
if not ask "!!WARNING!!\nThis will completely remove CFW and\nrevert your system to stock.\n \nProceed anyway?"
goto MainMenu_Hax_Options
end
if not chk -u $[HAX] "ntrboot"
if not ask "!!WARNING!!\nntrboot not detected!\nYou should at least have ntrboot or a hardmod\nwith you before proceeding in case of brick.\n \nProceed anyway?"
goto MainMenu_Restore_Options
end
end
if chk -u $[ONTYPE] "N3DS"
goto Unhax_Old
end
if not sha S:/sector0x96.bin 82F2730D2C2DA3F30165F987FDCCAC5CBAB24B4E5F65C981CD7BE6F438E6D9D3
if not find 0:/boot9strap/secret_sector.bin SECRET
if not find $[GM9IN]/boot9strap/secret_sector.bin SECRET
echo "Sector 0x96 is not genuine.\nYou must have the secret_sector.bin file in the\nboot9strap folder first then try again.\n \nAborting."
goto Hax_Options_Install_Boot9Strap
end
end
if not allow -a S:
echo "Permissions denied. Aborting."
goto MainMenu_Hax_Options
end
cp -n -w S:/sector0x96.bin $[SECRET].bak
cp -n -w $[SECRET] S:/sector0x96.bin
end
if not find 1:/title/00040138/20000002/content/????????.app NATIVE_NCCH
echo "NATIVE_FIRM not found.\nIs this a N3DS?"
goto MainMenu_Hax_Options
end
imgmount $[NATIVE_NCCH]
verify G:/exefs/.firm
set NATIVE_FIRM $[GM9OUT]/NATIVE_FIRM.firm
cp -w G:/exefs/.firm $[NATIVE_FIRM]
imgumount
if allow -a S:
allow -a 1:
rm -o -s 1:/boot.firm
rm -o -s 1:/rw/luma
cp -n $[NATIVE_FIRM] S:/firm0.bin
cp -n $[NATIVE_FIRM] S:/firm1.bin
echo "CFW un-installed successfully"
else
echo "Permissions denied. Aborting."
end
goto MainMenu_Hax_Options
@Unhax_Old
if not find 1:/title/00040138/00000002/content/????????.app NATIVE_NCCH
echo "NATIVE_FIRM not found.\nIs this an O3DS?"
goto MainMenu_Hax_Options
end
imgmount $[NATIVE_NCCH]
verify G:/exefs/.firm
set NATIVE_FIRM $[GM9OUT]/NATIVE_FIRM.firm
cp -w G:/exefs/.firm $[NATIVE_FIRM]
imgumount
if allow S:/nand.bin
allow 1:
rm -o -s 1:/boot.firm
rm -o -s 1:/rw/luma
cp -n $[NATIVE_FIRM] S:/firm0.bin
cp -n $[NATIVE_FIRM] S:/firm1.bin
echo "CFW uninstalled successfully"
else
echo "Permissions denied. Aborting."
end
goto MainMenu_Hax_Options
################FBI to H&S Options################
@MainMenu_FBI_to_H&S_Options
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nFBI to H&S Options"
labelsel -o -s "Choose an Option." FBI_*
goto Start
#################Inject FBI to H&S################
@FBI_Inject_FBI_to_H&S
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nFBI to H&S Options\n>Inject FBI to H&S"
if not ask "Inject FBI to H&S?"
goto MainMenu_FBI_to_H&S_Options
end
if not find $[GM9IN]/FBI/FBI.cia FBISRC
if not find 0:/1cia/hb/FBI.cia FBISRC
if not filesel -d "FBI.cia not found. Select manually." 0:/*.cia FBISRC
goto MainMenu_FBI_to_H&S_Options
end
if not ask "Is this correct?\n \n$[FBISRC]"
goto MainMenu_FBI_to_H&S_Options
end
end
end
if chk $[REGION] "USA"
if chk $[ONTYPE] "n3ds"
find -f 1:/title/00040010/20021300/content/*.app H&SPATH
else
find -f 1:/title/00040010/00021300/content/*.app H&SPATH
end
elif chk $[REGION] "EUR"
if chk $[ONTYPE] "n3ds"
find -f 1:/title/00040010/20022300/content/*.app H&SPATH
else
find -f 1:/title/00040010/00022300/content/*.app H&SPATH
end
elif chk $[REGION] "JPN"
if chk $[ONTYPE] "n3ds"
find -f 1:/title/00040010/20020300/content/*.app H&SPATH
else
find -f 1:/title/00040010/00020300/content/*.app H&SPATH
end
elif chk $[REGION] "KOR"
if chk $[ONTYPE] "n3ds"
find -f 1:/title/00040010/20027300/content/*.app H&SPATH
else
find -f 1:/title/00040010/00027300/content/*.app H&SPATH
end
elif chk $[REGION] "CHN"
if chk $[ONTYPE] "n3ds"
find -f 1:/title/00040010/20026300/content/*.app H&SPATH
else
find -f 1:/title/00040010/00026300/content/*.app H&SPATH
end
elif chk $[REGION] "TWN"
if chk $[ONTYPE] "n3ds"
find -f 1:/title/00040010/20028300/content/*.app H&SPATH
else
find -f 1:/title/00040010/00028300/content/*.app H&SPATH
end
else
echo "Unknown region. Aborting."
rm -o -s $[GM9TEMP]
goto MainMenu_FBI_to_H&S_Options
end
if not allow -a 1:/
echo "Permissions denied. Aborting"
rm -o -s $[GM9TEMP]
goto MainMenu_FBI_to_H&S_Options
end
strsplit -b H&SBAK $[H&SPATH] "."
set H&SBAK "$[H&SBAK].bak"
if find $[H&SBAK] NULL
mv -w -k -n $[H&SBAK] $[H&SPATH]
end
set GM9TEMP "0:/gm9/temp"
if not find $[GM9TEMP] NULL
mkdir $[GM9TEMP]
end
imgmount "$[FBISRC]"
find G:/*.app FBIAPP
strsplit FBINC $[FBIAPP] "/"
strsplit -b FBINC $[FBINC] "."
cp -n -w $[FBIAPP] $[GM9TEMP]/00000002.app
cp -n -w G:/$[FBINC]/ncch.bin $[GM9TEMP]/FBIncch.bin
imgumount
imgmount $[H&SPATH]
cp -n -w G:/ncch.bin $[GM9TEMP]/H&Sncch.bin
imgumount
set FBI "$[GM9TEMP]/FBIncch.bin"
set H&S "$[GM9TEMP]/H&Sncch.bin"
inject -n $[FBI]@104:2 $[H&S]@104
inject -n $[FBI]@111:1 $[H&S]@111
inject -n $[FBI]@130:D0 $[H&S]@130
inject -n $[H&S]@000:200 $[GM9TEMP]/00000002.app@000
inject -n $[H&S]@108:008 $[GM9TEMP]/00000002.app@3C8
inject -n $[H&S]@108:008 $[GM9TEMP]/00000002.app@400
inject -n $[H&S]@108:008 $[GM9TEMP]/00000002.app@800
@hashext
if not shaget $[GM9TEMP]/00000002.app@200:400 $[GM9TEMP]/00000002.app.sha
goto hashext
end
inject -n $[GM9TEMP]/00000002.app.sha@000:020 $[GM9TEMP]/00000002.app@160
@ench&s
if not encrypt $[GM9TEMP]/00000002.app
goto ench&s
end
mv $[H&SPATH] $[H&SBAK]
mv -w $[GM9TEMP]/00000002.app $[H&SPATH]
rm -o -s $[GM9TEMP]
echo "FBI successfully injected to H&S."
goto MainMenu_FBI_to_H&S_Options
################Restore H&S################
@FBI_Restore_H&S
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nFBI to H&S Options\n>Restore H&S"
if not ask "Restore H&S?"
goto MainMenu_FBI_to_H&S_Options
end
if chk $[REGION] "USA"
if chk $[ONTYPE] "n3ds"
find -f 1:/title/00040010/20021300/content/*.app H&SPATH
else
find -f 1:/title/00040010/00021300/content/*.app H&SPATH
end
elif chk $[REGION] "EUR"
if chk $[ONTYPE] "n3ds"
find -f 1:/title/00040010/20022300/content/*.app H&SPATH
else
find -f 1:/title/00040010/00022300/content/*.app H&SPATH
end
elif chk $[REGION] "JPN"
if chk $[ONTYPE] "n3ds"
find -f 1:/title/00040010/20020300/content/*.app H&SPATH
else
find -f 1:/title/00040010/00020300/content/*.app H&SPATH
end
elif chk $[REGION] "KOR"
if chk $[ONTYPE] "n3ds"
find -f 1:/title/00040010/20027300/content/*.app H&SPATH
else
find -f 1:/title/00040010/00027300/content/*.app H&SPATH
end
elif chk $[REGION] "CHN"
if chk $[ONTYPE] "n3ds"
find -f 1:/title/00040010/20026300/content/*.app H&SPATH
else
find -f 1:/title/00040010/00026300/content/*.app H&SPATH
end
elif chk $[REGION] "TWN"
if chk $[ONTYPE] "n3ds"
find -f 1:/title/00040010/20028300/content/*.app H&SPATH
else
find -f 1:/title/00040010/00028300/content/*.app H&SPATH
end
else
echo "Unknown region. Aborting."
rm -o -s $[GM9TEMP]
goto MainMenu_FBI_to_H&S_Options
end
strsplit -b H&SBAK $[H&SPATH] "."
if not find $[H&SBAK].bak NULL
echo "No H&S backup found. Aborting."
goto MainMenu_FBI_to_H&S_Options
end
if not allow -a 1:/
echo "Permissions denied. Aborting"
end
rm $[H&SPATH]
mv -n -w $[H&SBAK].bak $[H&SPATH]
echo "H&S restored."
goto MainMenu_FBI_to_H&S_Options
###################Dump Options###################
@MainMenu_Dump_Options
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options"
labelsel -o -s "Choose an Option." Dump_Options_*
goto Start
###################System Save Dump Options###################
@Dump_Options_System_Save_Dump_Options
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>System Save Dump Options"
labelsel -o -s "Choose an Option." SysSave_Options_*
goto MainMenu_Dump_Options
#################Dump nnidsave.bin################
@SysSave_Options_Dump_nnidsave.bin
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>System Save Dump Options\n>>Dump nnidsave.bin"
if ask "Dump nnidsave.bin in $[GM9OUT]?"
findnot $[GM9OUT]/nnidsave_??.bin OUTPATH
cp -n 1:/data/$[SYSID0]/sysdata/00010038/00000000 $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
goto Dump_Options_System_Save_Dump_Options
################Dump friendsave.bin###############
@SysSave_Options_Dump_friendsave.bin
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>System Save Dump Options\n>>Dump friendsave.bin"
if ask "Dump friendsave.bin in $[GM9OUT]?"
findnot $[GM9OUT]/friendsave_??.bin OUTPATH
cp -n 1:/data/$[SYSID0]/sysdata/00010032/00000000 $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
goto Dump_Options_System_Save_Dump_Options
#################Dump seedsave.bin################
@SysSave_Options_Dump_seedsave.bin
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>System Save Dump Options\n>>Dump seedsave.bin"
if ask "Dump seedsave.bin in $[GM9OUT]?"
findnot $[GM9OUT]/seedsave_??.bin OUTPATH
cp -n 1:/data/$[SYSID0]/sysdata/0001000f/00000000 $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
goto Dump_Options_System_Save_Dump_Options
#################Dump nagsave.bin#################
@SysSave_Options_Dump_nagsave.bin
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>System Save Dump Options\n>>Dump nagsave.bin"
if ask "Dump nagsave.bin in $[GM9OUT]?"
findnot $[GM9OUT]/nagsave_??.bin OUTPATH
cp -n 1:/data/$[SYSID0]/sysdata/0001002c/00000000 $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
goto Dump_Options_System_Save_Dump_Options
################Dump configsave.bin###############
@SysSave_Options_Dump_configsave.bin
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>System Save Dump Options\n>>Dump configsave.bin"
if ask "Dump configsave.bin in $[GM9OUT]?"
findnot $[GM9OUT]/configsave_??.bin OUTPATH
cp -n 1:/data/$[SYSID0]/sysdata/00010017/00000000 $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
goto Dump_Options_System_Save_Dump_Options
#############System File Dump Options#############
@Dump_Options_System_File_Dump_Options
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>System File Dump Options"
labelsel -o -s "Choose an Option." SysFile_Options_*
goto MainMenu_Dump_Options
############Dump LocalFriendCodeSeed_B############
@SysFile_Options_Dump_LocalFriendCodeSeedB
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>System File Dump Options\n>>Dump LocalFriendCodeSeed_B"
if ask "Dump LocalFriendCodeSeed_B in $[GM9OUT]?"
findnot $[GM9OUT]/$[SERIAL]_LocalFriendCodeSeed_B_?? OUTPATH
cp -n 1:/rw/sys/LocalFriendCodeSeed_B $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
goto Dump_Options_System_File_Dump_Options
#################Dump SecureInfo_A################
@SysFile_Options_Dump_SecureInfoA
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>System File Dump Options\n>>Dump SecureInfo_A"
if find 1:/rw/sys/SecureInfo_A NULL
if ask "Dump SecureInfo_A in $[GM9OUT]?"
findnot $[GM9OUT]/$[SERIAL]_SecureInfo_A_?? OUTPATH
cp -n 1:/rw/sys/SecureInfo_A $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
end
if find 1:/rw/sys/SecureInfo_B NULL
if ask "SecureInfo_B found.\nDump SecureInfo_B in $[GM9OUT]?"
findnot $[GM9OUT]/$[SERIAL]_SecureInfo_B_?? OUTPATH
cp -n 1:/rw/sys/SecureInfo_B $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
end
if find 1:/rw/sys/SecureInfo_C NULL
if ask "SecureInfo_C found.\nDump SecureInfo_C in $[GM9OUT]?"
findnot $[GM9OUT]/$[SERIAL]_SecureInfo_C_?? OUTPATH
cp -n 1:/rw/sys/SecureInfo_C $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
end
goto Dump_Options_System_File_Dump_Options
#################Dump movable.sed#################
@SysFile_Options_Dump_movable.sed
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>System File Dump Options\n>>Dump movable.sed"
if ask "Dump movable.sed in $[GM9OUT]?"
findnot $[GM9OUT]/$[SERIAL]_movable_??.sed OUTPATH
cp -n 1:/private/movable.sed $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
goto Dump_Options_System_File_Dump_Options
##################Dump ticket.db##################
@SysFile_Options_Dump_ticket.db
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>System File Dump Options\n>>Dump ticket.db"
if ask "Dump ticket.db in $[GM9OUT]?"
findnot $[GM9OUT]/$[SERIAL]_ticket_??.db OUTPATH
cp -n 1:/dbs/ticket.db $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
goto Dump_Options_System_File_Dump_Options
###################Dump title.db##################
@SysFile_Options_Dump_title.db
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>System File Dump Options\n>>Dump title.db"
if ask "Dump title.db in $[GM9OUT]?"
findnot $[GM9OUT]/$[SERIAL]_title_??.db OUTPATH
cp -n 1:/dbs/title.db $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
goto Dump_Options_System_File_Dump_Options
##################Dump import.db##################
@SysFile_Options_Dump_import.db
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>System File Dump Options\n>>Dump import.db"
if ask "Dump import.db in $[GM9OUT]?"
findnot $[GM9OUT]/$[SERIAL]_import_??.db OUTPATH
cp -n 1:/dbs/import.db $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
goto Dump_Options_System_File_Dump_Options
###################Dump certs.db##################
@SysFile_Options_Dump_certs.db
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>System File Dump Options\n>>Dump certs.db"
if ask "Dump certs.db in $[GM9OUT]?"
findnot $[GM9OUT]/$[SERIAL]_certs_??.db OUTPATH
cp -n 1:/dbs/certs.db $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
goto Dump_Options_System_File_Dump_Options
##################Dump GBAVC.sav##################
@Dump_Options_Dump_GBAVC.sav
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>Dump GBAVC.sav"
if ask "Dump gbavc.sav in $[GM9OUT]?\nFor GodMode9 v.1.4.1 and below only."
findnot $[GM9OUT]/gbavc_??.sav OUTPATH
cp -n S:/gbavc.sav $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
end
goto MainMenu_Dump_Options
###########Dump Boot9.bin and Boot11.bin##########
@Dump_Options_Dump_Boot9.bin_&_Boot11.bin
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>Dump boot9.bin & boot11.bin"
if not find M:/boot*.bin NULL
echo "Boot9.bin and/or Boot11.bin not present.\nAborting!"
goto MainMenu_Dump_Options
end
if not ask "Create boot9 & boot11 dumps in $[GM9OUT]?"
goto MainMenu_Dump_Options
end
findnot $[GM9OUT]/$[SERIAL]_boot9_??.bin OUTPATH9
findnot $[GM9OUT]/$[SERIAL]_boot11_??.bin OUTPATH11
cp -w -n M:/boot9.bin $[OUTPATH9]
cp -w -n M:/boot11.bin $[OUTPATH11]
echo "Boot9 & Boot11 successfully dumped:\n$[OUTPATH9]\n$[OUTPATH11]"
goto MainMenu_Dump_Options
###################Dump OTP.bin###################
@Dump_Options_Dump_OTP.bin
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>Dump OTP.bin"
if not ask "Dump otp.bin in $[GM9OUT]? \n(This will overwrite any existing otp.bin!)"
goto MainMenu_Dump_Options
end
findnot $[GM9OUT]/$[SERIAL]_otp_??.bin OUTPATH
cp -w -n M:/otp.mem $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
goto MainMenu_Dump_Options
#################Dump CITRA Files#################
@Dump_Options_Dump_CITRA_Files
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nDump Options\n>Dump CITRA Files"
if not ask "Create dump of Citra files in $[GM9OUT]/Citra?\n(This will overwrite any existing Citra files!)\n(May fail if you use a custom font!)\n(This will dump System Archives)\n(This will dump Shared Fonts)\n(This will dump config)"
goto MainMenu_Dump_Options
end
set CITRA $[GM9OUT]/Citra/user/nand
mkdir $[CITRA]/data/00000000000000000000000000000000/sysdata/00010017/00000000
mkdir $[CITRA]/00000000000000000000000000000000/title/000400db/00010302/content
mkdir $[CITRA]/00000000000000000000000000000000/title/0004009b/00010202/content
mkdir $[CITRA]/00000000000000000000000000000000/title/0004009b/00010402/content
mkdir $[CITRA]/00000000000000000000000000000000/title/0004009b/00014002/content
mkdir $[CITRA]/00000000000000000000000000000000/title/0004009b/00014102/content
mkdir $[CITRA]/00000000000000000000000000000000/title/0004009b/00014202/content
mkdir $[CITRA]/00000000000000000000000000000000/title/0004009b/00014302/content
set OUTCONFIG $[CITRA]/data/00000000000000000000000000000000/sysdata/00010017/00000000/config
inject 1:/data/$[SYSID0]/sysdata/00010017/00000000@6000:8000 $[OUTCONFIG]@0
set OUT1 $[CITRA]/00000000000000000000000000000000/title/0004009b/00010202/content/00000000.app.romfs
set OUT2 $[CITRA]/00000000000000000000000000000000/title/0004009b/00010402/content/00000000.app.romfs
set OUT3 $[CITRA]/00000000000000000000000000000000/title/0004009b/00014002/content/00000000.app.romfs
set OUT4 $[CITRA]/00000000000000000000000000000000/title/000400db/00010302/content/00000000.app.romfs
set OUT5 $[CITRA]/00000000000000000000000000000000/title/0004009b/00014102/content/00000000.app.romfs
set OUT6 $[CITRA]/00000000000000000000000000000000/title/0004009b/00014202/content/00000000.app.romfs
set OUT7 $[CITRA]/00000000000000000000000000000000/title/0004009b/00014302/content/00000000.app.romfs
imgmount 1:/title/0004009b/00010202/content/00000000.app
inject G:/romfs.bin@1000:108898 $[OUT1]@0
imgumount
imgmount 1:/title/0004009b/00010402/content/00000009.app
inject G:/romfs.bin@1000:357A0 $[OUT2]@0
imgumount
imgmount 1:/title/0004009b/00014002/content/00000000.app
inject G:/romfs.bin@1000:160FDB $[OUT3]@0
imgumount
imgmount 1:/title/000400db/00010302/content/0000000c.app
inject G:/romfs.bin@1000:1D0E4 $[OUT4]@0
imgumount
imgmount 1:/title/0004009b/00014102/content/00000001.app
inject G:/romfs.bin@1000:17205A $[OUT5]@0
imgumount
imgmount 1:/title/0004009b/00014202/content/00000001.app
inject G:/romfs.bin@1000:80E48 $[OUT6]@0
imgumount
imgmount 1:/title/0004009b/00014302/content/00000001.app
inject G:/romfs.bin@1000:1BEAE2 $[OUT7]@0
imgumount
echo "Dump created succesfully:\n$[GM9OUT]/Citra"
goto MainMenu_Dump_Options
##################Inject Options##################
@MainMenu_Inject_Options
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nInject Options"
labelsel -o -s "Choose an Option." Inject_Options_*
goto Start
################Inject Friend Save################
@Inject_Options_Inject_FriendSave
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nInject Options\n>Inject Friend Save"
if not filesel "Select the friendsave you want to inject." $[GM9OUT]/friendsave_* FRIEND
goto MainMenu_Inject_Options
end
if ask "Inject $[FRIEND]?"
set OUTPATH 1:/data/$[SYSID0]/sysdata/00010032/00000000
cp -w -n $[FRIEND] $[OUTPATH]
echo "Friend-save injected successfully:\n$[OUTPATH]"
else
echo "Operation cancelled."
end
goto MainMenu_Inject_Options
###########Inject LocalFriendCodeSeed_B###########
@Inject_Options_Inject_LocalFriendCodeSeedB
set PREVIEW_MODE "GODMODE9 ALL-IN-ONE MEGASCRIPT\nby annson24\n \nInject Options\n>Inject LocalFriendCodeSeed_B"
if not ask "Inject LocalFriendCodeSeed_B from $[GM9OUT]?\n(This will overwrite your 3DS's current\nLocalFriendCodeSeed_B!)"
goto MainMenu_Inject_Options
end
if filesel "Select the LocalFriendCodeSeed you want to inject." $[GM9OUT]/*LocalFriendCodeSeed_B_* COPYPATH
set OUTPATH 1:/rw/sys/LocalFriendCodeSeed_B
cp -w -n $[COPYPATH] $[OUTPATH]
echo "LocalFriendCodeSeed_B injected successfully:\n$[OUTPATH]"
else
echo "Operation cancelled."
end
goto MainMenu_Inject_Options
################Inject SecureInfo_A###############
@Inject_Options_Inject_SecureInfoA