diff options
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/bis_factory.cpp | 12 | ||||
| -rw-r--r-- | src/core/file_sys/bis_factory.h | 8 | ||||
| -rw-r--r-- | src/core/file_sys/patch_manager.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 14 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.h | 12 | ||||
| -rw-r--r-- | src/core/file_sys/sdmc_factory.cpp | 8 | ||||
| -rw-r--r-- | src/core/file_sys/sdmc_factory.h | 4 |
7 files changed, 30 insertions, 30 deletions
diff --git a/src/core/file_sys/bis_factory.cpp b/src/core/file_sys/bis_factory.cpp index 6102ef476..76a2b7e86 100644 --- a/src/core/file_sys/bis_factory.cpp +++ b/src/core/file_sys/bis_factory.cpp | |||
| @@ -10,19 +10,19 @@ namespace FileSys { | |||
| 10 | 10 | ||
| 11 | BISFactory::BISFactory(VirtualDir nand_root_, VirtualDir load_root_) | 11 | BISFactory::BISFactory(VirtualDir nand_root_, VirtualDir load_root_) |
| 12 | : nand_root(std::move(nand_root_)), load_root(std::move(load_root_)), | 12 | : nand_root(std::move(nand_root_)), load_root(std::move(load_root_)), |
| 13 | sysnand_cache(std::make_shared<RegisteredCache>( | 13 | sysnand_cache(std::make_unique<RegisteredCache>( |
| 14 | GetOrCreateDirectoryRelative(nand_root, "/system/Contents/registered"))), | 14 | GetOrCreateDirectoryRelative(nand_root, "/system/Contents/registered"))), |
| 15 | usrnand_cache(std::make_shared<RegisteredCache>( | 15 | usrnand_cache(std::make_unique<RegisteredCache>( |
| 16 | GetOrCreateDirectoryRelative(nand_root, "/user/Contents/registered"))) {} | 16 | GetOrCreateDirectoryRelative(nand_root, "/user/Contents/registered"))) {} |
| 17 | 17 | ||
| 18 | BISFactory::~BISFactory() = default; | 18 | BISFactory::~BISFactory() = default; |
| 19 | 19 | ||
| 20 | std::shared_ptr<RegisteredCache> BISFactory::GetSystemNANDContents() const { | 20 | RegisteredCache* BISFactory::GetSystemNANDContents() const { |
| 21 | return sysnand_cache; | 21 | return sysnand_cache.get(); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | std::shared_ptr<RegisteredCache> BISFactory::GetUserNANDContents() const { | 24 | RegisteredCache* BISFactory::GetUserNANDContents() const { |
| 25 | return usrnand_cache; | 25 | return usrnand_cache.get(); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | VirtualDir BISFactory::GetModificationLoadRoot(u64 title_id) const { | 28 | VirtualDir BISFactory::GetModificationLoadRoot(u64 title_id) const { |
diff --git a/src/core/file_sys/bis_factory.h b/src/core/file_sys/bis_factory.h index c352e0925..364d309bd 100644 --- a/src/core/file_sys/bis_factory.h +++ b/src/core/file_sys/bis_factory.h | |||
| @@ -20,8 +20,8 @@ public: | |||
| 20 | explicit BISFactory(VirtualDir nand_root, VirtualDir load_root); | 20 | explicit BISFactory(VirtualDir nand_root, VirtualDir load_root); |
| 21 | ~BISFactory(); | 21 | ~BISFactory(); |
| 22 | 22 | ||
| 23 | std::shared_ptr<RegisteredCache> GetSystemNANDContents() const; | 23 | RegisteredCache* GetSystemNANDContents() const; |
| 24 | std::shared_ptr<RegisteredCache> GetUserNANDContents() const; | 24 | RegisteredCache* GetUserNANDContents() const; |
| 25 | 25 | ||
| 26 | VirtualDir GetModificationLoadRoot(u64 title_id) const; | 26 | VirtualDir GetModificationLoadRoot(u64 title_id) const; |
| 27 | 27 | ||
| @@ -29,8 +29,8 @@ private: | |||
| 29 | VirtualDir nand_root; | 29 | VirtualDir nand_root; |
| 30 | VirtualDir load_root; | 30 | VirtualDir load_root; |
| 31 | 31 | ||
| 32 | std::shared_ptr<RegisteredCache> sysnand_cache; | 32 | std::unique_ptr<RegisteredCache> sysnand_cache; |
| 33 | std::shared_ptr<RegisteredCache> usrnand_cache; | 33 | std::unique_ptr<RegisteredCache> usrnand_cache; |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | } // namespace FileSys | 36 | } // namespace FileSys |
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index 019caebe9..c15ac8e19 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp | |||
| @@ -346,7 +346,7 @@ std::map<std::string, std::string, std::less<>> PatchManager::GetPatchVersionNam | |||
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | std::pair<std::unique_ptr<NACP>, VirtualFile> PatchManager::GetControlMetadata() const { | 348 | std::pair<std::unique_ptr<NACP>, VirtualFile> PatchManager::GetControlMetadata() const { |
| 349 | const auto& installed{Service::FileSystem::GetUnionContents()}; | 349 | const auto installed{Service::FileSystem::GetUnionContents()}; |
| 350 | 350 | ||
| 351 | const auto base_control_nca = installed->GetEntry(title_id, ContentRecordType::Control); | 351 | const auto base_control_nca = installed->GetEntry(title_id, ContentRecordType::Control); |
| 352 | if (base_control_nca == nullptr) | 352 | if (base_control_nca == nullptr) |
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index e9b040689..1febb398e 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -308,14 +308,14 @@ VirtualFile RegisteredCache::GetEntryRaw(RegisteredCacheEntry entry) const { | |||
| 308 | return GetEntryRaw(entry.title_id, entry.type); | 308 | return GetEntryRaw(entry.title_id, entry.type); |
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | std::shared_ptr<NCA> RegisteredCache::GetEntry(u64 title_id, ContentRecordType type) const { | 311 | std::unique_ptr<NCA> RegisteredCache::GetEntry(u64 title_id, ContentRecordType type) const { |
| 312 | const auto raw = GetEntryRaw(title_id, type); | 312 | const auto raw = GetEntryRaw(title_id, type); |
| 313 | if (raw == nullptr) | 313 | if (raw == nullptr) |
| 314 | return nullptr; | 314 | return nullptr; |
| 315 | return std::make_shared<NCA>(raw); | 315 | return std::make_unique<NCA>(raw); |
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | std::shared_ptr<NCA> RegisteredCache::GetEntry(RegisteredCacheEntry entry) const { | 318 | std::unique_ptr<NCA> RegisteredCache::GetEntry(RegisteredCacheEntry entry) const { |
| 319 | return GetEntry(entry.title_id, entry.type); | 319 | return GetEntry(entry.title_id, entry.type); |
| 320 | } | 320 | } |
| 321 | 321 | ||
| @@ -516,7 +516,7 @@ bool RegisteredCache::RawInstallYuzuMeta(const CNMT& cnmt) { | |||
| 516 | }) != yuzu_meta.end(); | 516 | }) != yuzu_meta.end(); |
| 517 | } | 517 | } |
| 518 | 518 | ||
| 519 | RegisteredCacheUnion::RegisteredCacheUnion(std::vector<std::shared_ptr<RegisteredCache>> caches) | 519 | RegisteredCacheUnion::RegisteredCacheUnion(std::vector<RegisteredCache*> caches) |
| 520 | : caches(std::move(caches)) {} | 520 | : caches(std::move(caches)) {} |
| 521 | 521 | ||
| 522 | void RegisteredCacheUnion::Refresh() { | 522 | void RegisteredCacheUnion::Refresh() { |
| @@ -572,14 +572,14 @@ VirtualFile RegisteredCacheUnion::GetEntryRaw(RegisteredCacheEntry entry) const | |||
| 572 | return GetEntryRaw(entry.title_id, entry.type); | 572 | return GetEntryRaw(entry.title_id, entry.type); |
| 573 | } | 573 | } |
| 574 | 574 | ||
| 575 | std::shared_ptr<NCA> RegisteredCacheUnion::GetEntry(u64 title_id, ContentRecordType type) const { | 575 | std::unique_ptr<NCA> RegisteredCacheUnion::GetEntry(u64 title_id, ContentRecordType type) const { |
| 576 | const auto raw = GetEntryRaw(title_id, type); | 576 | const auto raw = GetEntryRaw(title_id, type); |
| 577 | if (raw == nullptr) | 577 | if (raw == nullptr) |
| 578 | return nullptr; | 578 | return nullptr; |
| 579 | return std::make_shared<NCA>(raw); | 579 | return std::make_unique<NCA>(raw); |
| 580 | } | 580 | } |
| 581 | 581 | ||
| 582 | std::shared_ptr<NCA> RegisteredCacheUnion::GetEntry(RegisteredCacheEntry entry) const { | 582 | std::unique_ptr<NCA> RegisteredCacheUnion::GetEntry(RegisteredCacheEntry entry) const { |
| 583 | return GetEntry(entry.title_id, entry.type); | 583 | return GetEntry(entry.title_id, entry.type); |
| 584 | } | 584 | } |
| 585 | 585 | ||
diff --git a/src/core/file_sys/registered_cache.h b/src/core/file_sys/registered_cache.h index c0cd59fc5..5ddacba47 100644 --- a/src/core/file_sys/registered_cache.h +++ b/src/core/file_sys/registered_cache.h | |||
| @@ -88,8 +88,8 @@ public: | |||
| 88 | VirtualFile GetEntryRaw(u64 title_id, ContentRecordType type) const; | 88 | VirtualFile GetEntryRaw(u64 title_id, ContentRecordType type) const; |
| 89 | VirtualFile GetEntryRaw(RegisteredCacheEntry entry) const; | 89 | VirtualFile GetEntryRaw(RegisteredCacheEntry entry) const; |
| 90 | 90 | ||
| 91 | std::shared_ptr<NCA> GetEntry(u64 title_id, ContentRecordType type) const; | 91 | std::unique_ptr<NCA> GetEntry(u64 title_id, ContentRecordType type) const; |
| 92 | std::shared_ptr<NCA> GetEntry(RegisteredCacheEntry entry) const; | 92 | std::unique_ptr<NCA> GetEntry(RegisteredCacheEntry entry) const; |
| 93 | 93 | ||
| 94 | std::vector<RegisteredCacheEntry> ListEntries() const; | 94 | std::vector<RegisteredCacheEntry> ListEntries() const; |
| 95 | // If a parameter is not boost::none, it will be filtered for from all entries. | 95 | // If a parameter is not boost::none, it will be filtered for from all entries. |
| @@ -142,7 +142,7 @@ private: | |||
| 142 | // Combines multiple RegisteredCaches (i.e. SysNAND, UserNAND, SDMC) into one interface. | 142 | // Combines multiple RegisteredCaches (i.e. SysNAND, UserNAND, SDMC) into one interface. |
| 143 | class RegisteredCacheUnion { | 143 | class RegisteredCacheUnion { |
| 144 | public: | 144 | public: |
| 145 | explicit RegisteredCacheUnion(std::vector<std::shared_ptr<RegisteredCache>> caches); | 145 | explicit RegisteredCacheUnion(std::vector<RegisteredCache*> caches); |
| 146 | 146 | ||
| 147 | void Refresh(); | 147 | void Refresh(); |
| 148 | 148 | ||
| @@ -157,8 +157,8 @@ public: | |||
| 157 | VirtualFile GetEntryRaw(u64 title_id, ContentRecordType type) const; | 157 | VirtualFile GetEntryRaw(u64 title_id, ContentRecordType type) const; |
| 158 | VirtualFile GetEntryRaw(RegisteredCacheEntry entry) const; | 158 | VirtualFile GetEntryRaw(RegisteredCacheEntry entry) const; |
| 159 | 159 | ||
| 160 | std::shared_ptr<NCA> GetEntry(u64 title_id, ContentRecordType type) const; | 160 | std::unique_ptr<NCA> GetEntry(u64 title_id, ContentRecordType type) const; |
| 161 | std::shared_ptr<NCA> GetEntry(RegisteredCacheEntry entry) const; | 161 | std::unique_ptr<NCA> GetEntry(RegisteredCacheEntry entry) const; |
| 162 | 162 | ||
| 163 | std::vector<RegisteredCacheEntry> ListEntries() const; | 163 | std::vector<RegisteredCacheEntry> ListEntries() const; |
| 164 | // If a parameter is not boost::none, it will be filtered for from all entries. | 164 | // If a parameter is not boost::none, it will be filtered for from all entries. |
| @@ -168,7 +168,7 @@ public: | |||
| 168 | boost::optional<u64> title_id = boost::none) const; | 168 | boost::optional<u64> title_id = boost::none) const; |
| 169 | 169 | ||
| 170 | private: | 170 | private: |
| 171 | std::vector<std::shared_ptr<RegisteredCache>> caches; | 171 | std::vector<RegisteredCache*> caches; |
| 172 | }; | 172 | }; |
| 173 | 173 | ||
| 174 | } // namespace FileSys | 174 | } // namespace FileSys |
diff --git a/src/core/file_sys/sdmc_factory.cpp b/src/core/file_sys/sdmc_factory.cpp index d66a9c9a4..bd3a57058 100644 --- a/src/core/file_sys/sdmc_factory.cpp +++ b/src/core/file_sys/sdmc_factory.cpp | |||
| @@ -10,10 +10,10 @@ | |||
| 10 | namespace FileSys { | 10 | namespace FileSys { |
| 11 | 11 | ||
| 12 | SDMCFactory::SDMCFactory(VirtualDir dir_) | 12 | SDMCFactory::SDMCFactory(VirtualDir dir_) |
| 13 | : dir(std::move(dir_)), contents(std::make_shared<RegisteredCache>( | 13 | : dir(std::move(dir_)), contents(std::make_unique<RegisteredCache>( |
| 14 | GetOrCreateDirectoryRelative(dir, "/Nintendo/Contents/registered"), | 14 | GetOrCreateDirectoryRelative(dir, "/Nintendo/Contents/registered"), |
| 15 | [](const VirtualFile& file, const NcaID& id) { | 15 | [](const VirtualFile& file, const NcaID& id) { |
| 16 | return std::make_shared<NAX>(file, id)->GetDecrypted(); | 16 | return NAX{file, id}.GetDecrypted(); |
| 17 | })) {} | 17 | })) {} |
| 18 | 18 | ||
| 19 | SDMCFactory::~SDMCFactory() = default; | 19 | SDMCFactory::~SDMCFactory() = default; |
| @@ -22,8 +22,8 @@ ResultVal<VirtualDir> SDMCFactory::Open() { | |||
| 22 | return MakeResult<VirtualDir>(dir); | 22 | return MakeResult<VirtualDir>(dir); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | std::shared_ptr<RegisteredCache> SDMCFactory::GetSDMCContents() const { | 25 | RegisteredCache* SDMCFactory::GetSDMCContents() const { |
| 26 | return contents; | 26 | return contents.get(); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | } // namespace FileSys | 29 | } // namespace FileSys |
diff --git a/src/core/file_sys/sdmc_factory.h b/src/core/file_sys/sdmc_factory.h index ea12149de..42794ba5b 100644 --- a/src/core/file_sys/sdmc_factory.h +++ b/src/core/file_sys/sdmc_factory.h | |||
| @@ -19,12 +19,12 @@ public: | |||
| 19 | ~SDMCFactory(); | 19 | ~SDMCFactory(); |
| 20 | 20 | ||
| 21 | ResultVal<VirtualDir> Open(); | 21 | ResultVal<VirtualDir> Open(); |
| 22 | std::shared_ptr<RegisteredCache> GetSDMCContents() const; | 22 | RegisteredCache* GetSDMCContents() const; |
| 23 | 23 | ||
| 24 | private: | 24 | private: |
| 25 | VirtualDir dir; | 25 | VirtualDir dir; |
| 26 | 26 | ||
| 27 | std::shared_ptr<RegisteredCache> contents; | 27 | std::unique_ptr<RegisteredCache> contents; |
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| 30 | } // namespace FileSys | 30 | } // namespace FileSys |