1
0
Fork 0

Merge pull request #4813 from leoetlino/larger-code

ncch_container: Add support for exheader replacement
This commit is contained in:
Pengfei Zhu 2019-07-08 10:56:32 +08:00 committed by GitHub
commit 2f7a10eeaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -320,9 +320,17 @@ Loader::ResultStatus NCCHContainer::Load() {
// System archives and DLC don't have an extended header but have RomFS
if (ncch_header.extended_header_size) {
if (file.ReadBytes(&exheader_header, sizeof(ExHeader_Header)) !=
sizeof(ExHeader_Header))
auto read_exheader = [this](FileUtil::IOFile& file) {
const std::size_t size = sizeof(exheader_header);
return file && file.ReadBytes(&exheader_header, size) == size;
};
FileUtil::IOFile exheader_override_file{filepath + ".exheader", "rb"};
if (read_exheader(exheader_override_file)) {
is_tainted = true;
} else if (!read_exheader(file)) {
return Loader::ResultStatus::Error;
}
if (is_encrypted) {
// This ID check is masked to low 32-bit as a toleration to ill-formed ROM created