@@ -462,11 +462,12 @@ u32* findCardReadStartOffsetType0(const module_params_t* moduleParams, const u32
462
462
);
463
463
if (cardReadStartOffset ) {
464
464
dbg_printf ("ARM9 Card read start (type 0) found\n" );
465
+ goto findCardReadStartOffsetType0_return ;
465
466
} else {
466
467
dbg_printf ("ARM9 Card read start (type 0) not found\n" );
467
468
}
468
469
469
- if (! cardReadStartOffset && moduleParams -> sdk_version < 0x2008000 ) {
470
+ if (moduleParams -> sdk_version < 0x2008000 ) {
470
471
cardReadStartOffset = findOffsetBackwards (
471
472
cardReadEndOffset , 0x118 ,
472
473
cardReadStartSignatureAlt , 1
@@ -478,6 +479,7 @@ u32* findCardReadStartOffsetType0(const module_params_t* moduleParams, const u32
478
479
}
479
480
}
480
481
482
+ findCardReadStartOffsetType0_return :
481
483
dbg_printf ("\n" );
482
484
return cardReadStartOffset ;
483
485
}
@@ -496,34 +498,33 @@ u32* findCardReadStartOffsetType1(const u32* cardReadEndOffset) {
496
498
);
497
499
if (cardReadStartOffset ) {
498
500
dbg_printf ("ARM9 Card read start alt 2 (type 1) found\n" );
501
+ goto findCardReadStartOffsetType1_return ;
499
502
} else {
500
503
dbg_printf ("ARM9 Card read start alt 2 (type 1) not found\n" );
501
504
}
502
505
503
- if (!cardReadStartOffset ) {
504
- cardReadStartOffset = findOffsetBackwards (
505
- cardReadEndOffset , 0x178 ,
506
- cardReadStartSignatureDebug , 3
507
- );
508
- if (cardReadStartOffset ) {
509
- dbg_printf ("ARM9 Card read start DEBUG (type 1) found\n" );
510
- } else {
511
- dbg_printf ("ARM9 Card read start DEBUG (type 1) not found\n" );
512
- }
506
+ cardReadStartOffset = findOffsetBackwards (
507
+ cardReadEndOffset , 0x178 ,
508
+ cardReadStartSignatureDebug , 3
509
+ );
510
+ if (cardReadStartOffset ) {
511
+ dbg_printf ("ARM9 Card read start DEBUG (type 1) found\n" );
512
+ goto findCardReadStartOffsetType1_return ;
513
+ } else {
514
+ dbg_printf ("ARM9 Card read start DEBUG (type 1) not found\n" );
513
515
}
514
516
515
- if (!cardReadStartOffset ) {
516
- cardReadStartOffset = findOffsetBackwards (
517
- cardReadEndOffset , 0x118 ,
518
- cardReadStartSignatureDebugAlt , 3
519
- );
520
- if (cardReadStartOffset ) {
521
- dbg_printf ("ARM9 Card read start DEBUG alt (type 1) found\n" );
522
- } else {
523
- dbg_printf ("ARM9 Card read start DEBUG alt (type 1) not found\n" );
524
- }
517
+ cardReadStartOffset = findOffsetBackwards (
518
+ cardReadEndOffset , 0x118 ,
519
+ cardReadStartSignatureDebugAlt , 3
520
+ );
521
+ if (cardReadStartOffset ) {
522
+ dbg_printf ("ARM9 Card read start DEBUG alt (type 1) found\n" );
523
+ } else {
524
+ dbg_printf ("ARM9 Card read start DEBUG alt (type 1) not found\n" );
525
525
}
526
526
527
+ findCardReadStartOffsetType1_return :
527
528
dbg_printf ("\n" );
528
529
return cardReadStartOffset ;
529
530
}
@@ -546,22 +547,22 @@ u32* findCardReadStartOffset5(const module_params_t* moduleParams, const u32* ca
546
547
);
547
548
if (cardReadStartOffset ) {
548
549
dbg_printf ("ARM9 Card read start SDK 5 found\n" );
550
+ goto findCardReadStartOffset5_return ;
549
551
} else {
550
552
dbg_printf ("ARM9 Card read start SDK 5 not found\n" );
551
553
}
552
554
553
- if (!cardReadStartOffset ) {
554
- cardReadStartOffset = findOffsetBackwards (
555
- (u32 * )cardReadEndOffset , 0x120 ,
556
- cardReadStartSignature5Alt , 1
557
- );
558
- if (cardReadStartOffset ) {
559
- dbg_printf ("ARM9 Card read start SDK 5.5 found\n" );
560
- } else {
561
- dbg_printf ("ARM9 Card read start SDK 5.5 not found\n" );
562
- }
555
+ cardReadStartOffset = findOffsetBackwards (
556
+ (u32 * )cardReadEndOffset , 0x120 ,
557
+ cardReadStartSignature5Alt , 1
558
+ );
559
+ if (cardReadStartOffset ) {
560
+ dbg_printf ("ARM9 Card read start SDK 5.5 found\n" );
561
+ } else {
562
+ dbg_printf ("ARM9 Card read start SDK 5.5 not found\n" );
563
563
}
564
564
565
+ findCardReadStartOffset5_return :
565
566
dbg_printf ("\n" );
566
567
return cardReadStartOffset ;
567
568
}
@@ -596,22 +597,22 @@ u16* findCardReadStartOffsetThumb(const u16* cardReadEndOffset) {
596
597
);
597
598
if (cardReadStartOffset ) {
598
599
dbg_printf ("ARM9 Card read start thumb found\n" );
600
+ goto findCardReadStartOffsetThumb_return ;
599
601
} else {
600
602
dbg_printf ("ARM9 Card read start thumb not found\n" );
601
603
}
602
604
603
- if (!cardReadStartOffset ) {
604
- cardReadStartOffset = findOffsetBackwardsThumb (
605
- cardReadEndOffset , 0xC0 ,
606
- cardReadStartSignatureThumbAlt , 2
607
- );
608
- if (cardReadStartOffset ) {
609
- dbg_printf ("ARM9 Card read start thumb alt found\n" );
610
- } else {
611
- dbg_printf ("ARM9 Card read start thumb alt not found\n" );
612
- }
605
+ cardReadStartOffset = findOffsetBackwardsThumb (
606
+ cardReadEndOffset , 0xC0 ,
607
+ cardReadStartSignatureThumbAlt , 2
608
+ );
609
+ if (cardReadStartOffset ) {
610
+ dbg_printf ("ARM9 Card read start thumb alt found\n" );
611
+ } else {
612
+ dbg_printf ("ARM9 Card read start thumb alt not found\n" );
613
613
}
614
614
615
+ findCardReadStartOffsetThumb_return :
615
616
dbg_printf ("\n" );
616
617
return cardReadStartOffset ;
617
618
}
@@ -786,32 +787,30 @@ u32* findCardPullOutOffset(const tNDSHeader* ndsHeader, const module_params_t* m
786
787
);
787
788
if (cardPullOutOffset ) {
788
789
dbg_printf ("Card pull out handler SDK 5 found\n" );
790
+ goto findCardPullOutOffset_return ;
789
791
} else {
790
792
dbg_printf ("Card pull out handler SDK 5 not found\n" );
791
793
}
792
794
793
- if (!cardPullOutOffset ) {
794
- cardPullOutOffset = findOffset (
795
- (u32 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
796
- cardPullOutSignature5Alt , 4
797
- );
798
- if (cardPullOutOffset ) {
799
- dbg_printf ("Card pull out handler SDK 5 alt found\n" );
800
- } else {
801
- dbg_printf ("Card pull out handler SDK 5 alt not found\n" );
802
- }
795
+ cardPullOutOffset = findOffset (
796
+ (u32 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
797
+ cardPullOutSignature5Alt , 4
798
+ );
799
+ if (cardPullOutOffset ) {
800
+ dbg_printf ("Card pull out handler SDK 5 alt found\n" );
801
+ goto findCardPullOutOffset_return ;
802
+ } else {
803
+ dbg_printf ("Card pull out handler SDK 5 alt not found\n" );
803
804
}
804
805
805
- if (!cardPullOutOffset ) {
806
- cardPullOutOffset = findOffset (
807
- (u32 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
808
- cardPullOutSignatureDebug5 , 5
809
- );
810
- if (cardPullOutOffset ) {
811
- dbg_printf ("Card pull out handler SDK 5 DEBUG found\n" );
812
- } else {
813
- dbg_printf ("Card pull out handler SDK 5 DEBUG not found\n" );
814
- }
806
+ cardPullOutOffset = findOffset (
807
+ (u32 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
808
+ cardPullOutSignatureDebug5 , 5
809
+ );
810
+ if (cardPullOutOffset ) {
811
+ dbg_printf ("Card pull out handler SDK 5 DEBUG found\n" );
812
+ } else {
813
+ dbg_printf ("Card pull out handler SDK 5 DEBUG not found\n" );
815
814
}
816
815
} else {
817
816
if (moduleParams -> sdk_version > 0x2008000 && moduleParams -> sdk_version < 0x3000000 ) {
@@ -822,74 +821,76 @@ u32* findCardPullOutOffset(const tNDSHeader* ndsHeader, const module_params_t* m
822
821
);
823
822
if (cardPullOutOffset ) {
824
823
dbg_printf ("Card pull out handler SDK 2 elaborate found\n" );
824
+ goto findCardPullOutOffset_return ;
825
825
} else {
826
826
dbg_printf ("Card pull out handler SDK 2 elaborate not found\n" );
827
827
}
828
828
}
829
829
830
- if (! cardPullOutOffset && moduleParams -> sdk_version < 0x4000000 ) {
830
+ if (moduleParams -> sdk_version < 0x4000000 ) {
831
831
cardPullOutOffset = findOffset (
832
832
(u32 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
833
833
cardPullOutSignature1 , 4
834
834
);
835
835
if (cardPullOutOffset ) {
836
836
dbg_printf ("Card pull out handler found\n" );
837
+ goto findCardPullOutOffset_return ;
837
838
} else {
838
839
dbg_printf ("Card pull out handler not found\n" );
839
840
}
840
841
}
841
842
842
- if (! cardPullOutOffset && moduleParams -> sdk_version < 0x2008000 ) {
843
+ if (moduleParams -> sdk_version < 0x2008000 ) {
843
844
// SDK 2
844
845
cardPullOutOffset = findOffset (
845
846
(u32 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
846
847
cardPullOutSignature2Alt , 4
847
848
);
848
849
if (cardPullOutOffset ) {
849
850
dbg_printf ("Card pull out handler SDK 2 alt found\n" );
851
+ goto findCardPullOutOffset_return ;
850
852
} else {
851
853
dbg_printf ("Card pull out handler SDK 2 alt not found\n" );
852
854
}
853
855
}
854
856
855
- if (!cardPullOutOffset ) {
856
- // SDK 4
857
- cardPullOutOffset = findOffset (
858
- (u32 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
859
- cardPullOutSignature4 , 4
860
- );
861
- if (cardPullOutOffset ) {
862
- dbg_printf ("Card pull out handler SDK 4 found\n" );
863
- } else {
864
- dbg_printf ("Card pull out handler SDK 4 not found\n" );
865
- }
857
+ // SDK 4
858
+ cardPullOutOffset = findOffset (
859
+ (u32 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
860
+ cardPullOutSignature4 , 4
861
+ );
862
+ if (cardPullOutOffset ) {
863
+ dbg_printf ("Card pull out handler SDK 4 found\n" );
864
+ goto findCardPullOutOffset_return ;
865
+ } else {
866
+ dbg_printf ("Card pull out handler SDK 4 not found\n" );
866
867
}
867
868
868
- if (! cardPullOutOffset && moduleParams -> sdk_version > 0x4000000 ) {
869
+ if (moduleParams -> sdk_version > 0x4000000 ) {
869
870
cardPullOutOffset = findOffset (
870
871
(u32 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
871
872
cardPullOutSignature1 , 4
872
873
);
873
874
if (cardPullOutOffset ) {
874
875
dbg_printf ("Card pull out handler found\n" );
876
+ goto findCardPullOutOffset_return ;
875
877
} else {
876
878
dbg_printf ("Card pull out handler not found\n" );
877
879
}
878
880
}
879
881
880
- if (!cardPullOutOffset ) {
881
- cardPullOutOffset = findOffset (
882
- (u32 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
883
- cardPullOutSignatureDebug , 5
884
- );
885
- if (cardPullOutOffset ) {
886
- dbg_printf ("Card pull out handler DEBUG found\n" );
887
- } else {
888
- dbg_printf ("Card pull out handler DEBUG not found\n" );
889
- }
882
+ cardPullOutOffset = findOffset (
883
+ (u32 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
884
+ cardPullOutSignatureDebug , 5
885
+ );
886
+ if (cardPullOutOffset ) {
887
+ dbg_printf ("Card pull out handler DEBUG found\n" );
888
+ } else {
889
+ dbg_printf ("Card pull out handler DEBUG not found\n" );
890
890
}
891
891
}
892
892
893
+ findCardPullOutOffset_return :
893
894
dbg_printf ("\n" );
894
895
return cardPullOutOffset ;
895
896
}
@@ -905,34 +906,33 @@ u16* findCardPullOutOffsetThumb(const tNDSHeader* ndsHeader) {
905
906
);
906
907
if (cardPullOutOffset ) {
907
908
dbg_printf ("Card pull out handler thumb found\n" );
909
+ goto findCardPullOutOffsetThumb_return ;
908
910
} else {
909
911
dbg_printf ("Card pull out handler thumb not found\n" );
910
912
}
911
913
912
- if (!cardPullOutOffset ) {
913
- cardPullOutOffset = findOffsetThumb (
914
- (u16 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
915
- cardPullOutSignatureThumbAlt , 4
916
- );
917
- if (cardPullOutOffset ) {
918
- dbg_printf ("Card pull out handler thumb alt found\n" );
919
- } else {
920
- dbg_printf ("Card pull out handler thumb alt not found\n" );
921
- }
914
+ cardPullOutOffset = findOffsetThumb (
915
+ (u16 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
916
+ cardPullOutSignatureThumbAlt , 4
917
+ );
918
+ if (cardPullOutOffset ) {
919
+ dbg_printf ("Card pull out handler thumb alt found\n" );
920
+ goto findCardPullOutOffsetThumb_return ;
921
+ } else {
922
+ dbg_printf ("Card pull out handler thumb alt not found\n" );
922
923
}
923
924
924
- if (!cardPullOutOffset ) {
925
- cardPullOutOffset = findOffsetThumb (
926
- (u16 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
927
- cardPullOutSignatureThumbAlt2 , 4
928
- );
929
- if (cardPullOutOffset ) {
930
- dbg_printf ("Card pull out handler thumb alt 2 found\n" );
931
- } else {
932
- dbg_printf ("Card pull out handler thumb alt 2 not found\n" );
933
- }
925
+ cardPullOutOffset = findOffsetThumb (
926
+ (u16 * )ndsHeader -> arm9destination , iUncompressedSize ,//ndsHeader->arm9binarySize,
927
+ cardPullOutSignatureThumbAlt2 , 4
928
+ );
929
+ if (cardPullOutOffset ) {
930
+ dbg_printf ("Card pull out handler thumb alt 2 found\n" );
931
+ } else {
932
+ dbg_printf ("Card pull out handler thumb alt 2 not found\n" );
934
933
}
935
934
935
+ findCardPullOutOffsetThumb_return :
936
936
dbg_printf ("\n" );
937
937
return cardPullOutOffset ;
938
938
}
0 commit comments