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
This commit is contained in:
Feng Chen
2021-07-20 13:10:05 +08:00
committed by GitHub
parent 16f983d33a
commit 07073734ed
17 changed files with 172 additions and 109 deletions

View File

@ -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);
std::string name = " ";
[[maybe_unused]] const auto res3 = loader->ReadTitle(name);
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;
}
const FileSys::PatchManager patch{program_id, system.GetFileSystemController(),
system.GetContentProvider()};
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{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);
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));