From 03edd13633a1107447eefb33f8159ed099e4fe5e Mon Sep 17 00:00:00 2001 From: Aurora Date: Thu, 29 Sep 2016 13:01:51 +0200 Subject: [PATCH] Remove unneeded stuff --- loader/arm11/source/types.h | 6 ------ loader/source/main.c | 2 +- source/fs.c | 2 +- source/installer.c | 6 +++--- source/screen.c | 20 ++++++-------------- source/utils.c | 6 +++--- 6 files changed, 14 insertions(+), 28 deletions(-) diff --git a/loader/arm11/source/types.h b/loader/arm11/source/types.h index 7829adf..ded9cc7 100755 --- a/loader/arm11/source/types.h +++ b/loader/arm11/source/types.h @@ -1,9 +1,3 @@ -/* -* types.h -* by Reisyukaku -* Copyright (c) 2015 All Rights Reserved -*/ - #pragma once #include diff --git a/loader/source/main.c b/loader/source/main.c index bba321d..6c0b9a7 100644 --- a/loader/source/main.c +++ b/loader/source/main.c @@ -35,7 +35,7 @@ static inline void ownArm11(void) *(vu32 *)0x1FFAED80 = 0xE51FF004; *(vu32 *)0x1FFAED84 = A11_PAYLOAD_LOC; *(vu8 *)0x1FFFFFF0 = 2; - while(*(vu32 *)A11_ENTRYPOINT); + while(*(vu32 *)A11_ENTRYPOINT != 0); } void main(void) diff --git a/source/fs.c b/source/fs.c index 8d2940f..dba65d3 100644 --- a/source/fs.c +++ b/source/fs.c @@ -61,7 +61,7 @@ bool fileWrite(const void *buffer, const char *path, u32 size) f_truncate(&file); f_close(&file); - return true; + return (u32)written == size; } if(result == FR_NO_PATH) diff --git a/source/installer.c b/source/installer.c index f9c4951..3a9bce2 100755 --- a/source/installer.c +++ b/source/installer.c @@ -138,11 +138,11 @@ static inline void installer(bool isA9lh, bool isOtpless) if(isA9lh && !isOtpless) { u32 i; - for(i = 0; i < 3; i++) + for(i = 1; i < 3; i++) if(memcmp(keySector + AES_BLOCK_SIZE, key2s[i], AES_BLOCK_SIZE) == 0) break; - if(i == 4) shutdown(1, "Error: the OTP hash or the NAND key sector\nare invalid"); - if(i == 0) updateA9lh = true; + if(i == 3) shutdown(1, "Error: the OTP hash or the NAND key sector\nare invalid"); + if(i == 1) updateA9lh = true; } if(!isA9lh || updateA9lh || isOtpless) generateSector(keySector, (!isA9lh && isN3DS) ? 1 : 0); diff --git a/source/screen.c b/source/screen.c index 5cbf914..2a8fbeb 100644 --- a/source/screen.c +++ b/source/screen.c @@ -51,13 +51,15 @@ void clearScreens(void) void __attribute__((naked)) ARM11(void) { //Setting up two simultaneous memory fills using the GPU - vu32 *REGs_PSC0 = (vu32 *)0x10400010; + + vu32 *REGs_PSC0 = (vu32 *)0x10400010, + *REGs_PSC1 = (vu32 *)0x10400020; + REGs_PSC0[0] = (u32)fb->top_left >> 3; //Start address REGs_PSC0[1] = (u32)(fb->top_left + SCREEN_TOP_FBSIZE) >> 3; //End address REGs_PSC0[2] = 0; //Fill value REGs_PSC0[3] = (2 << 8) | 1; //32-bit pattern; start - vu32 *REGs_PSC1 = (vu32 *)0x10400020; REGs_PSC1[0] = (u32)fb->bottom >> 3; //Start address REGs_PSC1[1] = (u32)(fb->bottom + SCREEN_BOTTOM_FBSIZE) >> 3; //End address REGs_PSC1[2] = 0; //Fill value @@ -65,16 +67,6 @@ void clearScreens(void) while(!((REGs_PSC0[3] & 2) && (REGs_PSC1[3] & 2))); - if(fb->top_right != fb->top_left) - { - REGs_PSC0[0] = (u32)fb->top_right >> 3; //Start address - REGs_PSC0[1] = (u32)(fb->top_right + SCREEN_TOP_FBSIZE) >> 3; //End address - REGs_PSC0[2] = 0; //Fill value - REGs_PSC0[3] = (2 << 8) | 1; //32-bit pattern; start - - while(!(REGs_PSC0[3] & 2)); - } - WAIT_FOR_ARM9(); } @@ -83,7 +75,7 @@ void clearScreens(void) void initScreens(void) { - void __attribute__((naked)) ARM11(void) + void __attribute__((naked)) initSequence(void) { //Disable interrupts __asm(".word 0xF10C01C0"); @@ -189,7 +181,7 @@ void initScreens(void) if(PDN_GPU_CNT == 1) { - invokeArm11Function(ARM11); + invokeArm11Function(initSequence); //Turn on backlight i2cWriteRegister(I2C_DEV_MCU, 0x22, 0x2A); diff --git a/source/utils.c b/source/utils.c index 0c22b91..526fb14 100755 --- a/source/utils.c +++ b/source/utils.c @@ -37,7 +37,7 @@ u32 waitInput(void) void mcuReboot(void) { - if(PDN_GPU_CNT != 1) clearScreens(); + clearScreens(); //Ensure that all memory transfers have completed and that the data cache has been flushed flushEntireDCache(); @@ -48,14 +48,14 @@ void mcuReboot(void) void shutdown(u32 mode, const char *message) { - if(mode) + if(mode != 0) { posY = drawString(message, 10, posY + SPACING_Y, mode == 1 ? COLOR_RED : COLOR_GREEN); drawString("Press any button to shutdown", 10, posY, COLOR_WHITE); waitInput(); } - if(PDN_GPU_CNT != 1) clearScreens(); + clearScreens(); //Ensure that all memory transfers have completed and that the data cache has been flushed flushEntireDCache();