diff --git a/Makefile b/Makefile index 5061d35..06b71de 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,7 @@ firm_builder $(TARGET).firm $(ENTRY9) $(ENTRY11) $(SECTION0_ADR) $(SECTION0_TYPE) \ $(SECTION0_FILE) $(SECTION1_ADR) $(SECTION1_TYPE) $(SECTION1_FILE) $(SECTION2_ADR) \ $(SECTION2_TYPE) $(SECTION2_FILE) + @bash patchSuperhaxSection.sh #--------------------------------------------------------------------------------- arm9/$(TARGET)9.bin: @@ -75,6 +76,7 @@ firm_builder $(TARGET).firm $(ENTRY9) $(ENTRY11) $(SECTION0_ADR) $(SECTION0_TYPE) \ $(SECTION0_FILE) $(SECTION1_ADR) $(SECTION1_TYPE) $(SECTION1_FILE) $(SECTION2_ADR) \ $(SECTION2_TYPE) $(SECTION2_FILE) + @bash patchSuperhaxSection.sh @bash signFirm.sh @7z a -mx -m0=ARM -m1=LZMA $(TARGET)$(VERS_STRING).7z $(TARGET).firm @7z u -mx -m0=PPMD $(TARGET)$(VERS_STRING).7z LICENSE.txt README.md diff --git a/patchSuperhaxSection.sh b/patchSuperhaxSection.sh new file mode 100755 index 0000000..a345182 --- /dev/null +++ b/patchSuperhaxSection.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +dd if=/dev/zero of=fastboot3DS.firm bs=4 count=1 seek=30 conv=notrunc diff --git a/source/arm11/start.s b/source/arm11/start.s index 5f3eb69..0062004 100644 --- a/source/arm11/start.s +++ b/source/arm11/start.s @@ -27,12 +27,13 @@ .global clearMem .global _init .global deinitCpu +.global __superhaxEnabled .type vectors %function .type _start %function .type stubExceptionVectors %function .type clearMem %function -.type copyBoot11 %function +.type checkSuperhax %function .type setupVfp %function .type _init %function .type deinitCpu %function @@ -125,10 +126,7 @@ cmp r4, #0 bne _start_skip_bss_init_array - ldr r0, =BOOT11_BASE + 0x8000 - ldr r1, [r0] - cmp r1, #0 - blne copyBoot11 + bl checkSuperhax @ Clear bss section ldr r0, =__bss_start__ ldr r1, =__bss_end__ @@ -214,15 +212,22 @@ .pool -copyBoot11: +checkSuperhax: + ldr r0, =BOOT11_BASE + 0x8000 + ldr r1, [r0] + cmp r1, #0 + bxeq lr + ldr r1, =__superhaxEnabled + mov r2, #1 ldr r0, =BOOT11_BASE + strb r2, [r1] ldr r1, =VRAM_BASE + VRAM_SIZE - 0x10000 mov r2, #0x10000 - copyBoot11_lp: + checkSuperhax_lp: ldmia r0!, {r3-r6} stmia r1!, {r3-r6} subs r2, r2, #16 - bne copyBoot11_lp + bne checkSuperhax_lp bx lr .pool @@ -279,3 +284,8 @@ bx r3 .pool + + +.section ".rodata", "a" +__superhaxEnabled: + .byte 0