diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/crypto/key_manager.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/patch_manager.cpp | 19 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_factory.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/aoc/aoc_u.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 18 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.h | 3 | ||||
| -rw-r--r-- | src/yuzu/game_list_worker.cpp | 14 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 4 |
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 | ||
| 795 | void KeyManager::DeriveETicket(PartitionDataManager& data) { | 795 | void 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 | |||
| 411 | std::pair<std::unique_ptr<NACP>, VirtualFile> PatchManager::GetControlMetadata() const { | 410 | std::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 b276de332..0417fdb92 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp | |||
| @@ -34,14 +34,14 @@ static std::vector<u64> AccumulateAOCTitleIDs() { | |||
| 34 | std::vector<u64> add_on_content; | 34 | std::vector<u64> add_on_content; |
| 35 | const auto rcu = FileSystem::GetUnionContents(); | 35 | const auto rcu = FileSystem::GetUnionContents(); |
| 36 | const auto list = | 36 | const auto list = |
| 37 | rcu->ListEntriesFilter(FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); | 37 | rcu.ListEntriesFilter(FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); |
| 38 | std::transform(list.begin(), list.end(), std::back_inserter(add_on_content), | 38 | std::transform(list.begin(), list.end(), std::back_inserter(add_on_content), |
| 39 | [](const FileSys::RegisteredCacheEntry& rce) { return rce.title_id; }); | 39 | [](const FileSys::RegisteredCacheEntry& rce) { return rce.title_id; }); |
| 40 | add_on_content.erase( | 40 | add_on_content.erase( |
| 41 | std::remove_if( | 41 | std::remove_if( |
| 42 | add_on_content.begin(), add_on_content.end(), | 42 | add_on_content.begin(), add_on_content.end(), |
| 43 | [&rcu](u64 tid) { | 43 | [&rcu](u64 tid) { |
| 44 | return rcu->GetEntry(tid, FileSys::ContentRecordType::Data)->GetStatus() != | 44 | return rcu.GetEntry(tid, FileSys::ContentRecordType::Data)->GetStatus() != |
| 45 | Loader::ResultStatus::Success; | 45 | Loader::ResultStatus::Success; |
| 46 | }), | 46 | }), |
| 47 | add_on_content.end()); | 47 | add_on_content.end()); |
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 3bdff4036..b1490e6fa 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp | |||
| @@ -341,20 +341,9 @@ ResultVal<FileSys::VirtualDir> OpenSDMC() { | |||
| 341 | return sdmc_factory->Open(); | 341 | return sdmc_factory->Open(); |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | std::shared_ptr<FileSys::RegisteredCacheUnion> registered_cache_union; | 344 | FileSys::RegisteredCacheUnion GetUnionContents() { |
| 345 | 345 | return FileSys::RegisteredCacheUnion{ | |
| 346 | std::shared_ptr<FileSys::RegisteredCacheUnion> GetUnionContents() { | 346 | {GetSystemNANDContents(), GetUserNANDContents(), GetSDMCContents()}}; |
| 347 | if (registered_cache_union == nullptr) { | ||
| 348 | registered_cache_union = | ||
| 349 | std::make_shared<FileSys::RegisteredCacheUnion>(std::vector<FileSys::RegisteredCache*>{ | ||
| 350 | GetSystemNANDContents(), GetUserNANDContents(), GetSDMCContents()}); | ||
| 351 | } | ||
| 352 | |||
| 353 | return registered_cache_union; | ||
| 354 | } | ||
| 355 | |||
| 356 | void ClearUnionContents() { | ||
| 357 | registered_cache_union = nullptr; | ||
| 358 | } | 347 | } |
| 359 | 348 | ||
| 360 | FileSys::RegisteredCache* GetSystemNANDContents() { | 349 | FileSys::RegisteredCache* GetSystemNANDContents() { |
| @@ -407,7 +396,6 @@ void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) { | |||
| 407 | bis_factory = nullptr; | 396 | bis_factory = nullptr; |
| 408 | save_data_factory = nullptr; | 397 | save_data_factory = nullptr; |
| 409 | sdmc_factory = nullptr; | 398 | sdmc_factory = nullptr; |
| 410 | ClearUnionContents(); | ||
| 411 | } | 399 | } |
| 412 | 400 | ||
| 413 | auto nand_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), | 401 | 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 278cf90ab..965414be0 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, | |||
| 48 | ResultVal<FileSys::VirtualDir> OpenSaveDataSpace(FileSys::SaveDataSpaceId space); | 48 | ResultVal<FileSys::VirtualDir> OpenSaveDataSpace(FileSys::SaveDataSpaceId space); |
| 49 | ResultVal<FileSys::VirtualDir> OpenSDMC(); | 49 | ResultVal<FileSys::VirtualDir> OpenSDMC(); |
| 50 | 50 | ||
| 51 | std::shared_ptr<FileSys::RegisteredCacheUnion> GetUnionContents(); | 51 | FileSys::RegisteredCacheUnion GetUnionContents(); |
| 52 | void ClearUnionContents(); | ||
| 53 | 52 | ||
| 54 | FileSys::RegisteredCache* GetSystemNANDContents(); | 53 | FileSys::RegisteredCache* GetSystemNANDContents(); |
| 55 | FileSys::RegisteredCache* GetUserNANDContents(); | 54 | FileSys::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 | ||
| 98 | void GameListWorker::AddInstalledTitlesToGameList() { | 98 | void 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 d4010001d..22c207a3a 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -907,7 +907,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa | |||
| 907 | } | 907 | } |
| 908 | 908 | ||
| 909 | const auto installed = Service::FileSystem::GetUnionContents(); | 909 | const auto installed = Service::FileSystem::GetUnionContents(); |
| 910 | auto romfs_title_id = SelectRomFSDumpTarget(*installed, program_id); | 910 | const auto romfs_title_id = SelectRomFSDumpTarget(installed, program_id); |
| 911 | 911 | ||
| 912 | if (!romfs_title_id) { | 912 | if (!romfs_title_id) { |
| 913 | failed(); | 913 | failed(); |
| @@ -922,7 +922,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa | |||
| 922 | if (*romfs_title_id == program_id) { | 922 | if (*romfs_title_id == program_id) { |
| 923 | romfs = file; | 923 | romfs = file; |
| 924 | } else { | 924 | } else { |
| 925 | romfs = installed->GetEntry(*romfs_title_id, FileSys::ContentRecordType::Data)->GetRomFS(); | 925 | romfs = installed.GetEntry(*romfs_title_id, FileSys::ContentRecordType::Data)->GetRomFS(); |
| 926 | } | 926 | } |
| 927 | 927 | ||
| 928 | const auto extracted = FileSys::ExtractRomFS(romfs, FileSys::RomFSExtractionType::Full); | 928 | const auto extracted = FileSys::ExtractRomFS(romfs, FileSys::RomFSExtractionType::Full); |