summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/crypto/key_manager.cpp2
-rw-r--r--src/core/file_sys/patch_manager.cpp19
-rw-r--r--src/core/file_sys/romfs_factory.cpp2
-rw-r--r--src/core/hle/service/aoc/aoc_u.cpp4
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp18
-rw-r--r--src/core/hle/service/filesystem/filesystem.h3
-rw-r--r--src/yuzu/game_list_worker.cpp14
-rw-r--r--src/yuzu/main.cpp4
8 files changed, 26 insertions, 40 deletions
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp
index 904afa039..ed231927b 100644
--- a/src/core/crypto/key_manager.cpp
+++ b/src/core/crypto/key_manager.cpp
@@ -794,7 +794,7 @@ void KeyManager::DeriveBase() {
794 794
795void KeyManager::DeriveETicket(PartitionDataManager& data) { 795void KeyManager::DeriveETicket(PartitionDataManager& data) {
796 // ETicket keys 796 // ETicket keys
797 const auto es = Service::FileSystem::GetUnionContents()->GetEntry( 797 const auto es = Service::FileSystem::GetUnionContents().GetEntry(
798 0x0100000000000033, FileSys::ContentRecordType::Program); 798 0x0100000000000033, FileSys::ContentRecordType::Program);
799 799
800 if (es == nullptr) 800 if (es == nullptr)
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);
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp
index bacf19de2..b160c8bee 100644
--- a/src/core/hle/service/aoc/aoc_u.cpp
+++ b/src/core/hle/service/aoc/aoc_u.cpp
@@ -32,14 +32,14 @@ static std::vector<u64> AccumulateAOCTitleIDs() {
32 std::vector<u64> add_on_content; 32 std::vector<u64> add_on_content;
33 const auto rcu = FileSystem::GetUnionContents(); 33 const auto rcu = FileSystem::GetUnionContents();
34 const auto list = 34 const auto list =
35 rcu->ListEntriesFilter(FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); 35 rcu.ListEntriesFilter(FileSys::TitleType::AOC, FileSys::ContentRecordType::Data);
36 std::transform(list.begin(), list.end(), std::back_inserter(add_on_content), 36 std::transform(list.begin(), list.end(), std::back_inserter(add_on_content),
37 [](const FileSys::RegisteredCacheEntry& rce) { return rce.title_id; }); 37 [](const FileSys::RegisteredCacheEntry& rce) { return rce.title_id; });
38 add_on_content.erase( 38 add_on_content.erase(
39 std::remove_if( 39 std::remove_if(
40 add_on_content.begin(), add_on_content.end(), 40 add_on_content.begin(), add_on_content.end(),
41 [&rcu](u64 tid) { 41 [&rcu](u64 tid) {
42 return rcu->GetEntry(tid, FileSys::ContentRecordType::Data)->GetStatus() != 42 return rcu.GetEntry(tid, FileSys::ContentRecordType::Data)->GetStatus() !=
43 Loader::ResultStatus::Success; 43 Loader::ResultStatus::Success;
44 }), 44 }),
45 add_on_content.end()); 45 add_on_content.end());
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index 2aa77f68d..dbef3b2e4 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -329,20 +329,9 @@ ResultVal<FileSys::VirtualDir> OpenSDMC() {
329 return sdmc_factory->Open(); 329 return sdmc_factory->Open();
330} 330}
331 331
332std::shared_ptr<FileSys::RegisteredCacheUnion> registered_cache_union; 332FileSys::RegisteredCacheUnion GetUnionContents() {
333 333 return FileSys::RegisteredCacheUnion{
334std::shared_ptr<FileSys::RegisteredCacheUnion> GetUnionContents() { 334 {GetSystemNANDContents(), GetUserNANDContents(), GetSDMCContents()}};
335 if (registered_cache_union == nullptr) {
336 registered_cache_union =
337 std::make_shared<FileSys::RegisteredCacheUnion>(std::vector<FileSys::RegisteredCache*>{
338 GetSystemNANDContents(), GetUserNANDContents(), GetSDMCContents()});
339 }
340
341 return registered_cache_union;
342}
343
344void ClearUnionContents() {
345 registered_cache_union = nullptr;
346} 335}
347 336
348FileSys::RegisteredCache* GetSystemNANDContents() { 337FileSys::RegisteredCache* GetSystemNANDContents() {
@@ -395,7 +384,6 @@ void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) {
395 bis_factory = nullptr; 384 bis_factory = nullptr;
396 save_data_factory = nullptr; 385 save_data_factory = nullptr;
397 sdmc_factory = nullptr; 386 sdmc_factory = nullptr;
398 ClearUnionContents();
399 } 387 }
400 388
401 auto nand_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), 389 auto nand_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir),
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h
index 0a6cb6635..93bf1b793 100644
--- a/src/core/hle/service/filesystem/filesystem.h
+++ b/src/core/hle/service/filesystem/filesystem.h
@@ -48,8 +48,7 @@ ResultVal<FileSys::VirtualDir> OpenSaveData(FileSys::SaveDataSpaceId space,
48ResultVal<FileSys::VirtualDir> OpenSaveDataSpace(FileSys::SaveDataSpaceId space); 48ResultVal<FileSys::VirtualDir> OpenSaveDataSpace(FileSys::SaveDataSpaceId space);
49ResultVal<FileSys::VirtualDir> OpenSDMC(); 49ResultVal<FileSys::VirtualDir> OpenSDMC();
50 50
51std::shared_ptr<FileSys::RegisteredCacheUnion> GetUnionContents(); 51FileSys::RegisteredCacheUnion GetUnionContents();
52void ClearUnionContents();
53 52
54FileSys::RegisteredCache* GetSystemNANDContents(); 53FileSys::RegisteredCache* GetSystemNANDContents();
55FileSys::RegisteredCache* GetUserNANDContents(); 54FileSys::RegisteredCache* GetUserNANDContents();
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp
index 362902e46..1edc60df7 100644
--- a/src/yuzu/game_list_worker.cpp
+++ b/src/yuzu/game_list_worker.cpp
@@ -97,11 +97,11 @@ GameListWorker::~GameListWorker() = default;
97 97
98void GameListWorker::AddInstalledTitlesToGameList() { 98void GameListWorker::AddInstalledTitlesToGameList() {
99 const auto cache = Service::FileSystem::GetUnionContents(); 99 const auto cache = Service::FileSystem::GetUnionContents();
100 const auto installed_games = cache->ListEntriesFilter(FileSys::TitleType::Application, 100 const auto installed_games = cache.ListEntriesFilter(FileSys::TitleType::Application,
101 FileSys::ContentRecordType::Program); 101 FileSys::ContentRecordType::Program);
102 102
103 for (const auto& game : installed_games) { 103 for (const auto& game : installed_games) {
104 const auto file = cache->GetEntryUnparsed(game); 104 const auto file = cache.GetEntryUnparsed(game);
105 std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(file); 105 std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(file);
106 if (!loader) 106 if (!loader)
107 continue; 107 continue;
@@ -112,7 +112,7 @@ void GameListWorker::AddInstalledTitlesToGameList() {
112 loader->ReadProgramId(program_id); 112 loader->ReadProgramId(program_id);
113 113
114 const FileSys::PatchManager patch{program_id}; 114 const FileSys::PatchManager patch{program_id};
115 const auto control = cache->GetEntry(game.title_id, FileSys::ContentRecordType::Control); 115 const auto control = cache.GetEntry(game.title_id, FileSys::ContentRecordType::Control);
116 if (control != nullptr) 116 if (control != nullptr)
117 GetMetadataFromControlNCA(patch, *control, icon, name); 117 GetMetadataFromControlNCA(patch, *control, icon, name);
118 118
@@ -141,11 +141,11 @@ void GameListWorker::AddInstalledTitlesToGameList() {
141 emit EntryReady(list); 141 emit EntryReady(list);
142 } 142 }
143 143
144 const auto control_data = cache->ListEntriesFilter(FileSys::TitleType::Application, 144 const auto control_data = cache.ListEntriesFilter(FileSys::TitleType::Application,
145 FileSys::ContentRecordType::Control); 145 FileSys::ContentRecordType::Control);
146 146
147 for (const auto& entry : control_data) { 147 for (const auto& entry : control_data) {
148 auto nca = cache->GetEntry(entry); 148 auto nca = cache.GetEntry(entry);
149 if (nca != nullptr) { 149 if (nca != nullptr) {
150 nca_control_map.insert_or_assign(entry.title_id, std::move(nca)); 150 nca_control_map.insert_or_assign(entry.title_id, std::move(nca));
151 } 151 }
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 93bf117c8..6e7d300a0 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -905,7 +905,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
905 } 905 }
906 906
907 const auto installed = Service::FileSystem::GetUnionContents(); 907 const auto installed = Service::FileSystem::GetUnionContents();
908 auto romfs_title_id = SelectRomFSDumpTarget(*installed, program_id); 908 const auto romfs_title_id = SelectRomFSDumpTarget(installed, program_id);
909 909
910 if (!romfs_title_id) { 910 if (!romfs_title_id) {
911 failed(); 911 failed();
@@ -920,7 +920,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
920 if (*romfs_title_id == program_id) { 920 if (*romfs_title_id == program_id) {
921 romfs = file; 921 romfs = file;
922 } else { 922 } else {
923 romfs = installed->GetEntry(*romfs_title_id, FileSys::ContentRecordType::Data)->GetRomFS(); 923 romfs = installed.GetEntry(*romfs_title_id, FileSys::ContentRecordType::Data)->GetRomFS();
924 } 924 }
925 925
926 const auto extracted = FileSys::ExtractRomFS(romfs, FileSys::RomFSExtractionType::Full); 926 const auto extracted = FileSys::ExtractRomFS(romfs, FileSys::RomFSExtractionType::Full);