ncch_container: choose the first id as extdata id when extended save data access is used
This commit is contained in:
@ -585,7 +585,25 @@ Loader::ResultStatus NCCHContainer::ReadExtdataId(u64& extdata_id) {
|
||||
return Loader::ResultStatus::ErrorNotUsed;
|
||||
|
||||
if (exheader_header.arm11_system_local_caps.storage_info.other_attributes >> 1) {
|
||||
// Extdata id is not present when using extended savedata access
|
||||
// Using extended save data access
|
||||
// There would be multiple possible extdata IDs in this case. The best we can do for now is
|
||||
// guessing that the first one would be the main save.
|
||||
const std::array<u64, 6> extdata_ids{{
|
||||
exheader_header.arm11_system_local_caps.storage_info.extdata_id0.Value(),
|
||||
exheader_header.arm11_system_local_caps.storage_info.extdata_id1.Value(),
|
||||
exheader_header.arm11_system_local_caps.storage_info.extdata_id2.Value(),
|
||||
exheader_header.arm11_system_local_caps.storage_info.extdata_id3.Value(),
|
||||
exheader_header.arm11_system_local_caps.storage_info.extdata_id4.Value(),
|
||||
exheader_header.arm11_system_local_caps.storage_info.extdata_id5.Value(),
|
||||
}};
|
||||
for (u64 id : extdata_ids) {
|
||||
if (id) {
|
||||
// Found a non-zero ID, use it
|
||||
extdata_id = id;
|
||||
return Loader::ResultStatus::Success;
|
||||
}
|
||||
}
|
||||
|
||||
return Loader::ResultStatus::ErrorNotUsed;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user