Prevent reading FIRM files if SD is not mounted

This commit is contained in:
Aurora 2016-10-07 16:25:41 +02:00
parent 6295559d9c
commit f005da4d12
2 changed files with 4 additions and 4 deletions

View File

@ -255,7 +255,7 @@ void main(void)
} }
bool loadFromSd = CONFIG(LOADSDFIRMSANDMODULES); bool loadFromSd = CONFIG(LOADSDFIRMSANDMODULES);
u32 firmVersion = loadFirm(&firmType, firmSource, loadFromSd); u32 firmVersion = loadFirm(&firmType, firmSource, loadFromSd, isSdMounted);
switch(firmType) switch(firmType)
{ {
@ -274,7 +274,7 @@ void main(void)
launchFirm(firmType, loadFromSd); launchFirm(firmType, loadFromSd);
} }
static inline u32 loadFirm(FirmwareType *firmType, FirmwareSource firmSource, bool loadFromSd) static inline u32 loadFirm(FirmwareType *firmType, FirmwareSource firmSource, bool loadFromSd, bool isSdMounted)
{ {
section = firm->section; section = firm->section;
@ -317,7 +317,7 @@ static inline u32 loadFirm(FirmwareType *firmType, FirmwareSource firmSource, bo
else if(firmVersion < 0x25) mustLoadFromSd = true; else if(firmVersion < 0x25) mustLoadFromSd = true;
} }
if(loadFromSd || mustLoadFromSd) if(isSdMounted && (loadFromSd || mustLoadFromSd))
{ {
u32 firmSize = fileRead(firm, *firmType == NATIVE_FIRM1X2X ? firmwareFiles[0] : firmwareFiles[(u32)*firmType], 0x400000); u32 firmSize = fileRead(firm, *firmType == NATIVE_FIRM1X2X ? firmwareFiles[0] : firmwareFiles[(u32)*firmType], 0x400000);

View File

@ -47,7 +47,7 @@ typedef struct firmHeader {
firmSectionHeader section[4]; firmSectionHeader section[4];
} firmHeader; } firmHeader;
static inline u32 loadFirm(FirmwareType *firmType, FirmwareSource firmSource, bool loadFromSd); static inline u32 loadFirm(FirmwareType *firmType, FirmwareSource firmSource, bool loadFromSd, bool isSdMounted);
static inline void patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, u32 devMode); static inline void patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, u32 devMode);
static inline void patchLegacyFirm(FirmwareType firmType, u32 firmVersion, u32 devMode); static inline void patchLegacyFirm(FirmwareType firmType, u32 firmVersion, u32 devMode);
static inline void patch1x2xNativeAndSafeFirm(u32 devMode); static inline void patch1x2xNativeAndSafeFirm(u32 devMode);