diff options
| author | Feng Chen <VonChenPlus@gmail.com> | 2021-07-20 13:10:05 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-20 01:10:05 -0400 |
| commit | 07073734ed3785d1dee487f0c898a645fbd5f03c (patch) | |
| tree | e7c72b615b7a551cc1fb8a6a336bce60e5a0d314 /src/yuzu/game_list_worker.cpp | |
| parent | 16f983d33ae05722a7656ca5a15171ccaa4c602f (diff) | |
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
Diffstat (limited to 'src/yuzu/game_list_worker.cpp')
| -rw-r--r-- | src/yuzu/game_list_worker.cpp | 44 |
1 files changed, 35 insertions, 9 deletions
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<u8> icon; - [[maybe_unused]] const auto res1 = loader->ReadIcon(icon); + std::vector<u64> 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<u8> 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<u8> 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)); |
