Adding build version information to main window/log.
This commit is contained in:
@@ -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()));
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#define XENIA_APP_EMULATOR_WINDOW_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "xenia/ui/loop.h"
|
||||
#include "xenia/ui/menu_item.h"
|
||||
@@ -52,6 +53,7 @@ class EmulatorWindow {
|
||||
Emulator* emulator_;
|
||||
std::unique_ptr<ui::Loop> loop_;
|
||||
std::unique_ptr<ui::Window> window_;
|
||||
std::wstring base_title_;
|
||||
};
|
||||
|
||||
} // namespace app
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#include <gflags/gflags.h>
|
||||
#include <io.h>
|
||||
|
||||
// Autogenerated by `xb premake`.
|
||||
#include "build/version.h"
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/platform_win.h"
|
||||
#include "xenia/base/string.h"
|
||||
@@ -88,6 +91,10 @@ int Main() {
|
||||
// Initialize logging. Needs parsed FLAGS.
|
||||
xe::InitializeLogging(entry_info.name);
|
||||
|
||||
// Print version info.
|
||||
XELOGI("Build: %s / %s on %s", XE_BUILD_BRANCH, XE_BUILD_COMMIT,
|
||||
XE_BUILD_DATE);
|
||||
|
||||
// Call app-provided entry point.
|
||||
int result = entry_info.entry_point(args);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user