diff options
| author | 2018-11-16 07:02:37 -0800 | |
|---|---|---|
| committer | 2018-11-16 07:02:37 -0800 | |
| commit | 5b8f70ea2ed13e0f2155cc3435647887a15d2915 (patch) | |
| tree | 710840cf895216a59e2a4654d5c049b61837ab10 | |
| parent | Merge pull request #1676 from lioncash/warn (diff) | |
| parent | game_list: Make add-ons column optional (diff) | |
| download | yuzu-5b8f70ea2ed13e0f2155cc3435647887a15d2915.tar.gz yuzu-5b8f70ea2ed13e0f2155cc3435647887a15d2915.tar.xz yuzu-5b8f70ea2ed13e0f2155cc3435647887a15d2915.zip | |
Merge pull request #1632 from DarkLordZach/keys-manager-optimizations
game_list: Optimize game list refresh
| -rw-r--r-- | src/core/file_sys/card_image.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/card_image.h | 3 | ||||
| -rw-r--r-- | src/core/file_sys/content_archive.cpp | 5 | ||||
| -rw-r--r-- | src/core/file_sys/content_archive.h | 3 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 13 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.h | 3 | ||||
| -rw-r--r-- | src/core/file_sys/submission_package.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/submission_package.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 13 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_gamelist.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_gamelist.ui | 223 | ||||
| -rw-r--r-- | src/yuzu/game_list.cpp | 33 | ||||
| -rw-r--r-- | src/yuzu/game_list_worker.cpp | 24 | ||||
| -rw-r--r-- | src/yuzu/ui_settings.h | 1 |
16 files changed, 200 insertions, 133 deletions
diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp index 1ece55731..2c145bd09 100644 --- a/src/core/file_sys/card_image.cpp +++ b/src/core/file_sys/card_image.cpp | |||
| @@ -176,7 +176,7 @@ Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) { | |||
| 176 | for (const VirtualFile& file : partitions[static_cast<std::size_t>(part)]->GetFiles()) { | 176 | for (const VirtualFile& file : partitions[static_cast<std::size_t>(part)]->GetFiles()) { |
| 177 | if (file->GetExtension() != "nca") | 177 | if (file->GetExtension() != "nca") |
| 178 | continue; | 178 | continue; |
| 179 | auto nca = std::make_shared<NCA>(file); | 179 | auto nca = std::make_shared<NCA>(file, nullptr, 0, keys); |
| 180 | // TODO(DarkLordZach): Add proper Rev1+ Support | 180 | // TODO(DarkLordZach): Add proper Rev1+ Support |
| 181 | if (nca->IsUpdate()) | 181 | if (nca->IsUpdate()) |
| 182 | continue; | 182 | continue; |
diff --git a/src/core/file_sys/card_image.h b/src/core/file_sys/card_image.h index 8f62571cf..25f5914b6 100644 --- a/src/core/file_sys/card_image.h +++ b/src/core/file_sys/card_image.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <vector> | 9 | #include <vector> |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "common/swap.h" | 11 | #include "common/swap.h" |
| 12 | #include "core/crypto/key_manager.h" | ||
| 12 | #include "core/file_sys/vfs.h" | 13 | #include "core/file_sys/vfs.h" |
| 13 | 14 | ||
| 14 | namespace Loader { | 15 | namespace Loader { |
| @@ -107,5 +108,7 @@ private: | |||
| 107 | std::shared_ptr<NSP> secure_partition; | 108 | std::shared_ptr<NSP> secure_partition; |
| 108 | std::shared_ptr<NCA> program; | 109 | std::shared_ptr<NCA> program; |
| 109 | std::vector<std::shared_ptr<NCA>> ncas; | 110 | std::vector<std::shared_ptr<NCA>> ncas; |
| 111 | |||
| 112 | Core::Crypto::KeyManager keys; | ||
| 110 | }; | 113 | }; |
| 111 | } // namespace FileSys | 114 | } // namespace FileSys |
diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cpp index b46fe893c..19b6f8600 100644 --- a/src/core/file_sys/content_archive.cpp +++ b/src/core/file_sys/content_archive.cpp | |||
| @@ -101,8 +101,9 @@ static bool IsValidNCA(const NCAHeader& header) { | |||
| 101 | return header.magic == Common::MakeMagic('N', 'C', 'A', '3'); | 101 | return header.magic == Common::MakeMagic('N', 'C', 'A', '3'); |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | NCA::NCA(VirtualFile file_, VirtualFile bktr_base_romfs_, u64 bktr_base_ivfc_offset) | 104 | NCA::NCA(VirtualFile file_, VirtualFile bktr_base_romfs_, u64 bktr_base_ivfc_offset, |
| 105 | : file(std::move(file_)), bktr_base_romfs(std::move(bktr_base_romfs_)) { | 105 | Core::Crypto::KeyManager keys_) |
| 106 | : file(std::move(file_)), bktr_base_romfs(std::move(bktr_base_romfs_)), keys(std::move(keys_)) { | ||
| 106 | if (file == nullptr) { | 107 | if (file == nullptr) { |
| 107 | status = Loader::ResultStatus::ErrorNullFile; | 108 | status = Loader::ResultStatus::ErrorNullFile; |
| 108 | return; | 109 | return; |
diff --git a/src/core/file_sys/content_archive.h b/src/core/file_sys/content_archive.h index 4bba55607..99294cbb4 100644 --- a/src/core/file_sys/content_archive.h +++ b/src/core/file_sys/content_archive.h | |||
| @@ -79,7 +79,8 @@ inline bool IsDirectoryExeFS(const std::shared_ptr<VfsDirectory>& pfs) { | |||
| 79 | class NCA : public ReadOnlyVfsDirectory { | 79 | class NCA : public ReadOnlyVfsDirectory { |
| 80 | public: | 80 | public: |
| 81 | explicit NCA(VirtualFile file, VirtualFile bktr_base_romfs = nullptr, | 81 | explicit NCA(VirtualFile file, VirtualFile bktr_base_romfs = nullptr, |
| 82 | u64 bktr_base_ivfc_offset = 0); | 82 | u64 bktr_base_ivfc_offset = 0, |
| 83 | Core::Crypto::KeyManager keys = Core::Crypto::KeyManager()); | ||
| 83 | ~NCA() override; | 84 | ~NCA() override; |
| 84 | 85 | ||
| 85 | Loader::ResultStatus GetStatus() const; | 86 | Loader::ResultStatus GetStatus() const; |
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 96302a241..a3f8f2f73 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -106,9 +106,12 @@ static ContentRecordType GetCRTypeFromNCAType(NCAContentType type) { | |||
| 106 | 106 | ||
| 107 | VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& dir, | 107 | VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& dir, |
| 108 | std::string_view path) const { | 108 | std::string_view path) const { |
| 109 | if (dir->GetFileRelative(path) != nullptr) | 109 | const auto file = dir->GetFileRelative(path); |
| 110 | return dir->GetFileRelative(path); | 110 | if (file != nullptr) |
| 111 | if (dir->GetDirectoryRelative(path) != nullptr) { | 111 | return file; |
| 112 | |||
| 113 | const auto nca_dir = dir->GetDirectoryRelative(path); | ||
| 114 | if (nca_dir != nullptr) { | ||
| 112 | const auto nca_dir = dir->GetDirectoryRelative(path); | 115 | const auto nca_dir = dir->GetDirectoryRelative(path); |
| 113 | VirtualFile file = nullptr; | 116 | VirtualFile file = nullptr; |
| 114 | 117 | ||
| @@ -225,7 +228,7 @@ void RegisteredCache::ProcessFiles(const std::vector<NcaID>& ids) { | |||
| 225 | 228 | ||
| 226 | if (file == nullptr) | 229 | if (file == nullptr) |
| 227 | continue; | 230 | continue; |
| 228 | const auto nca = std::make_shared<NCA>(parser(file, id)); | 231 | const auto nca = std::make_shared<NCA>(parser(file, id), nullptr, 0, keys); |
| 229 | if (nca->GetStatus() != Loader::ResultStatus::Success || | 232 | if (nca->GetStatus() != Loader::ResultStatus::Success || |
| 230 | nca->GetType() != NCAContentType::Meta) { | 233 | nca->GetType() != NCAContentType::Meta) { |
| 231 | continue; | 234 | continue; |
| @@ -315,7 +318,7 @@ std::unique_ptr<NCA> RegisteredCache::GetEntry(u64 title_id, ContentRecordType t | |||
| 315 | const auto raw = GetEntryRaw(title_id, type); | 318 | const auto raw = GetEntryRaw(title_id, type); |
| 316 | if (raw == nullptr) | 319 | if (raw == nullptr) |
| 317 | return nullptr; | 320 | return nullptr; |
| 318 | return std::make_unique<NCA>(raw); | 321 | return std::make_unique<NCA>(raw, nullptr, 0, keys); |
| 319 | } | 322 | } |
| 320 | 323 | ||
| 321 | std::unique_ptr<NCA> RegisteredCache::GetEntry(RegisteredCacheEntry entry) const { | 324 | std::unique_ptr<NCA> RegisteredCache::GetEntry(RegisteredCacheEntry entry) const { |
diff --git a/src/core/file_sys/registered_cache.h b/src/core/file_sys/registered_cache.h index 6cfb16017..6b89db8de 100644 --- a/src/core/file_sys/registered_cache.h +++ b/src/core/file_sys/registered_cache.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <vector> | 12 | #include <vector> |
| 13 | #include <boost/container/flat_map.hpp> | 13 | #include <boost/container/flat_map.hpp> |
| 14 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 15 | #include "core/crypto/key_manager.h" | ||
| 15 | #include "core/file_sys/vfs.h" | 16 | #include "core/file_sys/vfs.h" |
| 16 | 17 | ||
| 17 | namespace FileSys { | 18 | namespace FileSys { |
| @@ -133,6 +134,8 @@ private: | |||
| 133 | 134 | ||
| 134 | VirtualDir dir; | 135 | VirtualDir dir; |
| 135 | RegisteredCacheParsingFunction parser; | 136 | RegisteredCacheParsingFunction parser; |
| 137 | Core::Crypto::KeyManager keys; | ||
| 138 | |||
| 136 | // maps tid -> NcaID of meta | 139 | // maps tid -> NcaID of meta |
| 137 | boost::container::flat_map<u64, NcaID> meta_id; | 140 | boost::container::flat_map<u64, NcaID> meta_id; |
| 138 | // maps tid -> meta | 141 | // maps tid -> meta |
diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp index 2aaba4179..e1a4210db 100644 --- a/src/core/file_sys/submission_package.cpp +++ b/src/core/file_sys/submission_package.cpp | |||
| @@ -252,7 +252,7 @@ void NSP::ReadNCAs(const std::vector<VirtualFile>& files) { | |||
| 252 | continue; | 252 | continue; |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | auto next_nca = std::make_shared<NCA>(next_file); | 255 | auto next_nca = std::make_shared<NCA>(next_file, nullptr, 0, keys); |
| 256 | if (next_nca->GetType() == NCAContentType::Program) | 256 | if (next_nca->GetType() == NCAContentType::Program) |
| 257 | program_status[cnmt.GetTitleID()] = next_nca->GetStatus(); | 257 | program_status[cnmt.GetTitleID()] = next_nca->GetStatus(); |
| 258 | if (next_nca->GetStatus() == Loader::ResultStatus::Success || | 258 | if (next_nca->GetStatus() == Loader::ResultStatus::Success || |
diff --git a/src/core/file_sys/submission_package.h b/src/core/file_sys/submission_package.h index 338080b7e..9a28ed5bb 100644 --- a/src/core/file_sys/submission_package.h +++ b/src/core/file_sys/submission_package.h | |||
| @@ -70,6 +70,8 @@ private: | |||
| 70 | std::map<u64, std::map<ContentRecordType, std::shared_ptr<NCA>>> ncas; | 70 | std::map<u64, std::map<ContentRecordType, std::shared_ptr<NCA>>> ncas; |
| 71 | std::vector<VirtualFile> ticket_files; | 71 | std::vector<VirtualFile> ticket_files; |
| 72 | 72 | ||
| 73 | Core::Crypto::KeyManager keys; | ||
| 74 | |||
| 73 | VirtualFile romfs; | 75 | VirtualFile romfs; |
| 74 | VirtualDir exefs; | 76 | VirtualDir exefs; |
| 75 | }; | 77 | }; |
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 554474cf6..5d6294016 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp | |||
| @@ -329,9 +329,16 @@ ResultVal<FileSys::VirtualDir> OpenSDMC() { | |||
| 329 | return sdmc_factory->Open(); | 329 | return sdmc_factory->Open(); |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | std::unique_ptr<FileSys::RegisteredCacheUnion> GetUnionContents() { | 332 | std::shared_ptr<FileSys::RegisteredCacheUnion> registered_cache_union; |
| 333 | return std::make_unique<FileSys::RegisteredCacheUnion>(std::vector<FileSys::RegisteredCache*>{ | 333 | |
| 334 | GetSystemNANDContents(), GetUserNANDContents(), GetSDMCContents()}); | 334 | std::shared_ptr<FileSys::RegisteredCacheUnion> GetUnionContents() { |
| 335 | if (registered_cache_union == nullptr) { | ||
| 336 | registered_cache_union = | ||
| 337 | std::make_shared<FileSys::RegisteredCacheUnion>(std::vector<FileSys::RegisteredCache*>{ | ||
| 338 | GetSystemNANDContents(), GetUserNANDContents(), GetSDMCContents()}); | ||
| 339 | } | ||
| 340 | |||
| 341 | return registered_cache_union; | ||
| 335 | } | 342 | } |
| 336 | 343 | ||
| 337 | FileSys::RegisteredCache* GetSystemNANDContents() { | 344 | FileSys::RegisteredCache* GetSystemNANDContents() { |
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h index e38f02869..ff9182e84 100644 --- a/src/core/hle/service/filesystem/filesystem.h +++ b/src/core/hle/service/filesystem/filesystem.h | |||
| @@ -48,7 +48,7 @@ ResultVal<FileSys::VirtualDir> OpenSaveData(FileSys::SaveDataSpaceId space, | |||
| 48 | ResultVal<FileSys::VirtualDir> OpenSaveDataSpace(FileSys::SaveDataSpaceId space); | 48 | ResultVal<FileSys::VirtualDir> OpenSaveDataSpace(FileSys::SaveDataSpaceId space); |
| 49 | ResultVal<FileSys::VirtualDir> OpenSDMC(); | 49 | ResultVal<FileSys::VirtualDir> OpenSDMC(); |
| 50 | 50 | ||
| 51 | std::unique_ptr<FileSys::RegisteredCacheUnion> GetUnionContents(); | 51 | std::shared_ptr<FileSys::RegisteredCacheUnion> GetUnionContents(); |
| 52 | 52 | ||
| 53 | FileSys::RegisteredCache* GetSystemNANDContents(); | 53 | FileSys::RegisteredCache* GetSystemNANDContents(); |
| 54 | FileSys::RegisteredCache* GetUserNANDContents(); | 54 | FileSys::RegisteredCache* GetUserNANDContents(); |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 60606bb33..be69fb831 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -171,6 +171,7 @@ void Config::ReadValues() { | |||
| 171 | 171 | ||
| 172 | qt_config->beginGroup("UIGameList"); | 172 | qt_config->beginGroup("UIGameList"); |
| 173 | UISettings::values.show_unknown = qt_config->value("show_unknown", true).toBool(); | 173 | UISettings::values.show_unknown = qt_config->value("show_unknown", true).toBool(); |
| 174 | UISettings::values.show_add_ons = qt_config->value("show_add_ons", true).toBool(); | ||
| 174 | UISettings::values.icon_size = qt_config->value("icon_size", 64).toUInt(); | 175 | UISettings::values.icon_size = qt_config->value("icon_size", 64).toUInt(); |
| 175 | UISettings::values.row_1_text_id = qt_config->value("row_1_text_id", 3).toUInt(); | 176 | UISettings::values.row_1_text_id = qt_config->value("row_1_text_id", 3).toUInt(); |
| 176 | UISettings::values.row_2_text_id = qt_config->value("row_2_text_id", 2).toUInt(); | 177 | UISettings::values.row_2_text_id = qt_config->value("row_2_text_id", 2).toUInt(); |
| @@ -312,6 +313,7 @@ void Config::SaveValues() { | |||
| 312 | 313 | ||
| 313 | qt_config->beginGroup("UIGameList"); | 314 | qt_config->beginGroup("UIGameList"); |
| 314 | qt_config->setValue("show_unknown", UISettings::values.show_unknown); | 315 | qt_config->setValue("show_unknown", UISettings::values.show_unknown); |
| 316 | qt_config->setValue("show_add_ons", UISettings::values.show_add_ons); | ||
| 315 | qt_config->setValue("icon_size", UISettings::values.icon_size); | 317 | qt_config->setValue("icon_size", UISettings::values.icon_size); |
| 316 | qt_config->setValue("row_1_text_id", UISettings::values.row_1_text_id); | 318 | qt_config->setValue("row_1_text_id", UISettings::values.row_1_text_id); |
| 317 | qt_config->setValue("row_2_text_id", UISettings::values.row_2_text_id); | 319 | qt_config->setValue("row_2_text_id", UISettings::values.row_2_text_id); |
diff --git a/src/yuzu/configuration/configure_gamelist.cpp b/src/yuzu/configuration/configure_gamelist.cpp index 8743ce982..639d5df0f 100644 --- a/src/yuzu/configuration/configure_gamelist.cpp +++ b/src/yuzu/configuration/configure_gamelist.cpp | |||
| @@ -42,6 +42,7 @@ ConfigureGameList::~ConfigureGameList() = default; | |||
| 42 | 42 | ||
| 43 | void ConfigureGameList::applyConfiguration() { | 43 | void ConfigureGameList::applyConfiguration() { |
| 44 | UISettings::values.show_unknown = ui->show_unknown->isChecked(); | 44 | UISettings::values.show_unknown = ui->show_unknown->isChecked(); |
| 45 | UISettings::values.show_add_ons = ui->show_add_ons->isChecked(); | ||
| 45 | UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); | 46 | UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); |
| 46 | UISettings::values.row_1_text_id = ui->row_1_text_combobox->currentData().toUInt(); | 47 | UISettings::values.row_1_text_id = ui->row_1_text_combobox->currentData().toUInt(); |
| 47 | UISettings::values.row_2_text_id = ui->row_2_text_combobox->currentData().toUInt(); | 48 | UISettings::values.row_2_text_id = ui->row_2_text_combobox->currentData().toUInt(); |
| @@ -50,6 +51,7 @@ void ConfigureGameList::applyConfiguration() { | |||
| 50 | 51 | ||
| 51 | void ConfigureGameList::setConfiguration() { | 52 | void ConfigureGameList::setConfiguration() { |
| 52 | ui->show_unknown->setChecked(UISettings::values.show_unknown); | 53 | ui->show_unknown->setChecked(UISettings::values.show_unknown); |
| 54 | ui->show_add_ons->setChecked(UISettings::values.show_add_ons); | ||
| 53 | ui->icon_size_combobox->setCurrentIndex( | 55 | ui->icon_size_combobox->setCurrentIndex( |
| 54 | ui->icon_size_combobox->findData(UISettings::values.icon_size)); | 56 | ui->icon_size_combobox->findData(UISettings::values.icon_size)); |
| 55 | ui->row_1_text_combobox->setCurrentIndex( | 57 | ui->row_1_text_combobox->setCurrentIndex( |
diff --git a/src/yuzu/configuration/configure_gamelist.ui b/src/yuzu/configuration/configure_gamelist.ui index 7471fdb60..7a69377e7 100644 --- a/src/yuzu/configuration/configure_gamelist.ui +++ b/src/yuzu/configuration/configure_gamelist.ui | |||
| @@ -1,126 +1,133 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <ui version="4.0"> | 2 | <ui version="4.0"> |
| 3 | <class>ConfigureGameList</class> | 3 | <class>ConfigureGameList</class> |
| 4 | <widget class="QWidget" name="ConfigureGeneral"> | 4 | <widget class="QWidget" name="ConfigureGameList"> |
| 5 | <property name="geometry"> | 5 | <property name="geometry"> |
| 6 | <rect> | 6 | <rect> |
| 7 | <x>0</x> | 7 | <x>0</x> |
| 8 | <y>0</y> | 8 | <y>0</y> |
| 9 | <width>300</width> | 9 | <width>300</width> |
| 10 | <height>377</height> | 10 | <height>377</height> |
| 11 | </rect> | 11 | </rect> |
| 12 | </property> | 12 | </property> |
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <layout class="QHBoxLayout" name="HorizontalLayout"> | 16 | <layout class="QHBoxLayout" name="HorizontalLayout"> |
| 17 | <item> | 17 | <item> |
| 18 | <layout class="QVBoxLayout" name="VerticalLayout"> | 18 | <layout class="QVBoxLayout" name="VerticalLayout"> |
| 19 | <item> | ||
| 20 | <widget class="QGroupBox" name="GeneralGroupBox"> | ||
| 21 | <property name="title"> | ||
| 22 | <string>General</string> | ||
| 23 | </property> | ||
| 24 | <layout class="QHBoxLayout" name="GeneralHorizontalLayout"> | ||
| 25 | <item> | ||
| 26 | <layout class="QVBoxLayout" name="GeneralVerticalLayout"> | ||
| 19 | <item> | 27 | <item> |
| 20 | <widget class="QGroupBox" name="GeneralGroupBox"> | 28 | <widget class="QCheckBox" name="show_unknown"> |
| 21 | <property name="title"> | 29 | <property name="text"> |
| 22 | <string>General</string> | 30 | <string>Show files with type 'Unknown'</string> |
| 23 | </property> | 31 | </property> |
| 24 | <layout class="QHBoxLayout" name="GeneralHorizontalLayout"> | 32 | </widget> |
| 25 | <item> | ||
| 26 | <layout class="QVBoxLayout" name="GeneralVerticalLayout"> | ||
| 27 | <item> | ||
| 28 | <widget class="QCheckBox" name="show_unknown"> | ||
| 29 | <property name="text"> | ||
| 30 | <string>Show files with type 'Unknown'</string> | ||
| 31 | </property> | ||
| 32 | </widget> | ||
| 33 | </item> | ||
| 34 | </layout> | ||
| 35 | </item> | ||
| 36 | </layout> | ||
| 37 | </widget> | ||
| 38 | </item> | 33 | </item> |
| 39 | <item> | 34 | <item> |
| 40 | <widget class="QGroupBox" name="IconSizeGroupBox"> | 35 | <widget class="QCheckBox" name="show_add_ons"> |
| 41 | <property name="title"> | 36 | <property name="text"> |
| 42 | <string>Icon Size</string> | 37 | <string>Show Add-Ons Column</string> |
| 43 | </property> | 38 | </property> |
| 44 | <layout class="QHBoxLayout" name="icon_size_qhbox_layout"> | 39 | </widget> |
| 45 | <item> | ||
| 46 | <layout class="QVBoxLayout" name="icon_size_qvbox_layout"> | ||
| 47 | <item> | ||
| 48 | <layout class="QHBoxLayout" name="icon_size_qhbox_layout_2"> | ||
| 49 | <item> | ||
| 50 | <widget class="QLabel" name="icon_size_label"> | ||
| 51 | <property name="text"> | ||
| 52 | <string>Icon Size:</string> | ||
| 53 | </property> | ||
| 54 | </widget> | ||
| 55 | </item> | ||
| 56 | <item> | ||
| 57 | <widget class="QComboBox" name="icon_size_combobox"/> | ||
| 58 | </item> | ||
| 59 | </layout> | ||
| 60 | </item> | ||
| 61 | </layout> | ||
| 62 | </item> | ||
| 63 | </layout> | ||
| 64 | </widget> | ||
| 65 | </item> | 40 | </item> |
| 41 | </layout> | ||
| 42 | </item> | ||
| 43 | </layout> | ||
| 44 | </widget> | ||
| 45 | </item> | ||
| 46 | <item> | ||
| 47 | <widget class="QGroupBox" name="IconSizeGroupBox"> | ||
| 48 | <property name="title"> | ||
| 49 | <string>Icon Size</string> | ||
| 50 | </property> | ||
| 51 | <layout class="QHBoxLayout" name="icon_size_qhbox_layout"> | ||
| 52 | <item> | ||
| 53 | <layout class="QVBoxLayout" name="icon_size_qvbox_layout"> | ||
| 66 | <item> | 54 | <item> |
| 67 | <widget class="QGroupBox" name="RowGroupBox"> | 55 | <layout class="QHBoxLayout" name="icon_size_qhbox_layout_2"> |
| 68 | <property name="title"> | 56 | <item> |
| 69 | <string>Row Text</string> | 57 | <widget class="QLabel" name="icon_size_label"> |
| 58 | <property name="text"> | ||
| 59 | <string>Icon Size:</string> | ||
| 70 | </property> | 60 | </property> |
| 71 | <layout class="QHBoxLayout" name="RowHorizontalLayout"> | 61 | </widget> |
| 72 | <item> | 62 | </item> |
| 73 | <layout class="QVBoxLayout" name="RowVerticalLayout"> | 63 | <item> |
| 74 | <item> | 64 | <widget class="QComboBox" name="icon_size_combobox"/> |
| 75 | <layout class="QHBoxLayout" name="row_1_qhbox_layout"> | 65 | </item> |
| 76 | <item> | 66 | </layout> |
| 77 | <widget class="QLabel" name="row_1_label"> | ||
| 78 | <property name="text"> | ||
| 79 | <string>Row 1 Text:</string> | ||
| 80 | </property> | ||
| 81 | </widget> | ||
| 82 | </item> | ||
| 83 | <item> | ||
| 84 | <widget class="QComboBox" name="row_1_text_combobox"/> | ||
| 85 | </item> | ||
| 86 | </layout> | ||
| 87 | </item> | ||
| 88 | <item> | ||
| 89 | <layout class="QHBoxLayout" name="row_2_qhbox_layout"> | ||
| 90 | <item> | ||
| 91 | <widget class="QLabel" name="row_2_label"> | ||
| 92 | <property name="text"> | ||
| 93 | <string>Row 2 Text:</string> | ||
| 94 | </property> | ||
| 95 | </widget> | ||
| 96 | </item> | ||
| 97 | <item> | ||
| 98 | <widget class="QComboBox" name="row_2_text_combobox"/> | ||
| 99 | </item> | ||
| 100 | </layout> | ||
| 101 | </item> | ||
| 102 | </layout> | ||
| 103 | </item> | ||
| 104 | </layout> | ||
| 105 | </widget> | ||
| 106 | </item> | 67 | </item> |
| 68 | </layout> | ||
| 69 | </item> | ||
| 70 | </layout> | ||
| 71 | </widget> | ||
| 72 | </item> | ||
| 73 | <item> | ||
| 74 | <widget class="QGroupBox" name="RowGroupBox"> | ||
| 75 | <property name="title"> | ||
| 76 | <string>Row Text</string> | ||
| 77 | </property> | ||
| 78 | <layout class="QHBoxLayout" name="RowHorizontalLayout"> | ||
| 79 | <item> | ||
| 80 | <layout class="QVBoxLayout" name="RowVerticalLayout"> | ||
| 107 | <item> | 81 | <item> |
| 108 | <spacer name="verticalSpacer"> | 82 | <layout class="QHBoxLayout" name="row_1_qhbox_layout"> |
| 109 | <property name="orientation"> | 83 | <item> |
| 110 | <enum>Qt::Vertical</enum> | 84 | <widget class="QLabel" name="row_1_label"> |
| 85 | <property name="text"> | ||
| 86 | <string>Row 1 Text:</string> | ||
| 111 | </property> | 87 | </property> |
| 112 | <property name="sizeHint" stdset="0"> | 88 | </widget> |
| 113 | <size> | 89 | </item> |
| 114 | <width>20</width> | 90 | <item> |
| 115 | <height>40</height> | 91 | <widget class="QComboBox" name="row_1_text_combobox"/> |
| 116 | </size> | 92 | </item> |
| 93 | </layout> | ||
| 94 | </item> | ||
| 95 | <item> | ||
| 96 | <layout class="QHBoxLayout" name="row_2_qhbox_layout"> | ||
| 97 | <item> | ||
| 98 | <widget class="QLabel" name="row_2_label"> | ||
| 99 | <property name="text"> | ||
| 100 | <string>Row 2 Text:</string> | ||
| 117 | </property> | 101 | </property> |
| 118 | </spacer> | 102 | </widget> |
| 103 | </item> | ||
| 104 | <item> | ||
| 105 | <widget class="QComboBox" name="row_2_text_combobox"/> | ||
| 106 | </item> | ||
| 107 | </layout> | ||
| 119 | </item> | 108 | </item> |
| 120 | </layout> | 109 | </layout> |
| 121 | </item> | 110 | </item> |
| 111 | </layout> | ||
| 112 | </widget> | ||
| 113 | </item> | ||
| 114 | <item> | ||
| 115 | <spacer name="verticalSpacer"> | ||
| 116 | <property name="orientation"> | ||
| 117 | <enum>Qt::Vertical</enum> | ||
| 118 | </property> | ||
| 119 | <property name="sizeHint" stdset="0"> | ||
| 120 | <size> | ||
| 121 | <width>20</width> | ||
| 122 | <height>40</height> | ||
| 123 | </size> | ||
| 124 | </property> | ||
| 125 | </spacer> | ||
| 126 | </item> | ||
| 122 | </layout> | 127 | </layout> |
| 123 | </widget> | 128 | </item> |
| 129 | </layout> | ||
| 130 | </widget> | ||
| 124 | <resources/> | 131 | <resources/> |
| 125 | <connections/> | 132 | <connections/> |
| 126 | </ui> | 133 | </ui> |
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index a5a4aa432..11a8c390b 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -215,12 +215,18 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, GMainWindow* parent) | |||
| 215 | tree_view->setUniformRowHeights(true); | 215 | tree_view->setUniformRowHeights(true); |
| 216 | tree_view->setContextMenuPolicy(Qt::CustomContextMenu); | 216 | tree_view->setContextMenuPolicy(Qt::CustomContextMenu); |
| 217 | 217 | ||
| 218 | item_model->insertColumns(0, COLUMN_COUNT); | 218 | item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1); |
| 219 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); | 219 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); |
| 220 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); | 220 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); |
| 221 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); | 221 | |
| 222 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); | 222 | if (UISettings::values.show_add_ons) { |
| 223 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); | 223 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); |
| 224 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); | ||
| 225 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); | ||
| 226 | } else { | ||
| 227 | item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type")); | ||
| 228 | item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size")); | ||
| 229 | } | ||
| 224 | 230 | ||
| 225 | connect(tree_view, &QTreeView::activated, this, &GameList::ValidateEntry); | 231 | connect(tree_view, &QTreeView::activated, this, &GameList::ValidateEntry); |
| 226 | connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu); | 232 | connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu); |
| @@ -394,6 +400,25 @@ void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) { | |||
| 394 | } | 400 | } |
| 395 | 401 | ||
| 396 | tree_view->setEnabled(false); | 402 | tree_view->setEnabled(false); |
| 403 | |||
| 404 | // Update the columns in case UISettings has changed | ||
| 405 | item_model->removeColumns(0, item_model->columnCount()); | ||
| 406 | item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1); | ||
| 407 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); | ||
| 408 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); | ||
| 409 | |||
| 410 | if (UISettings::values.show_add_ons) { | ||
| 411 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); | ||
| 412 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); | ||
| 413 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); | ||
| 414 | } else { | ||
| 415 | item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type")); | ||
| 416 | item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size")); | ||
| 417 | item_model->removeColumns(COLUMN_COUNT - 1, 1); | ||
| 418 | } | ||
| 419 | |||
| 420 | LoadInterfaceLayout(); | ||
| 421 | |||
| 397 | // Delete any rows that might already exist if we're repopulating | 422 | // Delete any rows that might already exist if we're repopulating |
| 398 | item_model->removeRows(0, item_model->rowCount()); | 423 | item_model->removeRows(0, item_model->rowCount()); |
| 399 | 424 | ||
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index 3d865a12d..362902e46 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp | |||
| @@ -123,17 +123,22 @@ void GameListWorker::AddInstalledTitlesToGameList() { | |||
| 123 | if (it != compatibility_list.end()) | 123 | if (it != compatibility_list.end()) |
| 124 | compatibility = it->second.first; | 124 | compatibility = it->second.first; |
| 125 | 125 | ||
| 126 | emit EntryReady({ | 126 | QList<QStandardItem*> list{ |
| 127 | new GameListItemPath( | 127 | new GameListItemPath( |
| 128 | FormatGameName(file->GetFullPath()), icon, QString::fromStdString(name), | 128 | FormatGameName(file->GetFullPath()), icon, QString::fromStdString(name), |
| 129 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), | 129 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), |
| 130 | program_id), | 130 | program_id), |
| 131 | new GameListItemCompat(compatibility), | 131 | new GameListItemCompat(compatibility), |
| 132 | new GameListItem(FormatPatchNameVersions(patch, *loader)), | ||
| 133 | new GameListItem( | 132 | new GameListItem( |
| 134 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), | 133 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), |
| 135 | new GameListItemSize(file->GetSize()), | 134 | new GameListItemSize(file->GetSize()), |
| 136 | }); | 135 | }; |
| 136 | |||
| 137 | if (UISettings::values.show_add_ons) { | ||
| 138 | list.insert(2, new GameListItem(FormatPatchNameVersions(patch, *loader))); | ||
| 139 | } | ||
| 140 | |||
| 141 | emit EntryReady(list); | ||
| 137 | } | 142 | } |
| 138 | 143 | ||
| 139 | const auto control_data = cache->ListEntriesFilter(FileSys::TitleType::Application, | 144 | const auto control_data = cache->ListEntriesFilter(FileSys::TitleType::Application, |
| @@ -216,18 +221,23 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign | |||
| 216 | if (it != compatibility_list.end()) | 221 | if (it != compatibility_list.end()) |
| 217 | compatibility = it->second.first; | 222 | compatibility = it->second.first; |
| 218 | 223 | ||
| 219 | emit EntryReady({ | 224 | QList<QStandardItem*> list{ |
| 220 | new GameListItemPath( | 225 | new GameListItemPath( |
| 221 | FormatGameName(physical_name), icon, QString::fromStdString(name), | 226 | FormatGameName(physical_name), icon, QString::fromStdString(name), |
| 222 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), | 227 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), |
| 223 | program_id), | 228 | program_id), |
| 224 | new GameListItemCompat(compatibility), | 229 | new GameListItemCompat(compatibility), |
| 225 | new GameListItem( | 230 | new GameListItem( |
| 226 | FormatPatchNameVersions(patch, *loader, loader->IsRomFSUpdatable())), | ||
| 227 | new GameListItem( | ||
| 228 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), | 231 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), |
| 229 | new GameListItemSize(FileUtil::GetSize(physical_name)), | 232 | new GameListItemSize(FileUtil::GetSize(physical_name)), |
| 230 | }); | 233 | }; |
| 234 | |||
| 235 | if (UISettings::values.show_add_ons) { | ||
| 236 | list.insert(2, new GameListItem(FormatPatchNameVersions( | ||
| 237 | patch, *loader, loader->IsRomFSUpdatable()))); | ||
| 238 | } | ||
| 239 | |||
| 240 | emit EntryReady(std::move(list)); | ||
| 231 | } else if (is_dir && recursion > 0) { | 241 | } else if (is_dir && recursion > 0) { |
| 232 | watch_list.append(QString::fromStdString(physical_name)); | 242 | watch_list.append(QString::fromStdString(physical_name)); |
| 233 | AddFstEntriesToGameList(physical_name, recursion - 1); | 243 | AddFstEntriesToGameList(physical_name, recursion - 1); |
diff --git a/src/yuzu/ui_settings.h b/src/yuzu/ui_settings.h index 2e617d52a..32a0d813c 100644 --- a/src/yuzu/ui_settings.h +++ b/src/yuzu/ui_settings.h | |||
| @@ -59,6 +59,7 @@ struct Values { | |||
| 59 | 59 | ||
| 60 | // Game List | 60 | // Game List |
| 61 | bool show_unknown; | 61 | bool show_unknown; |
| 62 | bool show_add_ons; | ||
| 62 | uint32_t icon_size; | 63 | uint32_t icon_size; |
| 63 | uint8_t row_1_text_id; | 64 | uint8_t row_1_text_id; |
| 64 | uint8_t row_2_text_id; | 65 | uint8_t row_2_text_id; |