summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-08-09 20:53:30 -0400
committerGravatar Zach Hilman2018-08-11 22:50:48 -0400
commitb67e751ccb16a59293c5c3d3ed9f7d3237c9efa4 (patch)
tree0bd97d7ff412a4f1f117e945d9a84048619e031c /src
parentfile_sys: Add RegisteredCache (diff)
downloadyuzu-b67e751ccb16a59293c5c3d3ed9f7d3237c9efa4.tar.gz
yuzu-b67e751ccb16a59293c5c3d3ed9f7d3237c9efa4.tar.xz
yuzu-b67e751ccb16a59293c5c3d3ed9f7d3237c9efa4.zip
game_list: Modify game list to scan installed titles
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/game_list.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index 85cb12594..64c72035e 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -2,6 +2,7 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <regex>
5#include <QApplication> 6#include <QApplication>
6#include <QDir> 7#include <QDir>
7#include <QFileInfo> 8#include <QFileInfo>
@@ -403,6 +404,50 @@ void GameList::RefreshGameDirectory() {
403} 404}
404 405
405void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) { 406void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) {
407 const auto usernand = Service::FileSystem::GetUserNANDContents();
408 const auto installed_games = usernand->ListEntriesFilter(FileSys::TitleType::Application,
409 FileSys::ContentRecordType::Program);
410
411 for (const auto& game : installed_games) {
412 const auto& file = usernand->GetEntryRaw(game);
413 std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(file);
414 if (!loader)
415 continue;
416
417 std::vector<u8> icon;
418 std::string name;
419 u64 program_id;
420 loader->ReadProgramId(program_id);
421
422 const auto& control =
423 usernand->GetEntry(game.title_id, FileSys::ContentRecordType::Control);
424 if (control != nullptr) {
425 const auto control_dir = FileSys::ExtractRomFS(control->GetRomFS());
426
427 const auto nacp_file = control_dir->GetFile("control.nacp");
428 FileSys::NACP nacp(nacp_file);
429 name = nacp.GetApplicationName();
430
431 FileSys::VirtualFile icon_file = nullptr;
432 for (const auto& language : FileSys::LANGUAGE_NAMES) {
433 icon_file = control_dir->GetFile("icon_" + std::string(language) + ".dat");
434 if (icon_file != nullptr) {
435 icon = icon_file->ReadAllBytes();
436 break;
437 }
438 }
439 }
440 emit EntryReady({
441 new GameListItemPath(
442 FormatGameName(file->GetFullPath()), icon, QString::fromStdString(name),
443 QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())),
444 program_id),
445 new GameListItem(
446 QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))),
447 new GameListItemSize(file->GetSize()),
448 });
449 }
450
406 boost::container::flat_map<u64, std::shared_ptr<FileSys::NCA>> nca_control_map; 451 boost::container::flat_map<u64, std::shared_ptr<FileSys::NCA>> nca_control_map;
407 452
408 const auto nca_control_callback = 453 const auto nca_control_callback =