diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/game_list.cpp | 22 | ||||
| -rw-r--r-- | src/yuzu/game_list_p.h | 3 |
2 files changed, 16 insertions, 9 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 73a0aa281..faaeda63d 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -405,6 +405,7 @@ void GameList::RefreshGameDirectory() { | |||
| 405 | 405 | ||
| 406 | static void GetMetadataFromControlNCA(const std::shared_ptr<FileSys::NCA>& nca, | 406 | static void GetMetadataFromControlNCA(const std::shared_ptr<FileSys::NCA>& nca, |
| 407 | std::vector<u8>& icon, std::string& name) { | 407 | std::vector<u8>& icon, std::string& name) { |
| 408 | |||
| 408 | const auto control_dir = FileSys::ExtractRomFS(nca->GetRomFS()); | 409 | const auto control_dir = FileSys::ExtractRomFS(nca->GetRomFS()); |
| 409 | if (control_dir == nullptr) | 410 | if (control_dir == nullptr) |
| 410 | return; | 411 | return; |
| @@ -425,7 +426,7 @@ static void GetMetadataFromControlNCA(const std::shared_ptr<FileSys::NCA>& nca, | |||
| 425 | } | 426 | } |
| 426 | } | 427 | } |
| 427 | 428 | ||
| 428 | void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) { | 429 | void GameListWorker::AddInstalledTitlesToGameList() { |
| 429 | const auto usernand = Service::FileSystem::GetUserNANDContents(); | 430 | const auto usernand = Service::FileSystem::GetUserNANDContents(); |
| 430 | const auto installed_games = usernand->ListEntriesFilter(FileSys::TitleType::Application, | 431 | const auto installed_games = usernand->ListEntriesFilter(FileSys::TitleType::Application, |
| 431 | FileSys::ContentRecordType::Program); | 432 | FileSys::ContentRecordType::Program); |
| @@ -456,8 +457,6 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign | |||
| 456 | }); | 457 | }); |
| 457 | } | 458 | } |
| 458 | 459 | ||
| 459 | boost::container::flat_map<u64, std::shared_ptr<FileSys::NCA>> nca_control_map; | ||
| 460 | |||
| 461 | const auto control_data = usernand->ListEntriesFilter(FileSys::TitleType::Application, | 460 | const auto control_data = usernand->ListEntriesFilter(FileSys::TitleType::Application, |
| 462 | FileSys::ContentRecordType::Control); | 461 | FileSys::ContentRecordType::Control); |
| 463 | 462 | ||
| @@ -466,10 +465,11 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign | |||
| 466 | if (nca != nullptr) | 465 | if (nca != nullptr) |
| 467 | nca_control_map.insert_or_assign(entry.title_id, nca); | 466 | nca_control_map.insert_or_assign(entry.title_id, nca); |
| 468 | } | 467 | } |
| 468 | } | ||
| 469 | 469 | ||
| 470 | const auto nca_control_callback = | 470 | void GameListWorker::FillControlMap(const std::string& dir_path) { |
| 471 | [this, &nca_control_map](u64* num_entries_out, const std::string& directory, | 471 | const auto nca_control_callback = [this](u64* num_entries_out, const std::string& directory, |
| 472 | const std::string& virtual_name) -> bool { | 472 | const std::string& virtual_name) -> bool { |
| 473 | std::string physical_name = directory + DIR_SEP + virtual_name; | 473 | std::string physical_name = directory + DIR_SEP + virtual_name; |
| 474 | 474 | ||
| 475 | if (stop_processing) | 475 | if (stop_processing) |
| @@ -487,10 +487,11 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign | |||
| 487 | }; | 487 | }; |
| 488 | 488 | ||
| 489 | FileUtil::ForeachDirectoryEntry(nullptr, dir_path, nca_control_callback); | 489 | FileUtil::ForeachDirectoryEntry(nullptr, dir_path, nca_control_callback); |
| 490 | } | ||
| 490 | 491 | ||
| 491 | const auto callback = [this, recursion, | 492 | void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) { |
| 492 | &nca_control_map](u64* num_entries_out, const std::string& directory, | 493 | const auto callback = [this, recursion](u64* num_entries_out, const std::string& directory, |
| 493 | const std::string& virtual_name) -> bool { | 494 | const std::string& virtual_name) -> bool { |
| 494 | std::string physical_name = directory + DIR_SEP + virtual_name; | 495 | std::string physical_name = directory + DIR_SEP + virtual_name; |
| 495 | 496 | ||
| 496 | if (stop_processing) | 497 | if (stop_processing) |
| @@ -547,7 +548,10 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign | |||
| 547 | void GameListWorker::run() { | 548 | void GameListWorker::run() { |
| 548 | stop_processing = false; | 549 | stop_processing = false; |
| 549 | watch_list.append(dir_path); | 550 | watch_list.append(dir_path); |
| 551 | FillControlMap(dir_path.toStdString()); | ||
| 552 | AddInstalledTitlesToGameList(); | ||
| 550 | AddFstEntriesToGameList(dir_path.toStdString(), deep_scan ? 256 : 0); | 553 | AddFstEntriesToGameList(dir_path.toStdString(), deep_scan ? 256 : 0); |
| 554 | nca_control_map.clear(); | ||
| 551 | emit Finished(watch_list); | 555 | emit Finished(watch_list); |
| 552 | } | 556 | } |
| 553 | 557 | ||
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 8fe5e8b80..10c2ef075 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h | |||
| @@ -163,10 +163,13 @@ signals: | |||
| 163 | 163 | ||
| 164 | private: | 164 | private: |
| 165 | FileSys::VirtualFilesystem vfs; | 165 | FileSys::VirtualFilesystem vfs; |
| 166 | std::map<u64, std::shared_ptr<FileSys::NCA>> nca_control_map; | ||
| 166 | QStringList watch_list; | 167 | QStringList watch_list; |
| 167 | QString dir_path; | 168 | QString dir_path; |
| 168 | bool deep_scan; | 169 | bool deep_scan; |
| 169 | std::atomic_bool stop_processing; | 170 | std::atomic_bool stop_processing; |
| 170 | 171 | ||
| 172 | void AddInstalledTitlesToGameList(); | ||
| 173 | void FillControlMap(const std::string& dir_path); | ||
| 171 | void AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion = 0); | 174 | void AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion = 0); |
| 172 | }; | 175 | }; |