mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-27 01:22:37 -06:00
Merge pull request #4900 from leoetlino/exheader-fix
ncch_container: Fix NCCH decryption heuristic when replacing exheader
This commit is contained in:
commit
360e6cb513
1 changed files with 13 additions and 11 deletions
|
@ -325,20 +325,11 @@ Loader::ResultStatus NCCHContainer::Load() {
|
|||
return file && file.ReadBytes(&exheader_header, size) == size;
|
||||
};
|
||||
|
||||
FileUtil::IOFile exheader_override_file{filepath + ".exheader", "rb"};
|
||||
const bool has_exheader_override = read_exheader(exheader_override_file);
|
||||
if (has_exheader_override) {
|
||||
if (exheader_header.system_info.jump_id !=
|
||||
exheader_header.arm11_system_local_caps.program_id) {
|
||||
LOG_WARNING(Service_FS, "Jump ID and Program ID don't match. "
|
||||
"The override exheader might not be decrypted.");
|
||||
}
|
||||
is_tainted = true;
|
||||
} else if (!read_exheader(file)) {
|
||||
if (!read_exheader(file)) {
|
||||
return Loader::ResultStatus::Error;
|
||||
}
|
||||
|
||||
if (!has_exheader_override && is_encrypted) {
|
||||
if (is_encrypted) {
|
||||
// This ID check is masked to low 32-bit as a toleration to ill-formed ROM created
|
||||
// by merging games and its updates.
|
||||
if ((exheader_header.system_info.jump_id & 0xFFFFFFFF) ==
|
||||
|
@ -358,6 +349,17 @@ Loader::ResultStatus NCCHContainer::Load() {
|
|||
}
|
||||
}
|
||||
|
||||
FileUtil::IOFile exheader_override_file{filepath + ".exheader", "rb"};
|
||||
const bool has_exheader_override = read_exheader(exheader_override_file);
|
||||
if (has_exheader_override) {
|
||||
if (exheader_header.system_info.jump_id !=
|
||||
exheader_header.arm11_system_local_caps.program_id) {
|
||||
LOG_WARNING(Service_FS, "Jump ID and Program ID don't match. "
|
||||
"The override exheader might not be decrypted.");
|
||||
}
|
||||
is_tainted = true;
|
||||
}
|
||||
|
||||
is_compressed = (exheader_header.codeset_info.flags.flag & 1) == 1;
|
||||
u32 entry_point = exheader_header.codeset_info.text.address;
|
||||
u32 code_size = exheader_header.codeset_info.text.code_size;
|
||||
|
|
Loading…
Reference in a new issue