Adding build version information to main window/log.

This commit is contained in:
Ben Vanik
2015-12-27 11:53:37 -08:00
parent 5f61c6ad07
commit 5de82887fa
5 changed files with 99 additions and 16 deletions

View File

@@ -9,6 +9,9 @@
#include "xenia/app/emulator_window.h"
// Autogenerated by `xb premake`.
#include "build/version.h"
#include "third_party/imgui/imgui.h"
#include "xenia/base/clock.h"
#include "xenia/base/logging.h"
@@ -33,7 +36,11 @@ const std::wstring kBaseTitle = L"xenia";
EmulatorWindow::EmulatorWindow(Emulator* emulator)
: emulator_(emulator),
loop_(ui::Loop::Create()),
window_(ui::Window::Create(loop_.get(), kBaseTitle)) {}
window_(ui::Window::Create(loop_.get(), kBaseTitle)) {
base_title_ = kBaseTitle + L" (" + xe::to_wstring(XE_BUILD_BRANCH) + L"/" +
xe::to_wstring(XE_BUILD_COMMIT_SHORT) + L"/" +
xe::to_wstring(XE_BUILD_DATE) + L")";
}
EmulatorWindow::~EmulatorWindow() {
loop_->PostSynchronous([this]() { window_.reset(); });
@@ -189,6 +196,21 @@ bool EmulatorWindow::Initialize() {
// Help menu.
auto help_menu = MenuItem::Create(MenuItem::Type::kPopup, L"&Help");
{
help_menu->AddChild(MenuItem::Create(
MenuItem::Type::kString, L"Build commit on GitHub...", [this]() {
std::string url =
std::string("https://github.com/benvanik/xenia/tree/") +
XE_BUILD_COMMIT + "/";
LaunchBrowser(url.c_str());
}));
help_menu->AddChild(MenuItem::Create(
MenuItem::Type::kString, L"Recent changes on GitHub...", [this]() {
std::string url =
std::string("https://github.com/benvanik/xenia/compare/") +
XE_BUILD_COMMIT + "..." + XE_BUILD_BRANCH;
LaunchBrowser(url.c_str());
}));
help_menu->AddChild(MenuItem::Create(MenuItem::Type::kSeparator));
help_menu->AddChild(
MenuItem::Create(MenuItem::Type::kString, L"&Website...", L"F1",
std::bind(&EmulatorWindow::ShowHelpWebsite, this)));
@@ -253,7 +275,7 @@ void EmulatorWindow::ToggleFullscreen() {
void EmulatorWindow::ShowHelpWebsite() { LaunchBrowser("http://xenia.jp"); }
void EmulatorWindow::UpdateTitle() {
std::wstring title(kBaseTitle);
std::wstring title(base_title_);
if (Clock::guest_time_scalar() != 1.0) {
title += L" (@";
title += xe::to_wstring(std::to_string(Clock::guest_time_scalar()));