mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
Fix verifying CFA NCCH images
This commit is contained in:
parent
37e24c1825
commit
b98bba9a6f
@ -285,14 +285,21 @@ u32 VerifyNcchFile(const char* path, u32 offset, u32 size) {
|
||||
// open file, get NCCH, ExeFS header
|
||||
if (fx_open(&file, path, FA_READ | FA_OPEN_EXISTING) != FR_OK)
|
||||
return 1;
|
||||
f_lseek(&file, offset);
|
||||
|
||||
if (GetNcchHeaders(&ncch, NULL, &exefs, &file) != 0) {
|
||||
f_lseek(&file, offset);
|
||||
if (GetNcchHeaders(&ncch, NULL, NULL, &file) != 0) {
|
||||
if (!offset) ShowPrompt(false, "%s\nError: Not a NCCH file", pathstr);
|
||||
fx_close(&file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
f_lseek(&file, offset);
|
||||
if (ncch.size_exefs && (GetNcchHeaders(&ncch, NULL, &exefs, &file) != 0)) {
|
||||
if (!offset) ShowPrompt(false, "%s\nError: Bad ExeFS header", pathstr);
|
||||
fx_close(&file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// size checks
|
||||
if (!size) size = f_size(&file) - offset;
|
||||
if ((f_size(&file) < offset) || (size < ncch.size * NCCH_MEDIA_UNIT)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user