Added checks for successful mounting of SD/CTRNAND

This commit is contained in:
Aurora 2016-06-08 14:33:27 +02:00
parent 51c1e5567a
commit 09435c282b
2 changed files with 6 additions and 6 deletions

View File

@ -10,14 +10,12 @@ static FATFS fs;
u32 mountSD(void) u32 mountSD(void)
{ {
if(f_mount(&fs, "0:", 1) != FR_OK) return 0; return f_mount(&fs, "0:", 1) == FR_OK;
return 1;
} }
u32 mountCTRNAND(void) u32 mountCTRNAND(void)
{ {
if(f_mount(&fs, "1:", 1) != FR_OK) return 0; return f_mount(&fs, "1:", 1) == FR_OK;
return 1;
} }
u32 fileRead(void *dest, const char *path) u32 fileRead(void *dest, const char *path)

View File

@ -59,7 +59,8 @@ void main(void)
static inline void installer(u32 a9lhBoot) static inline void installer(u32 a9lhBoot)
{ {
mountSD(); if(!mountSD())
shutdown(1, "Error: failed to mount the SD card");
const char *path; const char *path;
u32 updatea9lh = 0; u32 updatea9lh = 0;
@ -192,7 +193,8 @@ static inline void uninstaller(void)
} }
else memset32((void *)SECTOR_OFFSET, 0, 0x200); else memset32((void *)SECTOR_OFFSET, 0, 0x200);
mountCTRNAND(); if(!mountCTRNAND())
shutdown(1, "Error: failed to mount CTRNAND");
switch(firmRead((void *)FIRM0_OFFSET)) switch(firmRead((void *)FIRM0_OFFSET))
{ {