diff options
| author | bunnei <bunneidev@gmail.com> | 2018-12-27 11:15:34 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-27 11:15:34 -0500 |
| commit | 795335af0f37ce25da3c3ca8eeab62c50f87d366 (patch) | |
| tree | 48bde2f34a4e9c87dc96f83bfbeeeee96b72b9e6 /src/core/file_sys/program_metadata.cpp | |
| parent | fa9acc26d95803992ef2d6dab731f0301adec08a (diff) | |
| parent | 002ae08bbd3e5e851d8a682203462efbcf59e3dd (diff) | |
Merge pull request #1928 from lioncash/caps
kernel: Handle kernel capability descriptors
Diffstat (limited to 'src/core/file_sys/program_metadata.cpp')
| -rw-r--r-- | src/core/file_sys/program_metadata.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp index 8903ed1d3..e90c8c2de 100644 --- a/src/core/file_sys/program_metadata.cpp +++ b/src/core/file_sys/program_metadata.cpp @@ -40,6 +40,13 @@ Loader::ResultStatus ProgramMetadata::Load(VirtualFile file) { if (sizeof(FileAccessHeader) != file->ReadObject(&aci_file_access, aci_header.fah_offset)) return Loader::ResultStatus::ErrorBadFileAccessHeader; + aci_kernel_capabilities.resize(aci_header.kac_size / sizeof(u32)); + const u64 read_size = aci_header.kac_size; + const u64 read_offset = npdm_header.aci_offset + aci_header.kac_offset; + if (file->ReadBytes(aci_kernel_capabilities.data(), read_size, read_offset) != read_size) { + return Loader::ResultStatus::ErrorBadKernelCapabilityDescriptors; + } + return Loader::ResultStatus::Success; } @@ -71,6 +78,10 @@ u64 ProgramMetadata::GetFilesystemPermissions() const { return aci_file_access.permissions; } +const ProgramMetadata::KernelCapabilityDescriptors& ProgramMetadata::GetKernelCapabilities() const { + return aci_kernel_capabilities; +} + void ProgramMetadata::Print() const { LOG_DEBUG(Service_FS, "Magic: {:.4}", npdm_header.magic.data()); LOG_DEBUG(Service_FS, "Main thread priority: 0x{:02X}", npdm_header.main_thread_priority); |
