From 07073734ed3785d1dee487f0c898a645fbd5f03c Mon Sep 17 00:00:00 2001 From: Feng Chen Date: Tue, 20 Jul 2021 13:10:05 +0800 Subject: file_sys: Support load game collection (#6582) Adds support for loading games with multiple programs embedded within such as the Dragon Quest 1+2+3 Collection --- src/yuzu/game_list_worker.cpp | 44 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) (limited to 'src/yuzu/game_list_worker.cpp') diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index 33cc90d5a..2d5492157 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp @@ -336,18 +336,44 @@ void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_pa } } } else { - std::vector icon; - [[maybe_unused]] const auto res1 = loader->ReadIcon(icon); + std::vector program_ids; + loader->ReadProgramIds(program_ids); + + if (res2 == Loader::ResultStatus::Success && program_ids.size() > 1 && + (file_type == Loader::FileType::XCI || file_type == Loader::FileType::NSP)) { + for (const auto id : program_ids) { + loader = Loader::GetLoader(system, file, id); + if (!loader) { + continue; + } + + std::vector icon; + [[maybe_unused]] const auto res1 = loader->ReadIcon(icon); - std::string name = " "; - [[maybe_unused]] const auto res3 = loader->ReadTitle(name); + std::string name = " "; + [[maybe_unused]] const auto res3 = loader->ReadTitle(name); - const FileSys::PatchManager patch{program_id, system.GetFileSystemController(), - system.GetContentProvider()}; + const FileSys::PatchManager patch{id, system.GetFileSystemController(), + system.GetContentProvider()}; + + emit EntryReady(MakeGameListEntry(physical_name, name, icon, *loader, id, + compatibility_list, patch), + parent_dir); + } + } else { + std::vector icon; + [[maybe_unused]] const auto res1 = loader->ReadIcon(icon); - emit EntryReady(MakeGameListEntry(physical_name, name, icon, *loader, program_id, - compatibility_list, patch), - parent_dir); + std::string name = " "; + [[maybe_unused]] const auto res3 = loader->ReadTitle(name); + + const FileSys::PatchManager patch{program_id, system.GetFileSystemController(), + system.GetContentProvider()}; + + emit EntryReady(MakeGameListEntry(physical_name, name, icon, *loader, + program_id, compatibility_list, patch), + parent_dir); + } } } else if (is_dir) { watch_list.append(QString::fromStdString(physical_name)); -- cgit v1.2.3