summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-12-02 05:23:02 +0100
committerLioncash <mathew1800@gmail.com>2018-12-02 05:23:39 +0100
commit8c108eaca7387ab6c8d79f36c78ab517c1719129 (patch)
treebeb9fa0ad254cc6f1ee2947e57031fe6b602fe9e /src
parentyuzu/game_list_worker: Tidy up string handling in FillControlMap() (diff)
downloadyuzu-8c108eaca7387ab6c8d79f36c78ab517c1719129.tar
yuzu-8c108eaca7387ab6c8d79f36c78ab517c1719129.tar.gz
yuzu-8c108eaca7387ab6c8d79f36c78ab517c1719129.tar.bz2
yuzu-8c108eaca7387ab6c8d79f36c78ab517c1719129.tar.lz
yuzu-8c108eaca7387ab6c8d79f36c78ab517c1719129.tar.xz
yuzu-8c108eaca7387ab6c8d79f36c78ab517c1719129.tar.zst
yuzu-8c108eaca7387ab6c8d79f36c78ab517c1719129.zip
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/game_list_worker.cpp80
1 files changed, 33 insertions, 47 deletions
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp
index 3d5f2c0f4..3d8787dd0 100644
--- a/src/yuzu/game_list_worker.cpp
+++ b/src/yuzu/game_list_worker.cpp
@@ -86,6 +86,35 @@ QString FormatPatchNameVersions(const FileSys::PatchManager& patch_manager,
out.chop(1);
return out;
}
+
+QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::string& name,
+ const std::vector<u8>& icon, Loader::AppLoader& loader,
+ u64 program_id, const CompatibilityList& compatibility_list,
+ const FileSys::PatchManager& patch) {
+ const auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
+
+ // The game list uses this as compatibility number for untested games
+ QString compatibility{"99"};
+ if (it != compatibility_list.end()) {
+ compatibility = it->second.first;
+ }
+
+ QList<QStandardItem*> list{
+ new GameListItemPath(
+ FormatGameName(path), icon, QString::fromStdString(name),
+ QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType())), program_id),
+ new GameListItemCompat(compatibility),
+ new GameListItem(QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType()))),
+ new GameListItemSize(FileUtil::GetSize(path)),
+ };
+
+ if (UISettings::values.show_add_ons) {
+ list.insert(
+ 2, new GameListItem(FormatPatchNameVersions(patch, loader, loader.IsRomFSUpdatable())));
+ }
+
+ return list;
+}
} // Anonymous namespace
GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs, QString dir_path, bool deep_scan,
@@ -116,29 +145,8 @@ void GameListWorker::AddInstalledTitlesToGameList() {
if (control != nullptr)
GetMetadataFromControlNCA(patch, *control, icon, name);
- auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
-
- // The game list uses this as compatibility number for untested games
- QString compatibility("99");
- if (it != compatibility_list.end())
- compatibility = it->second.first;
-
- QList<QStandardItem*> list{
- new GameListItemPath(
- FormatGameName(file->GetFullPath()), icon, QString::fromStdString(name),
- QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())),
- program_id),
- new GameListItemCompat(compatibility),
- new GameListItem(
- QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))),
- new GameListItemSize(file->GetSize()),
- };
-
- if (UISettings::values.show_add_ons) {
- list.insert(2, new GameListItem(FormatPatchNameVersions(patch, *loader)));
- }
-
- emit EntryReady(list);
+ emit EntryReady(MakeGameListEntry(file->GetFullPath(), name, icon, *loader, program_id,
+ compatibility_list, patch));
}
const auto control_data = cache->ListEntriesFilter(FileSys::TitleType::Application,
@@ -215,30 +223,8 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
}
}
- auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
-
- // The game list uses this as compatibility number for untested games
- QString compatibility("99");
- if (it != compatibility_list.end())
- compatibility = it->second.first;
-
- QList<QStandardItem*> list{
- new GameListItemPath(
- FormatGameName(physical_name), icon, QString::fromStdString(name),
- QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())),
- program_id),
- new GameListItemCompat(compatibility),
- new GameListItem(
- QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))),
- new GameListItemSize(FileUtil::GetSize(physical_name)),
- };
-
- if (UISettings::values.show_add_ons) {
- list.insert(2, new GameListItem(FormatPatchNameVersions(
- patch, *loader, loader->IsRomFSUpdatable())));
- }
-
- emit EntryReady(std::move(list));
+ emit EntryReady(MakeGameListEntry(physical_name, name, icon, *loader, program_id,
+ compatibility_list, patch));
} else if (is_dir && recursion > 0) {
watch_list.append(QString::fromStdString(physical_name));
AddFstEntriesToGameList(physical_name, recursion - 1);