Time scaling works (num pad +/- or --time_scalar=X).
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "xenia/ui/main_window.h"
|
||||
|
||||
#include "xenia/base/clock.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/gpu/graphics_system.h"
|
||||
@@ -18,8 +19,10 @@
|
||||
namespace xe {
|
||||
namespace ui {
|
||||
|
||||
const std::wstring kBaseTitle = L"xenia";
|
||||
|
||||
MainWindow::MainWindow(Emulator* emulator)
|
||||
: PlatformWindow(L"xenia"),
|
||||
: PlatformWindow(kBaseTitle),
|
||||
emulator_(emulator),
|
||||
main_menu_(MenuItem::Type::kNormal) {}
|
||||
|
||||
@@ -48,6 +51,7 @@ bool MainWindow::Initialize() {
|
||||
return false;
|
||||
}
|
||||
Resize(1280, 720);
|
||||
UpdateTitle();
|
||||
on_key_down.AddListener([this](KeyEvent& e) {
|
||||
bool handled = true;
|
||||
switch (e.key_code()) {
|
||||
@@ -59,6 +63,21 @@ bool MainWindow::Initialize() {
|
||||
emulator()->graphics_system()->ClearCaches();
|
||||
break;
|
||||
}
|
||||
case 0x6D: { // numpad minus
|
||||
Clock::set_guest_time_scalar(Clock::guest_time_scalar() / 2.0);
|
||||
UpdateTitle();
|
||||
break;
|
||||
}
|
||||
case 0x6B: { // numpad plus
|
||||
Clock::set_guest_time_scalar(Clock::guest_time_scalar() * 2.0);
|
||||
UpdateTitle();
|
||||
break;
|
||||
}
|
||||
case 0x0D: { // numpad enter
|
||||
Clock::set_guest_time_scalar(1.0);
|
||||
UpdateTitle();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
handled = false;
|
||||
break;
|
||||
@@ -83,6 +102,16 @@ bool MainWindow::Initialize() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::UpdateTitle() {
|
||||
std::wstring title(kBaseTitle);
|
||||
if (Clock::guest_time_scalar() != 1.0) {
|
||||
title += L" (@";
|
||||
title += xe::to_wstring(std::to_string(Clock::guest_time_scalar()));
|
||||
title += L"x)";
|
||||
}
|
||||
set_title(title);
|
||||
}
|
||||
|
||||
void MainWindow::OnClose() {
|
||||
loop_.Quit();
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ class MainWindow : public PlatformWindow {
|
||||
private:
|
||||
bool Initialize();
|
||||
|
||||
void UpdateTitle();
|
||||
|
||||
void OnClose() override;
|
||||
void OnCommand(int id) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user