From e53c186144d02ddb7f422a565d674e5c9a15c92a Mon Sep 17 00:00:00 2001 From: Aurora Date: Wed, 24 Feb 2016 20:35:15 +0100 Subject: [PATCH] Prep work for A9LH screen init --- reboot/rebootCode.s | 17 +++-------------- reboot/rebootCodeNtr.s | 17 +++-------------- source/draw.c | 2 ++ source/firm.c | 6 +++--- source/firm.h | 2 +- source/main.c | 8 ++------ 6 files changed, 14 insertions(+), 38 deletions(-) diff --git a/reboot/rebootCode.s b/reboot/rebootCode.s index a7597d7..6c339b1 100644 --- a/reboot/rebootCode.s +++ b/reboot/rebootCode.s @@ -1,4 +1,4 @@ -.nds +.arm.little firm_size equ 0x000EA000 firm_addr equ 0x24000000 @@ -6,17 +6,6 @@ fopen equ 0x08059D10 fread equ 0x0804CC54 pxi_wait_recv equ 0x08054134 -.macro svc, num - .if isArm() - .word 0xEF000000 | num - .else - .if num > 0xFF - .error "bitch you crazu" - .endif - .halfword 0xDF00 | num - .endif -.endmacro - .create "reboot1.bin", 0x080849DC .org 0x080849DC .arm @@ -48,9 +37,9 @@ patch005: mov r3, r2 mov r1, r2 mov r0, r2 - svc 0x7C + swi 0x7C ldr r0, =0x80FF4FC - svc 0x7B + swi 0x7B @@inf_loop: b @@inf_loop diff --git a/reboot/rebootCodeNtr.s b/reboot/rebootCodeNtr.s index fc26bb9..3c8db3c 100644 --- a/reboot/rebootCodeNtr.s +++ b/reboot/rebootCodeNtr.s @@ -1,4 +1,4 @@ -.nds +.arm.little firm_size equ 0x000EB000 firm_addr equ 0x24000000 @@ -6,17 +6,6 @@ fopen equ 0x0805B180 fread equ 0x0804D9B0 pxi_wait_recv equ 0x08055178 -.macro svc, num - .if isArm() - .word 0xEF000000 | num - .else - .if num > 0xFF - .error "bitch you crazu" - .endif - .halfword 0xDF00 | num - .endif -.endmacro - .create "reboot1.bin", 0x080859C8 .org 0x080859C8 .arm @@ -48,9 +37,9 @@ patch005: mov r3, r2 mov r1, r2 mov r0, r2 - svc 0x7C + swi 0x7C ldr r0, =0x80FF4FC - svc 0x7B + swi 0x7B @@inf_loop: b @@inf_loop diff --git a/source/draw.c b/source/draw.c index d0e7b3b..2c98511 100644 --- a/source/draw.c +++ b/source/draw.c @@ -17,6 +17,8 @@ void clearScreen(void){ } void loadSplash(void){ + //Check that it's a no-LCD-init boot via PDN_GPU_CNT + if (*((u8*)0x10141200) == 0x1) return; clearScreen(); if(fileRead(fb->top_left, "/rei/splash.bin", 0x46500) != 0) return; unsigned i,t; for(t=220;t>0;t--){for(i=0xFFFF;i>0;i--);}; //Ghetto sleep func diff --git a/source/firm.c b/source/firm.c index 57da2e6..253024a 100755 --- a/source/firm.c +++ b/source/firm.c @@ -21,14 +21,14 @@ u8 mode = 1, u16 pressed; //Load firm into FCRAM -u8 loadFirm(u8 a9lhBoot){ +u8 loadFirm(void){ //Detect the console being used if(PDN_MPCORE_CFG == 1) console = 0; //Get pressed buttons pressed = HID_PAD; - //Determine if A9LH is installed - if(a9lhBoot || fileExists("/rei/installeda9lh")){ + //Determine if A9LH is installed via PDN_SPI_CNT and an user flag + if((*((u8*)0x101401C0) == 0x0) || fileExists("/rei/installeda9lh")){ a9lhSetup = 1; //Check flag for > 9.2 SysNAND if(fileExists("/rei/updatedsysnand")) updatedSys = 1; diff --git a/source/firm.h b/source/firm.h index 890946f..cd41a7f 100644 --- a/source/firm.h +++ b/source/firm.h @@ -16,7 +16,7 @@ #define SAFEMODE (BUTTON_L1 | BUTTON_R1 | BUTTON_A | (1 << 6)) #define PATCHED_FIRM_PATH "/rei/patched_firmware.bin" -u8 loadFirm(u8 a9lhBoot); +u8 loadFirm(void); u8 loadEmu(void); u8 patchFirm(void); void launchFirm(void); diff --git a/source/main.c b/source/main.c index 53248cf..e7409c7 100644 --- a/source/main.c +++ b/source/main.c @@ -10,14 +10,10 @@ #include "firm.h" #include "draw.h" -u8 a9lhBoot = 0; - u8 main(){ mountSD(); - //Detect an A9LH boot checking PDN_GPU_CNT register - if (*((u8*)0x10141200) == 0x1) a9lhBoot = 1; - else loadSplash(); - if (loadFirm(a9lhBoot)) return 1; + loadSplash(); + if (loadFirm()) return 1; if (patchFirm()) return 1; launchFirm(); return 0;