Просмотр исходного кода

content_archive: Add optional KeyManager parameter to constructor
Allows resuing a common KeyManager when a large amount of NCAs are handled by the same class. Should the parameter not be provided, a new KeyManager will be constructed, as was the default behavior prior to this.

Zach Hilman 7 лет назад
Родитель
Сommit
e20db909ee
2 измененных файлов с 5 добавлено и 3 удалено
  1. 3 2
      src/core/file_sys/content_archive.cpp
  2. 2 1
      src/core/file_sys/content_archive.h

+ 3 - 2
src/core/file_sys/content_archive.cpp

@@ -101,8 +101,9 @@ static bool IsValidNCA(const NCAHeader& header) {
     return header.magic == Common::MakeMagic('N', 'C', 'A', '3');
 }
 
-NCA::NCA(VirtualFile file_, VirtualFile bktr_base_romfs_, u64 bktr_base_ivfc_offset)
-    : file(std::move(file_)), bktr_base_romfs(std::move(bktr_base_romfs_)) {
+NCA::NCA(VirtualFile file_, VirtualFile bktr_base_romfs_, u64 bktr_base_ivfc_offset,
+         Core::Crypto::KeyManager keys_)
+    : file(std::move(file_)), bktr_base_romfs(std::move(bktr_base_romfs_)), keys(std::move(keys_)) {
     if (file == nullptr) {
         status = Loader::ResultStatus::ErrorNullFile;
         return;

+ 2 - 1
src/core/file_sys/content_archive.h

@@ -79,7 +79,8 @@ inline bool IsDirectoryExeFS(const std::shared_ptr<VfsDirectory>& pfs) {
 class NCA : public ReadOnlyVfsDirectory {
 public:
     explicit NCA(VirtualFile file, VirtualFile bktr_base_romfs = nullptr,
-                 u64 bktr_base_ivfc_offset = 0);
+                 u64 bktr_base_ivfc_offset = 0,
+                 Core::Crypto::KeyManager keys = Core::Crypto::KeyManager());
     ~NCA() override;
 
     Loader::ResultStatus GetStatus() const;