Don't close the directory if not already opened
This commit is contained in:
parent
d270d5b9ca
commit
a868079a93
41
source/fs.c
41
source/fs.c
@ -126,31 +126,34 @@ void loadPayload(u32 pressed)
|
|||||||
|
|
||||||
FRESULT result = f_findfirst(&dir, &info, path, pattern);
|
FRESULT result = f_findfirst(&dir, &info, path, pattern);
|
||||||
|
|
||||||
f_closedir(&dir);
|
if(result == FR_OK)
|
||||||
|
|
||||||
if(result == FR_OK && info.fname[0] != 0)
|
|
||||||
{
|
{
|
||||||
u32 *loaderAddress = (u32 *)0x24FFFF00;
|
f_closedir(&dir);
|
||||||
u8 *payloadAddress = (u8 *)0x24F00000;
|
|
||||||
|
|
||||||
memcpy(loaderAddress, loader_bin, loader_bin_size);
|
if(info.fname[0] != 0)
|
||||||
|
|
||||||
concatenateStrings(path, "/");
|
|
||||||
concatenateStrings(path, info.altname);
|
|
||||||
|
|
||||||
u32 payloadSize = fileRead(payloadAddress, path, (u8 *)loaderAddress - payloadAddress);
|
|
||||||
|
|
||||||
if(payloadSize > 0)
|
|
||||||
{
|
{
|
||||||
loaderAddress[1] = payloadSize;
|
u32 *loaderAddress = (u32 *)0x24FFFF00;
|
||||||
|
u8 *payloadAddress = (u8 *)0x24F00000;
|
||||||
|
|
||||||
backupAndRestoreShaHash(true);
|
memcpy(loaderAddress, loader_bin, loader_bin_size);
|
||||||
initScreens();
|
|
||||||
|
|
||||||
flushDCacheRange(loaderAddress, loader_bin_size);
|
concatenateStrings(path, "/");
|
||||||
flushICacheRange(loaderAddress, loader_bin_size);
|
concatenateStrings(path, info.altname);
|
||||||
|
|
||||||
((void (*)())loaderAddress)();
|
u32 payloadSize = fileRead(payloadAddress, path, (u8 *)loaderAddress - payloadAddress);
|
||||||
|
|
||||||
|
if(payloadSize > 0)
|
||||||
|
{
|
||||||
|
loaderAddress[1] = payloadSize;
|
||||||
|
|
||||||
|
backupAndRestoreShaHash(true);
|
||||||
|
initScreens();
|
||||||
|
|
||||||
|
flushDCacheRange(loaderAddress, loader_bin_size);
|
||||||
|
flushICacheRange(loaderAddress, loader_bin_size);
|
||||||
|
|
||||||
|
((void (*)())loaderAddress)();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user