yuzu-emu
/
yuzu
Archived
1
0
Fork 0

game_list: Add SD registration loading to game list

This commit is contained in:
Zach Hilman 2018-08-16 17:08:44 -04:00
parent ab44192ab0
commit 60b7a3b904
2 changed files with 12 additions and 12 deletions

View File

@ -426,13 +426,12 @@ static void GetMetadataFromControlNCA(const std::shared_ptr<FileSys::NCA>& nca,
} }
} }
void GameListWorker::AddInstalledTitlesToGameList() { void GameListWorker::AddInstalledTitlesToGameList(std::shared_ptr<FileSys::RegisteredCache> cache) {
const auto usernand = Service::FileSystem::GetUserNANDContents(); const auto installed_games = cache->ListEntriesFilter(FileSys::TitleType::Application,
const auto installed_games = usernand->ListEntriesFilter(FileSys::TitleType::Application,
FileSys::ContentRecordType::Program); FileSys::ContentRecordType::Program);
for (const auto& game : installed_games) { for (const auto& game : installed_games) {
const auto& file = usernand->GetEntryRaw(game); const auto& file = cache->GetEntryUnparsed(game);
std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(file); std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(file);
if (!loader) if (!loader)
continue; continue;
@ -442,8 +441,7 @@ void GameListWorker::AddInstalledTitlesToGameList() {
u64 program_id = 0; u64 program_id = 0;
loader->ReadProgramId(program_id); loader->ReadProgramId(program_id);
const auto& control = const auto& control = cache->GetEntry(game.title_id, FileSys::ContentRecordType::Control);
usernand->GetEntry(game.title_id, FileSys::ContentRecordType::Control);
if (control != nullptr) if (control != nullptr)
GetMetadataFromControlNCA(control, icon, name); GetMetadataFromControlNCA(control, icon, name);
emit EntryReady({ emit EntryReady({
@ -457,11 +455,11 @@ void GameListWorker::AddInstalledTitlesToGameList() {
}); });
} }
const auto control_data = usernand->ListEntriesFilter(FileSys::TitleType::Application, const auto control_data = cache->ListEntriesFilter(FileSys::TitleType::Application,
FileSys::ContentRecordType::Control); FileSys::ContentRecordType::Control);
for (const auto& entry : control_data) { for (const auto& entry : control_data) {
const auto nca = usernand->GetEntry(entry); const auto nca = cache->GetEntry(entry);
if (nca != nullptr) if (nca != nullptr)
nca_control_map.insert_or_assign(entry.title_id, nca); nca_control_map.insert_or_assign(entry.title_id, nca);
} }
@ -549,7 +547,9 @@ void GameListWorker::run() {
stop_processing = false; stop_processing = false;
watch_list.append(dir_path); watch_list.append(dir_path);
FillControlMap(dir_path.toStdString()); FillControlMap(dir_path.toStdString());
AddInstalledTitlesToGameList(); AddInstalledTitlesToGameList(Service::FileSystem::GetUserNANDContents());
AddInstalledTitlesToGameList(Service::FileSystem::GetSystemNANDContents());
AddInstalledTitlesToGameList(Service::FileSystem::GetSDMCContents());
AddFstEntriesToGameList(dir_path.toStdString(), deep_scan ? 256 : 0); AddFstEntriesToGameList(dir_path.toStdString(), deep_scan ? 256 : 0);
nca_control_map.clear(); nca_control_map.clear();
emit Finished(watch_list); emit Finished(watch_list);

View File

@ -172,7 +172,7 @@ private:
bool deep_scan; bool deep_scan;
std::atomic_bool stop_processing; std::atomic_bool stop_processing;
void AddInstalledTitlesToGameList(); void AddInstalledTitlesToGameList(std::shared_ptr<FileSys::RegisteredCache> cache);
void FillControlMap(const std::string& dir_path); void FillControlMap(const std::string& dir_path);
void AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion = 0); void AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion = 0);
}; };