diff options
| author | 2020-06-08 23:58:04 +0200 | |
|---|---|---|
| committer | 2020-06-08 23:58:04 +0200 | |
| commit | 20a779299a62808b4e4bbc7bfde6e9e4487a857d (patch) | |
| tree | 4cb72115812265b8fe19b47088a17aba31b0995f /src | |
| parent | Merge pull request #4052 from ReinUsesLisp/debug-output (diff) | |
| download | yuzu-20a779299a62808b4e4bbc7bfde6e9e4487a857d.tar.gz yuzu-20a779299a62808b4e4bbc7bfde6e9e4487a857d.tar.xz yuzu-20a779299a62808b4e4bbc7bfde6e9e4487a857d.zip | |
Add game versio to title bar
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 27 | ||||
| -rw-r--r-- | src/yuzu/main.h | 3 |
2 files changed, 17 insertions, 13 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 270cccc77..f552b9401 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1037,17 +1037,19 @@ void GMainWindow::BootGame(const QString& filename) { | |||
| 1037 | const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); | 1037 | const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); |
| 1038 | 1038 | ||
| 1039 | std::string title_name; | 1039 | std::string title_name; |
| 1040 | std::string title_version; | ||
| 1040 | const auto res = Core::System::GetInstance().GetGameName(title_name); | 1041 | const auto res = Core::System::GetInstance().GetGameName(title_name); |
| 1041 | if (res != Loader::ResultStatus::Success) { | ||
| 1042 | const auto metadata = FileSys::PatchManager(title_id).GetControlMetadata(); | ||
| 1043 | if (metadata.first != nullptr) | ||
| 1044 | title_name = metadata.first->GetApplicationName(); | ||
| 1045 | 1042 | ||
| 1046 | if (title_name.empty()) | 1043 | const auto metadata = FileSys::PatchManager(title_id).GetControlMetadata(); |
| 1047 | title_name = FileUtil::GetFilename(filename.toStdString()); | 1044 | if (metadata.first != nullptr) { |
| 1045 | title_version = metadata.first->GetVersionString(); | ||
| 1046 | title_name = metadata.first->GetApplicationName(); | ||
| 1048 | } | 1047 | } |
| 1049 | LOG_INFO(Frontend, "Booting game: {:016X} | {}", title_id, title_name); | 1048 | if (res != Loader::ResultStatus::Success || title_name.empty()) { |
| 1050 | UpdateWindowTitle(QString::fromStdString(title_name)); | 1049 | title_name = FileUtil::GetFilename(filename.toStdString()); |
| 1050 | } | ||
| 1051 | LOG_INFO(Frontend, "Booting game: {:016X} | {} | {}", title_id, title_name, title_version); | ||
| 1052 | UpdateWindowTitle(title_name, title_version); | ||
| 1051 | 1053 | ||
| 1052 | loading_screen->Prepare(Core::System::GetInstance().GetAppLoader()); | 1054 | loading_screen->Prepare(Core::System::GetInstance().GetAppLoader()); |
| 1053 | loading_screen->show(); | 1055 | loading_screen->show(); |
| @@ -1995,7 +1997,8 @@ void GMainWindow::OnCaptureScreenshot() { | |||
| 1995 | OnStartGame(); | 1997 | OnStartGame(); |
| 1996 | } | 1998 | } |
| 1997 | 1999 | ||
| 1998 | void GMainWindow::UpdateWindowTitle(const QString& title_name) { | 2000 | void GMainWindow::UpdateWindowTitle(const std::string& title_name, |
| 2001 | const std::string& title_version) { | ||
| 1999 | const auto full_name = std::string(Common::g_build_fullname); | 2002 | const auto full_name = std::string(Common::g_build_fullname); |
| 2000 | const auto branch_name = std::string(Common::g_scm_branch); | 2003 | const auto branch_name = std::string(Common::g_scm_branch); |
| 2001 | const auto description = std::string(Common::g_scm_desc); | 2004 | const auto description = std::string(Common::g_scm_desc); |
| @@ -2004,7 +2007,7 @@ void GMainWindow::UpdateWindowTitle(const QString& title_name) { | |||
| 2004 | const auto date = | 2007 | const auto date = |
| 2005 | QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd")).toStdString(); | 2008 | QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd")).toStdString(); |
| 2006 | 2009 | ||
| 2007 | if (title_name.isEmpty()) { | 2010 | if (title_name.empty()) { |
| 2008 | const auto fmt = std::string(Common::g_title_bar_format_idle); | 2011 | const auto fmt = std::string(Common::g_title_bar_format_idle); |
| 2009 | setWindowTitle(QString::fromStdString(fmt::format(fmt.empty() ? "yuzu {0}| {1}-{2}" : fmt, | 2012 | setWindowTitle(QString::fromStdString(fmt::format(fmt.empty() ? "yuzu {0}| {1}-{2}" : fmt, |
| 2010 | full_name, branch_name, description, | 2013 | full_name, branch_name, description, |
| @@ -2012,8 +2015,8 @@ void GMainWindow::UpdateWindowTitle(const QString& title_name) { | |||
| 2012 | } else { | 2015 | } else { |
| 2013 | const auto fmt = std::string(Common::g_title_bar_format_running); | 2016 | const auto fmt = std::string(Common::g_title_bar_format_running); |
| 2014 | setWindowTitle(QString::fromStdString( | 2017 | setWindowTitle(QString::fromStdString( |
| 2015 | fmt::format(fmt.empty() ? "yuzu {0}| {3} | {1}-{2}" : fmt, full_name, branch_name, | 2018 | fmt::format(fmt.empty() ? "yuzu {0}| {3} | {4} | {1}-{2}" : fmt, full_name, branch_name, |
| 2016 | description, title_name.toStdString(), date, build_id))); | 2019 | description, title_name, title_version, date, build_id))); |
| 2017 | } | 2020 | } |
| 2018 | } | 2021 | } |
| 2019 | 2022 | ||
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 4f4c8ddbe..9ad61cab8 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -215,7 +215,8 @@ private slots: | |||
| 215 | 215 | ||
| 216 | private: | 216 | private: |
| 217 | std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); | 217 | std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); |
| 218 | void UpdateWindowTitle(const QString& title_name = {}); | 218 | void UpdateWindowTitle(const std::string& title_name = {}, |
| 219 | const std::string& title_version = {}); | ||
| 219 | void UpdateStatusBar(); | 220 | void UpdateStatusBar(); |
| 220 | void HideMouseCursor(); | 221 | void HideMouseCursor(); |
| 221 | void ShowMouseCursor(); | 222 | void ShowMouseCursor(); |