mirror of
https://github.com/citra-emu/citra-canary.git
synced 2024-12-26 08:05:40 +00:00
NCCH: Load the "logo" file from the specified offset if it's present instead of the ExeFS.
This is "new" behavior as of firmware 5.0.0-11, older titles have the logo offset and size set to 0, indicating that the logo is stored in the ExeFS.
This commit is contained in:
parent
040006fa6b
commit
8e9b55e939
|
@ -252,6 +252,26 @@ Loader::ResultStatus NCCHContainer::LoadSectionExeFS(const char* name, std::vect
|
||||||
if (result == Loader::ResultStatus::Success || !has_exefs)
|
if (result == Loader::ResultStatus::Success || !has_exefs)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
// As of firmware 5.0.0-11 the logo is stored between the access descriptor and the plain region
|
||||||
|
// instead of the ExeFS.
|
||||||
|
if (std::strcmp(name, "logo") == 0) {
|
||||||
|
if (ncch_header.logo_region_offset && ncch_header.logo_region_size) {
|
||||||
|
size_t logo_offset = ncch_header.logo_region_offset * kBlockSize;
|
||||||
|
size_t logo_size = ncch_header.logo_region_size * kBlockSize;
|
||||||
|
|
||||||
|
buffer.resize(logo_size);
|
||||||
|
file.Seek(ncch_offset + logo_offset, SEEK_SET);
|
||||||
|
|
||||||
|
if (file.ReadBytes(buffer.data(), logo_size) != logo_size) {
|
||||||
|
LOG_ERROR(Service_FS, "Could not read NCCH logo");
|
||||||
|
return Loader::ResultStatus::Error;
|
||||||
|
}
|
||||||
|
return Loader::ResultStatus::Success;
|
||||||
|
} else {
|
||||||
|
LOG_INFO(Service_FS, "Attempting to load logo from the ExeFS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If we don't have any separate files, we'll need a full ExeFS
|
// If we don't have any separate files, we'll need a full ExeFS
|
||||||
if (!exefs_file.IsOpen())
|
if (!exefs_file.IsOpen())
|
||||||
return Loader::ResultStatus::Error;
|
return Loader::ResultStatus::Error;
|
||||||
|
|
Loading…
Reference in a new issue