mirror of
https://github.com/AuroraWright/SafeA9LHInstaller.git
synced 2025-06-26 13:42:45 +00:00
Cleanly exit from firmRead
This commit is contained in:
parent
aa209a3ef7
commit
7e37e653b6
16
source/fs.c
16
source/fs.c
@ -58,7 +58,8 @@ u32 firmRead(void *dest)
|
|||||||
|
|
||||||
f_opendir(&dir, path);
|
f_opendir(&dir, path);
|
||||||
|
|
||||||
u32 id = 0xFFFFFFFF;
|
u32 id = 0xFFFFFFFF,
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
//Parse the target directory
|
//Parse the target directory
|
||||||
while(f_readdir(&dir, &info) == FR_OK && info.fname[0])
|
while(f_readdir(&dir, &info) == FR_OK && info.fname[0])
|
||||||
@ -66,7 +67,8 @@ u32 firmRead(void *dest)
|
|||||||
//Not a cxi
|
//Not a cxi
|
||||||
if(info.altname[9] != 'A') continue;
|
if(info.altname[9] != 'A') continue;
|
||||||
|
|
||||||
if(id != 0xFFFFFFFF) return 1;
|
//Multiple cxis were found
|
||||||
|
if(id != 0xFFFFFFFF) ret = 1;
|
||||||
|
|
||||||
//Convert the .app name to an integer
|
//Convert the .app name to an integer
|
||||||
u32 tempId = 0;
|
u32 tempId = 0;
|
||||||
@ -76,7 +78,8 @@ u32 firmRead(void *dest)
|
|||||||
tempId += *tmp > '9' ? *tmp - 'A' + 10 : *tmp - '0';
|
tempId += *tmp > '9' ? *tmp - 'A' + 10 : *tmp - '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if((console && tempId >= 0x21) || (!console && tempId >= 0x52)) return 2;
|
//FIRM is equal or newer than 11.0
|
||||||
|
if(tempId >= (console ? 0x21 : 0x52)) ret = 2;
|
||||||
|
|
||||||
//Found an older cxi
|
//Found an older cxi
|
||||||
if(tempId < id) id = tempId;
|
if(tempId < id) id = tempId;
|
||||||
@ -84,6 +87,8 @@ u32 firmRead(void *dest)
|
|||||||
|
|
||||||
f_closedir(&dir);
|
f_closedir(&dir);
|
||||||
|
|
||||||
|
if(!ret)
|
||||||
|
{
|
||||||
//Complete the string with the .app name
|
//Complete the string with the .app name
|
||||||
memcpy(&path[34], "/00000000.app", 14);
|
memcpy(&path[34], "/00000000.app", 14);
|
||||||
|
|
||||||
@ -99,6 +104,7 @@ u32 firmRead(void *dest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fileRead(dest, path);
|
fileRead(dest, path);
|
||||||
|
}
|
||||||
return 0;
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user