summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorGravatar bunnei2018-12-03 17:11:26 -0500
committerGravatar GitHub2018-12-03 17:11:26 -0500
commitf6b22d9251bd45c7bafec2214911f7a818e99cbf (patch)
treed79ba08d69fbd9686a8f49c9282c0c8a74af3609 /src/core/file_sys
parentMerge pull request #1822 from ReinUsesLisp/glsl-scope (diff)
parentfilesystem: De-globalize registered_cache_union (diff)
downloadyuzu-f6b22d9251bd45c7bafec2214911f7a818e99cbf.tar.gz
yuzu-f6b22d9251bd45c7bafec2214911f7a818e99cbf.tar.xz
yuzu-f6b22d9251bd45c7bafec2214911f7a818e99cbf.zip
Merge pull request #1835 from lioncash/cache-global
filesystem: De-globalize registered_cache_union
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/patch_manager.cpp19
-rw-r--r--src/core/file_sys/romfs_factory.cpp2
2 files changed, 10 insertions, 11 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index e8df08724..6b14e08be 100644
--- a/src/core/file_sys/patch_manager.cpp
+++ b/src/core/file_sys/patch_manager.cpp
@@ -75,12 +75,12 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
75 75
76 // Game Updates 76 // Game Updates
77 const auto update_tid = GetUpdateTitleID(title_id); 77 const auto update_tid = GetUpdateTitleID(title_id);
78 const auto update = installed->GetEntry(update_tid, ContentRecordType::Program); 78 const auto update = installed.GetEntry(update_tid, ContentRecordType::Program);
79 79
80 if (update != nullptr && update->GetExeFS() != nullptr && 80 if (update != nullptr && update->GetExeFS() != nullptr &&
81 update->GetStatus() == Loader::ResultStatus::ErrorMissingBKTRBaseRomFS) { 81 update->GetStatus() == Loader::ResultStatus::ErrorMissingBKTRBaseRomFS) {
82 LOG_INFO(Loader, " ExeFS: Update ({}) applied successfully", 82 LOG_INFO(Loader, " ExeFS: Update ({}) applied successfully",
83 FormatTitleVersion(installed->GetEntryVersion(update_tid).value_or(0))); 83 FormatTitleVersion(installed.GetEntryVersion(update_tid).value_or(0)));
84 exefs = update->GetExeFS(); 84 exefs = update->GetExeFS();
85 } 85 }
86 86
@@ -281,13 +281,13 @@ VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, Content
281 281
282 // Game Updates 282 // Game Updates
283 const auto update_tid = GetUpdateTitleID(title_id); 283 const auto update_tid = GetUpdateTitleID(title_id);
284 const auto update = installed->GetEntryRaw(update_tid, type); 284 const auto update = installed.GetEntryRaw(update_tid, type);
285 if (update != nullptr) { 285 if (update != nullptr) {
286 const auto new_nca = std::make_shared<NCA>(update, romfs, ivfc_offset); 286 const auto new_nca = std::make_shared<NCA>(update, romfs, ivfc_offset);
287 if (new_nca->GetStatus() == Loader::ResultStatus::Success && 287 if (new_nca->GetStatus() == Loader::ResultStatus::Success &&
288 new_nca->GetRomFS() != nullptr) { 288 new_nca->GetRomFS() != nullptr) {
289 LOG_INFO(Loader, " RomFS: Update ({}) applied successfully", 289 LOG_INFO(Loader, " RomFS: Update ({}) applied successfully",
290 FormatTitleVersion(installed->GetEntryVersion(update_tid).value_or(0))); 290 FormatTitleVersion(installed.GetEntryVersion(update_tid).value_or(0)));
291 romfs = new_nca->GetRomFS(); 291 romfs = new_nca->GetRomFS();
292 } 292 }
293 } else if (update_raw != nullptr) { 293 } else if (update_raw != nullptr) {
@@ -329,8 +329,8 @@ std::map<std::string, std::string, std::less<>> PatchManager::GetPatchVersionNam
329 if (nacp != nullptr) { 329 if (nacp != nullptr) {
330 out.insert_or_assign("Update", nacp->GetVersionString()); 330 out.insert_or_assign("Update", nacp->GetVersionString());
331 } else { 331 } else {
332 if (installed->HasEntry(update_tid, ContentRecordType::Program)) { 332 if (installed.HasEntry(update_tid, ContentRecordType::Program)) {
333 const auto meta_ver = installed->GetEntryVersion(update_tid); 333 const auto meta_ver = installed.GetEntryVersion(update_tid);
334 if (meta_ver.value_or(0) == 0) { 334 if (meta_ver.value_or(0) == 0) {
335 out.insert_or_assign("Update", ""); 335 out.insert_or_assign("Update", "");
336 } else { 336 } else {
@@ -383,14 +383,13 @@ std::map<std::string, std::string, std::less<>> PatchManager::GetPatchVersionNam
383 } 383 }
384 384
385 // DLC 385 // DLC
386 const auto dlc_entries = installed->ListEntriesFilter(TitleType::AOC, ContentRecordType::Data); 386 const auto dlc_entries = installed.ListEntriesFilter(TitleType::AOC, ContentRecordType::Data);
387 std::vector<RegisteredCacheEntry> dlc_match; 387 std::vector<RegisteredCacheEntry> dlc_match;
388 dlc_match.reserve(dlc_entries.size()); 388 dlc_match.reserve(dlc_entries.size());
389 std::copy_if(dlc_entries.begin(), dlc_entries.end(), std::back_inserter(dlc_match), 389 std::copy_if(dlc_entries.begin(), dlc_entries.end(), std::back_inserter(dlc_match),
390 [this, &installed](const RegisteredCacheEntry& entry) { 390 [this, &installed](const RegisteredCacheEntry& entry) {
391 return (entry.title_id & DLC_BASE_TITLE_ID_MASK) == title_id && 391 return (entry.title_id & DLC_BASE_TITLE_ID_MASK) == title_id &&
392 installed->GetEntry(entry)->GetStatus() == 392 installed.GetEntry(entry)->GetStatus() == Loader::ResultStatus::Success;
393 Loader::ResultStatus::Success;
394 }); 393 });
395 if (!dlc_match.empty()) { 394 if (!dlc_match.empty()) {
396 // Ensure sorted so DLC IDs show in order. 395 // Ensure sorted so DLC IDs show in order.
@@ -411,7 +410,7 @@ std::map<std::string, std::string, std::less<>> PatchManager::GetPatchVersionNam
411std::pair<std::unique_ptr<NACP>, VirtualFile> PatchManager::GetControlMetadata() const { 410std::pair<std::unique_ptr<NACP>, VirtualFile> PatchManager::GetControlMetadata() const {
412 const auto installed{Service::FileSystem::GetUnionContents()}; 411 const auto installed{Service::FileSystem::GetUnionContents()};
413 412
414 const auto base_control_nca = installed->GetEntry(title_id, ContentRecordType::Control); 413 const auto base_control_nca = installed.GetEntry(title_id, ContentRecordType::Control);
415 if (base_control_nca == nullptr) 414 if (base_control_nca == nullptr)
416 return {}; 415 return {};
417 416
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp
index 0b645b106..6ad1e4f86 100644
--- a/src/core/file_sys/romfs_factory.cpp
+++ b/src/core/file_sys/romfs_factory.cpp
@@ -48,7 +48,7 @@ ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, Conte
48 48
49 switch (storage) { 49 switch (storage) {
50 case StorageId::None: 50 case StorageId::None:
51 res = Service::FileSystem::GetUnionContents()->GetEntry(title_id, type); 51 res = Service::FileSystem::GetUnionContents().GetEntry(title_id, type);
52 break; 52 break;
53 case StorageId::NandSystem: 53 case StorageId::NandSystem:
54 res = Service::FileSystem::GetSystemNANDContents()->GetEntry(title_id, type); 54 res = Service::FileSystem::GetSystemNANDContents()->GetEntry(title_id, type);