summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-08-25 19:06:16 -0400
committerGravatar Zach Hilman2018-09-04 16:24:02 -0400
commit8e150c46b9abb29337633df90b115637deaf80a8 (patch)
treeb0b39e05cacdc9e61e91dde424241c12b5faaf20
parentloader: Add BKTR-specific error messages and codes (diff)
downloadyuzu-8e150c46b9abb29337633df90b115637deaf80a8.tar.gz
yuzu-8e150c46b9abb29337633df90b115637deaf80a8.tar.xz
yuzu-8e150c46b9abb29337633df90b115637deaf80a8.zip
game_list: Display patch names and versions on list
-rw-r--r--src/yuzu/game_list.cpp26
-rw-r--r--src/yuzu/game_list.h1
2 files changed, 27 insertions, 0 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index baf78af09..1aec08cdb 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -21,6 +21,7 @@
21#include "core/file_sys/content_archive.h" 21#include "core/file_sys/content_archive.h"
22#include "core/file_sys/control_metadata.h" 22#include "core/file_sys/control_metadata.h"
23#include "core/file_sys/nca_metadata.h" 23#include "core/file_sys/nca_metadata.h"
24#include "core/file_sys/patch_manager.h"
24#include "core/file_sys/registered_cache.h" 25#include "core/file_sys/registered_cache.h"
25#include "core/file_sys/romfs.h" 26#include "core/file_sys/romfs.h"
26#include "core/file_sys/vfs_real.h" 27#include "core/file_sys/vfs_real.h"
@@ -232,6 +233,7 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, GMainWindow* parent)
232 item_model->insertColumns(0, COLUMN_COUNT); 233 item_model->insertColumns(0, COLUMN_COUNT);
233 item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, "Name"); 234 item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, "Name");
234 item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, "Compatibility"); 235 item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, "Compatibility");
236 item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, "Add-ons");
235 item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, "File type"); 237 item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, "File type");
236 item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, "Size"); 238 item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, "Size");
237 239
@@ -454,6 +456,26 @@ static QString FormatGameName(const std::string& physical_name) {
454 return physical_name_as_qstring; 456 return physical_name_as_qstring;
455} 457}
456 458
459static QString FormatPatchNameVersions(u64 title_id, bool updatable = true) {
460 const FileSys::PatchManager patch_manager(title_id);
461 QString out;
462 for (const auto& kv : patch_manager.GetPatchVersionNames()) {
463 if (!updatable && kv.first == FileSys::PatchType::Update)
464 continue;
465
466 if (kv.second == 0) {
467 out.append(fmt::format("{}\n", FileSys::FormatPatchTypeName(kv.first)).c_str());
468 } else {
469 out.append(fmt::format("{} ({})\n", FileSys::FormatPatchTypeName(kv.first),
470 FileSys::FormatTitleVersion(kv.second))
471 .c_str());
472 }
473 }
474
475 out.chop(1);
476 return out;
477}
478
457void GameList::RefreshGameDirectory() { 479void GameList::RefreshGameDirectory() {
458 if (!UISettings::values.gamedir.isEmpty() && current_worker != nullptr) { 480 if (!UISettings::values.gamedir.isEmpty() && current_worker != nullptr) {
459 LOG_INFO(Frontend, "Change detected in the games directory. Reloading game list."); 481 LOG_INFO(Frontend, "Change detected in the games directory. Reloading game list.");
@@ -515,6 +537,7 @@ void GameListWorker::AddInstalledTitlesToGameList(std::shared_ptr<FileSys::Regis
515 FormatGameName(file->GetFullPath()), icon, QString::fromStdString(name), 537 FormatGameName(file->GetFullPath()), icon, QString::fromStdString(name),
516 QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), 538 QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())),
517 program_id), 539 program_id),
540 new GameListItem(FormatPatchNameVersions(program_id)),
518 new GameListItem( 541 new GameListItem(
519 QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), 542 QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))),
520 new GameListItemSize(file->GetSize()), 543 new GameListItemSize(file->GetSize()),
@@ -596,12 +619,15 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
596 if (it != compatibility_list.end()) 619 if (it != compatibility_list.end())
597 compatibility = it->second.first; 620 compatibility = it->second.first;
598 621
622 FileSys::PatchManager patch{program_id};
623
599 emit EntryReady({ 624 emit EntryReady({
600 new GameListItemPath( 625 new GameListItemPath(
601 FormatGameName(physical_name), icon, QString::fromStdString(name), 626 FormatGameName(physical_name), icon, QString::fromStdString(name),
602 QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), 627 QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())),
603 program_id), 628 program_id),
604 new GameListItemCompat(compatibility), 629 new GameListItemCompat(compatibility),
630 new GameListItem(FormatPatchNameVersions(program_id, loader->IsRomFSUpdatable())),
605 new GameListItem( 631 new GameListItem(
606 QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), 632 QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))),
607 new GameListItemSize(FileUtil::GetSize(physical_name)), 633 new GameListItemSize(FileUtil::GetSize(physical_name)),
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index 84731464a..3fcb298ed 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -38,6 +38,7 @@ public:
38 enum { 38 enum {
39 COLUMN_NAME, 39 COLUMN_NAME,
40 COLUMN_COMPATIBILITY, 40 COLUMN_COMPATIBILITY,
41 COLUMN_ADD_ONS,
41 COLUMN_FILE_TYPE, 42 COLUMN_FILE_TYPE,
42 COLUMN_SIZE, 43 COLUMN_SIZE,
43 COLUMN_COUNT, // Number of columns 44 COLUMN_COUNT, // Number of columns