mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2025-08-30 16:04:02 -07:00
Add performance statistics to status bar
This commit is contained in:
@@ -253,6 +253,8 @@ void GMainWindow::ConnectWidgetEvents() {
|
||||
connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window,
|
||||
SLOT(OnEmulationStarting(EmuThread*)));
|
||||
connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping()));
|
||||
|
||||
connect(&status_bar_update_timer, &QTimer::timeout, this, &GMainWindow::UpdateStatusBar);
|
||||
}
|
||||
|
||||
void GMainWindow::ConnectMenuEvents() {
|
||||
@@ -401,6 +403,8 @@ void GMainWindow::BootGame(const QString& filename) {
|
||||
if (ui.action_Single_Window_Mode->isChecked()) {
|
||||
game_list->hide();
|
||||
}
|
||||
status_bar_update_timer.start(1000);
|
||||
|
||||
render_window->show();
|
||||
render_window->setFocus();
|
||||
|
||||
@@ -435,6 +439,12 @@ void GMainWindow::ShutdownGame() {
|
||||
render_window->hide();
|
||||
game_list->show();
|
||||
|
||||
// Disable status bar updates
|
||||
status_bar_update_timer.stop();
|
||||
emu_speed_label->setVisible(false);
|
||||
game_fps_label->setVisible(false);
|
||||
emu_frametime_label->setVisible(false);
|
||||
|
||||
emulation_running = false;
|
||||
}
|
||||
|
||||
@@ -614,6 +624,23 @@ void GMainWindow::OnCreateGraphicsSurfaceViewer() {
|
||||
graphicsSurfaceViewerWidget->show();
|
||||
}
|
||||
|
||||
void GMainWindow::UpdateStatusBar() {
|
||||
if (emu_thread == nullptr) {
|
||||
status_bar_update_timer.stop();
|
||||
return;
|
||||
}
|
||||
|
||||
auto results = Core::System::GetInstance().GetAndResetPerfStats();
|
||||
|
||||
emu_speed_label->setText(tr("Speed: %1%").arg(results.emulation_speed * 100.0, 0, 'f', 2));
|
||||
game_fps_label->setText(tr("Game: %1 FPS").arg(results.game_fps, 0, 'f', 1));
|
||||
emu_frametime_label->setText(tr("Frame: %1 ms").arg(results.frametime * 1000.0, 0, 'f', 2));
|
||||
|
||||
emu_speed_label->setVisible(true);
|
||||
game_fps_label->setVisible(true);
|
||||
emu_frametime_label->setVisible(true);
|
||||
}
|
||||
|
||||
bool GMainWindow::ConfirmClose() {
|
||||
if (emu_thread == nullptr || !UISettings::values.confirm_before_closing)
|
||||
return true;
|
||||
|
@@ -127,6 +127,8 @@ private slots:
|
||||
void OnCreateGraphicsSurfaceViewer();
|
||||
|
||||
private:
|
||||
void UpdateStatusBar();
|
||||
|
||||
Ui::MainWindow ui;
|
||||
|
||||
GRenderWindow* render_window;
|
||||
@@ -136,6 +138,7 @@ private:
|
||||
QLabel* emu_speed_label = nullptr;
|
||||
QLabel* game_fps_label = nullptr;
|
||||
QLabel* emu_frametime_label = nullptr;
|
||||
QTimer status_bar_update_timer;
|
||||
|
||||
std::unique_ptr<Config> config;
|
||||
|
||||
|
Reference in New Issue
Block a user