summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-12-20 05:50:20 +0100
committerLioncash <mathew1800@gmail.com>2018-12-21 13:05:34 +0100
commit002ae08bbd3e5e851d8a682203462efbcf59e3dd (patch)
tree231239717b1035634a2d6ec5d09622fd7a5c6f4b /src/core/file_sys
parentkernel/process_capability: Handle debug capability flags (diff)
downloadyuzu-002ae08bbd3e5e851d8a682203462efbcf59e3dd.tar
yuzu-002ae08bbd3e5e851d8a682203462efbcf59e3dd.tar.gz
yuzu-002ae08bbd3e5e851d8a682203462efbcf59e3dd.tar.bz2
yuzu-002ae08bbd3e5e851d8a682203462efbcf59e3dd.tar.lz
yuzu-002ae08bbd3e5e851d8a682203462efbcf59e3dd.tar.xz
yuzu-002ae08bbd3e5e851d8a682203462efbcf59e3dd.tar.zst
yuzu-002ae08bbd3e5e851d8a682203462efbcf59e3dd.zip
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/program_metadata.cpp11
-rw-r--r--src/core/file_sys/program_metadata.h6
2 files changed, 17 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);
diff --git a/src/core/file_sys/program_metadata.h b/src/core/file_sys/program_metadata.h
index e4470d6f0..0033ba347 100644
--- a/src/core/file_sys/program_metadata.h
+++ b/src/core/file_sys/program_metadata.h
@@ -5,6 +5,7 @@
#pragma once
#include <array>
+#include <vector>
#include "common/bit_field.h"
#include "common/common_types.h"
#include "common/swap.h"
@@ -38,6 +39,8 @@ enum class ProgramFilePermission : u64 {
*/
class ProgramMetadata {
public:
+ using KernelCapabilityDescriptors = std::vector<u32>;
+
ProgramMetadata();
~ProgramMetadata();
@@ -50,6 +53,7 @@ public:
u32 GetMainThreadStackSize() const;
u64 GetTitleID() const;
u64 GetFilesystemPermissions() const;
+ const KernelCapabilityDescriptors& GetKernelCapabilities() const;
void Print() const;
@@ -154,6 +158,8 @@ private:
FileAccessControl acid_file_access;
FileAccessHeader aci_file_access;
+
+ KernelCapabilityDescriptors aci_kernel_capabilities;
};
} // namespace FileSys