Properly verify CFA NCCHs

Also fixes NCSD verification
This commit is contained in:
d0k3 2018-09-03 22:55:37 +02:00
parent cbe473450f
commit a05cc1ff56

View File

@ -318,12 +318,19 @@ u32 VerifyNcchFile(const char* path, u32 offset, u32 size) {
return 1; return 1;
fvx_lseek(&file, offset); fvx_lseek(&file, offset);
if (GetNcchHeaders(&ncch, &exthdr, NULL, &file) != 0) { if (GetNcchHeaders(&ncch, NULL, NULL, &file) != 0) {
if (!offset) ShowPrompt(false, "%s\nError: Not a NCCH file", pathstr); if (!offset) ShowPrompt(false, "%s\nError: Not a NCCH file", pathstr);
fvx_close(&file); fvx_close(&file);
return 1; return 1;
} }
fvx_lseek(&file, offset);
if (ncch.size_exthdr && (GetNcchHeaders(&ncch, &exthdr, NULL, &file) != 0)) {
if (!offset) ShowPrompt(false, "%s\nError: Missing ExtHeader", pathstr);
fvx_close(&file);
return 1;
}
fvx_lseek(&file, offset); fvx_lseek(&file, offset);
if (ncch.size_exefs && (GetNcchHeaders(&ncch, NULL, &exefs, &file) != 0)) { if (ncch.size_exefs && (GetNcchHeaders(&ncch, NULL, &exefs, &file) != 0)) {
if (!offset) ShowPrompt(false, "%s\nError: Bad ExeFS header", pathstr); if (!offset) ShowPrompt(false, "%s\nError: Bad ExeFS header", pathstr);