diff options
Diffstat (limited to '')
| -rw-r--r-- | src/yuzu/game_list.cpp | 7 | ||||
| -rw-r--r-- | src/yuzu/game_list.h | 5 | ||||
| -rw-r--r-- | src/yuzu/game_list_worker.cpp | 10 | ||||
| -rw-r--r-- | src/yuzu/game_list_worker.h | 8 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 2 |
5 files changed, 19 insertions, 13 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index f9d949e75..99c91a6a8 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -305,8 +305,8 @@ void GameList::OnFilterCloseClicked() { | |||
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvider* provider, | 307 | GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvider* provider, |
| 308 | GMainWindow* parent) | 308 | Core::System& system_, GMainWindow* parent) |
| 309 | : QWidget{parent}, vfs(std::move(vfs)), provider(provider) { | 309 | : QWidget{parent}, vfs(std::move(vfs)), provider(provider), system{system_} { |
| 310 | watcher = new QFileSystemWatcher(this); | 310 | watcher = new QFileSystemWatcher(this); |
| 311 | connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory); | 311 | connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory); |
| 312 | 312 | ||
| @@ -738,7 +738,8 @@ void GameList::PopulateAsync(QVector<UISettings::GameDir>& game_dirs) { | |||
| 738 | 738 | ||
| 739 | emit ShouldCancelWorker(); | 739 | emit ShouldCancelWorker(); |
| 740 | 740 | ||
| 741 | GameListWorker* worker = new GameListWorker(vfs, provider, game_dirs, compatibility_list); | 741 | GameListWorker* worker = |
| 742 | new GameListWorker(vfs, provider, game_dirs, compatibility_list, system); | ||
| 742 | 743 | ||
| 743 | connect(worker, &GameListWorker::EntryReady, this, &GameList::AddEntry, Qt::QueuedConnection); | 744 | connect(worker, &GameListWorker::EntryReady, this, &GameList::AddEntry, Qt::QueuedConnection); |
| 744 | connect(worker, &GameListWorker::DirEntryReady, this, &GameList::AddDirEntry, | 745 | connect(worker, &GameListWorker::DirEntryReady, this, &GameList::AddDirEntry, |
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index 10339dcca..675469e66 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h | |||
| @@ -72,7 +72,8 @@ public: | |||
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | explicit GameList(std::shared_ptr<FileSys::VfsFilesystem> vfs, | 74 | explicit GameList(std::shared_ptr<FileSys::VfsFilesystem> vfs, |
| 75 | FileSys::ManualContentProvider* provider, GMainWindow* parent = nullptr); | 75 | FileSys::ManualContentProvider* provider, Core::System& system_, |
| 76 | GMainWindow* parent = nullptr); | ||
| 76 | ~GameList() override; | 77 | ~GameList() override; |
| 77 | 78 | ||
| 78 | QString GetLastFilterResultItem() const; | 79 | QString GetLastFilterResultItem() const; |
| @@ -145,6 +146,8 @@ private: | |||
| 145 | CompatibilityList compatibility_list; | 146 | CompatibilityList compatibility_list; |
| 146 | 147 | ||
| 147 | friend class GameListSearchField; | 148 | friend class GameListSearchField; |
| 149 | |||
| 150 | Core::System& system; | ||
| 148 | }; | 151 | }; |
| 149 | 152 | ||
| 150 | class GameListPlaceholder : public QWidget { | 153 | class GameListPlaceholder : public QWidget { |
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index 2d5492157..fd92b36df 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp | |||
| @@ -228,16 +228,15 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri | |||
| 228 | GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs, | 228 | GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs, |
| 229 | FileSys::ManualContentProvider* provider, | 229 | FileSys::ManualContentProvider* provider, |
| 230 | QVector<UISettings::GameDir>& game_dirs, | 230 | QVector<UISettings::GameDir>& game_dirs, |
| 231 | const CompatibilityList& compatibility_list) | 231 | const CompatibilityList& compatibility_list, Core::System& system_) |
| 232 | : vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs), | 232 | : vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs), |
| 233 | compatibility_list(compatibility_list) {} | 233 | compatibility_list(compatibility_list), system{system_} {} |
| 234 | 234 | ||
| 235 | GameListWorker::~GameListWorker() = default; | 235 | GameListWorker::~GameListWorker() = default; |
| 236 | 236 | ||
| 237 | void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) { | 237 | void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) { |
| 238 | using namespace FileSys; | 238 | using namespace FileSys; |
| 239 | 239 | ||
| 240 | auto& system = Core::System::GetInstance(); | ||
| 241 | const auto& cache = dynamic_cast<ContentProviderUnion&>(system.GetContentProvider()); | 240 | const auto& cache = dynamic_cast<ContentProviderUnion&>(system.GetContentProvider()); |
| 242 | 241 | ||
| 243 | auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application, | 242 | auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application, |
| @@ -285,10 +284,7 @@ void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) { | |||
| 285 | 284 | ||
| 286 | void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_path, bool deep_scan, | 285 | void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_path, bool deep_scan, |
| 287 | GameListDir* parent_dir) { | 286 | GameListDir* parent_dir) { |
| 288 | auto& system = Core::System::GetInstance(); | 287 | const auto callback = [this, target, parent_dir](const std::filesystem::path& path) -> bool { |
| 289 | |||
| 290 | const auto callback = [this, target, parent_dir, | ||
| 291 | &system](const std::filesystem::path& path) -> bool { | ||
| 292 | if (stop_processing) { | 288 | if (stop_processing) { |
| 293 | // Breaks the callback loop. | 289 | // Breaks the callback loop. |
| 294 | return false; | 290 | return false; |
diff --git a/src/yuzu/game_list_worker.h b/src/yuzu/game_list_worker.h index 396bb2623..1383e9fbc 100644 --- a/src/yuzu/game_list_worker.h +++ b/src/yuzu/game_list_worker.h | |||
| @@ -19,6 +19,10 @@ | |||
| 19 | #include "common/common_types.h" | 19 | #include "common/common_types.h" |
| 20 | #include "yuzu/compatibility_list.h" | 20 | #include "yuzu/compatibility_list.h" |
| 21 | 21 | ||
| 22 | namespace Core { | ||
| 23 | class System; | ||
| 24 | } | ||
| 25 | |||
| 22 | class QStandardItem; | 26 | class QStandardItem; |
| 23 | 27 | ||
| 24 | namespace FileSys { | 28 | namespace FileSys { |
| @@ -37,7 +41,7 @@ public: | |||
| 37 | explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs, | 41 | explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs, |
| 38 | FileSys::ManualContentProvider* provider, | 42 | FileSys::ManualContentProvider* provider, |
| 39 | QVector<UISettings::GameDir>& game_dirs, | 43 | QVector<UISettings::GameDir>& game_dirs, |
| 40 | const CompatibilityList& compatibility_list); | 44 | const CompatibilityList& compatibility_list, Core::System& system_); |
| 41 | ~GameListWorker() override; | 45 | ~GameListWorker() override; |
| 42 | 46 | ||
| 43 | /// Starts the processing of directory tree information. | 47 | /// Starts the processing of directory tree information. |
| @@ -80,4 +84,6 @@ private: | |||
| 80 | 84 | ||
| 81 | QStringList watch_list; | 85 | QStringList watch_list; |
| 82 | std::atomic_bool stop_processing; | 86 | std::atomic_bool stop_processing; |
| 87 | |||
| 88 | Core::System& system; | ||
| 83 | }; | 89 | }; |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 056f7da36..1d9e0f79d 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -701,7 +701,7 @@ void GMainWindow::InitializeWidgets() { | |||
| 701 | render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem, system); | 701 | render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem, system); |
| 702 | render_window->hide(); | 702 | render_window->hide(); |
| 703 | 703 | ||
| 704 | game_list = new GameList(vfs, provider.get(), this); | 704 | game_list = new GameList(vfs, provider.get(), system, this); |
| 705 | ui.horizontalLayout->addWidget(game_list); | 705 | ui.horizontalLayout->addWidget(game_list); |
| 706 | 706 | ||
| 707 | game_list_placeholder = new GameListPlaceholder(this); | 707 | game_list_placeholder = new GameListPlaceholder(this); |