diff options
| -rw-r--r-- | src/yuzu/game_list_worker.cpp | 80 |
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, | |||
| 86 | out.chop(1); | 86 | out.chop(1); |
| 87 | return out; | 87 | return out; |
| 88 | } | 88 | } |
| 89 | |||
| 90 | QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::string& name, | ||
| 91 | const std::vector<u8>& icon, Loader::AppLoader& loader, | ||
| 92 | u64 program_id, const CompatibilityList& compatibility_list, | ||
| 93 | const FileSys::PatchManager& patch) { | ||
| 94 | const auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id); | ||
| 95 | |||
| 96 | // The game list uses this as compatibility number for untested games | ||
| 97 | QString compatibility{"99"}; | ||
| 98 | if (it != compatibility_list.end()) { | ||
| 99 | compatibility = it->second.first; | ||
| 100 | } | ||
| 101 | |||
| 102 | QList<QStandardItem*> list{ | ||
| 103 | new GameListItemPath( | ||
| 104 | FormatGameName(path), icon, QString::fromStdString(name), | ||
| 105 | QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType())), program_id), | ||
| 106 | new GameListItemCompat(compatibility), | ||
| 107 | new GameListItem(QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType()))), | ||
| 108 | new GameListItemSize(FileUtil::GetSize(path)), | ||
| 109 | }; | ||
| 110 | |||
| 111 | if (UISettings::values.show_add_ons) { | ||
| 112 | list.insert( | ||
| 113 | 2, new GameListItem(FormatPatchNameVersions(patch, loader, loader.IsRomFSUpdatable()))); | ||
| 114 | } | ||
| 115 | |||
| 116 | return list; | ||
| 117 | } | ||
| 89 | } // Anonymous namespace | 118 | } // Anonymous namespace |
| 90 | 119 | ||
| 91 | GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs, QString dir_path, bool deep_scan, | 120 | GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs, QString dir_path, bool deep_scan, |
| @@ -116,29 +145,8 @@ void GameListWorker::AddInstalledTitlesToGameList() { | |||
| 116 | if (control != nullptr) | 145 | if (control != nullptr) |
| 117 | GetMetadataFromControlNCA(patch, *control, icon, name); | 146 | GetMetadataFromControlNCA(patch, *control, icon, name); |
| 118 | 147 | ||
| 119 | auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id); | 148 | emit EntryReady(MakeGameListEntry(file->GetFullPath(), name, icon, *loader, program_id, |
| 120 | 149 | compatibility_list, patch)); | |
| 121 | // The game list uses this as compatibility number for untested games | ||
| 122 | QString compatibility("99"); | ||
| 123 | if (it != compatibility_list.end()) | ||
| 124 | compatibility = it->second.first; | ||
| 125 | |||
| 126 | QList<QStandardItem*> list{ | ||
| 127 | new GameListItemPath( | ||
| 128 | FormatGameName(file->GetFullPath()), icon, QString::fromStdString(name), | ||
| 129 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), | ||
| 130 | program_id), | ||
| 131 | new GameListItemCompat(compatibility), | ||
| 132 | new GameListItem( | ||
| 133 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), | ||
| 134 | new GameListItemSize(file->GetSize()), | ||
| 135 | }; | ||
| 136 | |||
| 137 | if (UISettings::values.show_add_ons) { | ||
| 138 | list.insert(2, new GameListItem(FormatPatchNameVersions(patch, *loader))); | ||
| 139 | } | ||
| 140 | |||
| 141 | emit EntryReady(list); | ||
| 142 | } | 150 | } |
| 143 | 151 | ||
| 144 | const auto control_data = cache->ListEntriesFilter(FileSys::TitleType::Application, | 152 | const auto control_data = cache->ListEntriesFilter(FileSys::TitleType::Application, |
| @@ -215,30 +223,8 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign | |||
| 215 | } | 223 | } |
| 216 | } | 224 | } |
| 217 | 225 | ||
| 218 | auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id); | 226 | emit EntryReady(MakeGameListEntry(physical_name, name, icon, *loader, program_id, |
| 219 | 227 | compatibility_list, patch)); | |
| 220 | // The game list uses this as compatibility number for untested games | ||
| 221 | QString compatibility("99"); | ||
| 222 | if (it != compatibility_list.end()) | ||
| 223 | compatibility = it->second.first; | ||
| 224 | |||
| 225 | QList<QStandardItem*> list{ | ||
| 226 | new GameListItemPath( | ||
| 227 | FormatGameName(physical_name), icon, QString::fromStdString(name), | ||
| 228 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), | ||
| 229 | program_id), | ||
| 230 | new GameListItemCompat(compatibility), | ||
| 231 | new GameListItem( | ||
| 232 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), | ||
| 233 | new GameListItemSize(FileUtil::GetSize(physical_name)), | ||
| 234 | }; | ||
| 235 | |||
| 236 | if (UISettings::values.show_add_ons) { | ||
| 237 | list.insert(2, new GameListItem(FormatPatchNameVersions( | ||
| 238 | patch, *loader, loader->IsRomFSUpdatable()))); | ||
| 239 | } | ||
| 240 | |||
| 241 | emit EntryReady(std::move(list)); | ||
| 242 | } else if (is_dir && recursion > 0) { | 228 | } else if (is_dir && recursion > 0) { |
| 243 | watch_list.append(QString::fromStdString(physical_name)); | 229 | watch_list.append(QString::fromStdString(physical_name)); |
| 244 | AddFstEntriesToGameList(physical_name, recursion - 1); | 230 | AddFstEntriesToGameList(physical_name, recursion - 1); |