mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
Frontends: Add frame time performance counters
This commit is contained in:
parent
67710ca184
commit
9562cbea56
|
@ -433,26 +433,43 @@ void HostInterface::UpdateSpeedLimiterState()
|
||||||
m_last_throttle_time = 0;
|
m_last_throttle_time = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HostInterface::OnPerformanceCountersUpdated() {}
|
||||||
|
|
||||||
|
void HostInterface::RunFrame()
|
||||||
|
{
|
||||||
|
m_frame_timer.Reset();
|
||||||
|
m_system->RunFrame();
|
||||||
|
UpdatePerformanceCounters();
|
||||||
|
}
|
||||||
|
|
||||||
void HostInterface::UpdatePerformanceCounters()
|
void HostInterface::UpdatePerformanceCounters()
|
||||||
{
|
{
|
||||||
if (!m_system)
|
const float frame_time = static_cast<float>(m_frame_timer.GetTimeMilliseconds());
|
||||||
return;
|
m_average_frame_time_accumulator += frame_time;
|
||||||
|
m_worst_frame_time_accumulator = std::max(m_worst_frame_time_accumulator, frame_time);
|
||||||
|
|
||||||
// update fps counter
|
// update fps counter
|
||||||
const double time = m_fps_timer.GetTimeSeconds();
|
const float time = static_cast<float>(m_fps_timer.GetTimeSeconds());
|
||||||
if (time >= 0.25f)
|
if (time < 1.0f)
|
||||||
{
|
return;
|
||||||
m_vps = static_cast<float>(static_cast<double>(m_system->GetFrameNumber() - m_last_frame_number) / time);
|
|
||||||
|
const float frames_presented = static_cast<float>(m_system->GetFrameNumber() - m_last_frame_number);
|
||||||
|
|
||||||
|
m_worst_frame_time = m_worst_frame_time_accumulator;
|
||||||
|
m_worst_frame_time_accumulator = 0.0f;
|
||||||
|
m_average_frame_time = m_average_frame_time_accumulator / frames_presented;
|
||||||
|
m_average_frame_time_accumulator = 0.0f;
|
||||||
|
m_vps = static_cast<float>(frames_presented / time);
|
||||||
m_last_frame_number = m_system->GetFrameNumber();
|
m_last_frame_number = m_system->GetFrameNumber();
|
||||||
m_fps =
|
m_fps = static_cast<float>(m_system->GetInternalFrameNumber() - m_last_internal_frame_number) / time;
|
||||||
static_cast<float>(static_cast<double>(m_system->GetInternalFrameNumber() - m_last_internal_frame_number) / time);
|
|
||||||
m_last_internal_frame_number = m_system->GetInternalFrameNumber();
|
m_last_internal_frame_number = m_system->GetInternalFrameNumber();
|
||||||
m_speed = static_cast<float>(static_cast<double>(m_system->GetGlobalTickCounter() - m_last_global_tick_counter) /
|
m_speed = static_cast<float>(static_cast<double>(m_system->GetGlobalTickCounter() - m_last_global_tick_counter) /
|
||||||
(static_cast<double>(MASTER_CLOCK) * time)) *
|
(static_cast<double>(MASTER_CLOCK) * time)) *
|
||||||
100.0f;
|
100.0f;
|
||||||
m_last_global_tick_counter = m_system->GetGlobalTickCounter();
|
m_last_global_tick_counter = m_system->GetGlobalTickCounter();
|
||||||
m_fps_timer.Reset();
|
m_fps_timer.Reset();
|
||||||
}
|
|
||||||
|
OnPerformanceCountersUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HostInterface::ResetPerformanceCounters()
|
void HostInterface::ResetPerformanceCounters()
|
||||||
|
@ -469,5 +486,7 @@ void HostInterface::ResetPerformanceCounters()
|
||||||
m_last_internal_frame_number = 0;
|
m_last_internal_frame_number = 0;
|
||||||
m_last_global_tick_counter = 0;
|
m_last_global_tick_counter = 0;
|
||||||
}
|
}
|
||||||
|
m_average_frame_time_accumulator = 0.0f;
|
||||||
|
m_worst_frame_time_accumulator = 0.0f;
|
||||||
m_fps_timer.Reset();
|
m_fps_timer.Reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,10 @@ protected:
|
||||||
float duration;
|
float duration;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual void OnPerformanceCountersUpdated();
|
||||||
|
|
||||||
|
void RunFrame();
|
||||||
|
|
||||||
/// Throttles the system, i.e. sleeps until it's time to execute the next frame.
|
/// Throttles the system, i.e. sleeps until it's time to execute the next frame.
|
||||||
void Throttle();
|
void Throttle();
|
||||||
|
|
||||||
|
@ -95,18 +99,24 @@ protected:
|
||||||
Common::Timer m_throttle_timer;
|
Common::Timer m_throttle_timer;
|
||||||
Common::Timer m_speed_lost_time_timestamp;
|
Common::Timer m_speed_lost_time_timestamp;
|
||||||
|
|
||||||
|
bool m_paused = false;
|
||||||
|
bool m_speed_limiter_temp_disabled = false;
|
||||||
|
bool m_speed_limiter_enabled = false;
|
||||||
|
|
||||||
|
float m_average_frame_time_accumulator = 0.0f;
|
||||||
|
float m_worst_frame_time_accumulator = 0.0f;
|
||||||
|
|
||||||
float m_vps = 0.0f;
|
float m_vps = 0.0f;
|
||||||
float m_fps = 0.0f;
|
float m_fps = 0.0f;
|
||||||
float m_speed = 0.0f;
|
float m_speed = 0.0f;
|
||||||
|
float m_worst_frame_time = 0.0f;
|
||||||
|
float m_average_frame_time = 0.0f;
|
||||||
u32 m_last_frame_number = 0;
|
u32 m_last_frame_number = 0;
|
||||||
u32 m_last_internal_frame_number = 0;
|
u32 m_last_internal_frame_number = 0;
|
||||||
u32 m_last_global_tick_counter = 0;
|
u32 m_last_global_tick_counter = 0;
|
||||||
Common::Timer m_fps_timer;
|
Common::Timer m_fps_timer;
|
||||||
|
Common::Timer m_frame_timer;
|
||||||
|
|
||||||
std::deque<OSDMessage> m_osd_messages;
|
std::deque<OSDMessage> m_osd_messages;
|
||||||
std::mutex m_osd_messages_lock;
|
std::mutex m_osd_messages_lock;
|
||||||
|
|
||||||
bool m_paused = false;
|
|
||||||
bool m_speed_limiter_temp_disabled = false;
|
|
||||||
bool m_speed_limiter_enabled = false;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "qtsettingsinterface.h"
|
#include "qtsettingsinterface.h"
|
||||||
#include "settingsdialog.h"
|
#include "settingsdialog.h"
|
||||||
#include <QtWidgets/QFileDialog>
|
#include <QtWidgets/QFileDialog>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
static constexpr char DISC_IMAGE_FILTER[] =
|
static constexpr char DISC_IMAGE_FILTER[] =
|
||||||
"All File Types (*.bin *.img *.cue *.exe *.psexe);;Single-Track Raw Images (*.bin *.img);;Cue Sheets "
|
"All File Types (*.bin *.img *.cue *.exe *.psexe);;Single-Track Raw Images (*.bin *.img);;Cue Sheets "
|
||||||
|
@ -124,6 +125,16 @@ void MainWindow::switchRenderer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onPerformanceCountersUpdated(float speed, float fps, float vps, float average_frame_time,
|
||||||
|
float worst_frame_time)
|
||||||
|
{
|
||||||
|
m_status_speed_widget->setText(QStringLiteral("%1%").arg(speed, 0, 'f', 0));
|
||||||
|
m_status_fps_widget->setText(
|
||||||
|
QStringLiteral("FPS: %1/%2").arg(std::round(fps), 0, 'f', 0).arg(std::round(vps), 0, 'f', 0));
|
||||||
|
m_status_frame_time_widget->setText(
|
||||||
|
QStringLiteral("%1ms average, %2ms worst").arg(average_frame_time, 0, 'f', 2).arg(worst_frame_time, 0, 'f', 2));
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::onStartDiscActionTriggered()
|
void MainWindow::onStartDiscActionTriggered()
|
||||||
{
|
{
|
||||||
QString filename =
|
QString filename =
|
||||||
|
@ -183,6 +194,21 @@ void MainWindow::setupAdditionalUi()
|
||||||
|
|
||||||
m_ui.mainContainer->setCurrentIndex(0);
|
m_ui.mainContainer->setCurrentIndex(0);
|
||||||
|
|
||||||
|
m_status_speed_widget = new QLabel(m_ui.statusBar);
|
||||||
|
m_status_speed_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
|
m_status_speed_widget->setFixedSize(40, 16);
|
||||||
|
m_status_speed_widget->hide();
|
||||||
|
|
||||||
|
m_status_fps_widget = new QLabel(m_ui.statusBar);
|
||||||
|
m_status_fps_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
|
m_status_fps_widget->setFixedSize(80, 16);
|
||||||
|
m_status_fps_widget->hide();
|
||||||
|
|
||||||
|
m_status_frame_time_widget = new QLabel(m_ui.statusBar);
|
||||||
|
m_status_frame_time_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
|
m_status_frame_time_widget->setFixedSize(190, 16);
|
||||||
|
m_status_frame_time_widget->hide();
|
||||||
|
|
||||||
for (u32 i = 0; i < static_cast<u32>(GPURenderer::Count); i++)
|
for (u32 i = 0; i < static_cast<u32>(GPURenderer::Count); i++)
|
||||||
{
|
{
|
||||||
const GPURenderer renderer = static_cast<GPURenderer>(i);
|
const GPURenderer renderer = static_cast<GPURenderer>(i);
|
||||||
|
@ -215,6 +241,27 @@ void MainWindow::updateEmulationActions(bool starting, bool running)
|
||||||
m_ui.actionSaveState->setDisabled(starting);
|
m_ui.actionSaveState->setDisabled(starting);
|
||||||
|
|
||||||
m_ui.actionFullscreen->setDisabled(starting || !running);
|
m_ui.actionFullscreen->setDisabled(starting || !running);
|
||||||
|
|
||||||
|
if (running && m_status_speed_widget->isHidden())
|
||||||
|
{
|
||||||
|
m_status_speed_widget->show();
|
||||||
|
m_status_fps_widget->show();
|
||||||
|
m_status_frame_time_widget->show();
|
||||||
|
m_ui.statusBar->addPermanentWidget(m_status_speed_widget);
|
||||||
|
m_ui.statusBar->addPermanentWidget(m_status_fps_widget);
|
||||||
|
m_ui.statusBar->addPermanentWidget(m_status_frame_time_widget);
|
||||||
|
}
|
||||||
|
else if (!running && m_status_speed_widget->isVisible())
|
||||||
|
{
|
||||||
|
m_ui.statusBar->removeWidget(m_status_speed_widget);
|
||||||
|
m_ui.statusBar->removeWidget(m_status_fps_widget);
|
||||||
|
m_ui.statusBar->removeWidget(m_status_frame_time_widget);
|
||||||
|
m_status_speed_widget->hide();
|
||||||
|
m_status_fps_widget->hide();
|
||||||
|
m_status_frame_time_widget->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ui.statusBar->clearMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::switchToGameListView()
|
void MainWindow::switchToGameListView()
|
||||||
|
@ -259,6 +306,8 @@ void MainWindow::connectSignals()
|
||||||
connect(m_host_interface, &QtHostInterface::emulationStopped, this, &MainWindow::onEmulationStopped);
|
connect(m_host_interface, &QtHostInterface::emulationStopped, this, &MainWindow::onEmulationStopped);
|
||||||
connect(m_host_interface, &QtHostInterface::emulationPaused, this, &MainWindow::onEmulationPaused);
|
connect(m_host_interface, &QtHostInterface::emulationPaused, this, &MainWindow::onEmulationPaused);
|
||||||
connect(m_host_interface, &QtHostInterface::toggleFullscreenRequested, this, &MainWindow::toggleFullscreen);
|
connect(m_host_interface, &QtHostInterface::toggleFullscreenRequested, this, &MainWindow::toggleFullscreen);
|
||||||
|
connect(m_host_interface, &QtHostInterface::performanceCountersUpdated, this,
|
||||||
|
&MainWindow::onPerformanceCountersUpdated);
|
||||||
|
|
||||||
connect(m_game_list_widget, &GameListWidget::bootEntryRequested, [this](const GameList::GameListEntry* entry) {
|
connect(m_game_list_widget, &GameListWidget::bootEntryRequested, [this](const GameList::GameListEntry* entry) {
|
||||||
// if we're not running, boot the system, otherwise swap discs
|
// if we're not running, boot the system, otherwise swap discs
|
||||||
|
@ -274,6 +323,15 @@ void MainWindow::connectSignals()
|
||||||
switchToEmulationView();
|
switchToEmulationView();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
connect(m_game_list_widget, &GameListWidget::entrySelected, [this](const GameList::GameListEntry* entry) {
|
||||||
|
if (!entry)
|
||||||
|
{
|
||||||
|
m_ui.statusBar->clearMessage();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ui.statusBar->showMessage(QString::fromStdString(entry->path));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::doSettings(SettingsDialog::Category category)
|
void MainWindow::doSettings(SettingsDialog::Category category)
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include "settingsdialog.h"
|
#include "settingsdialog.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
|
class QLabel;
|
||||||
|
|
||||||
class GameList;
|
class GameList;
|
||||||
class GameListWidget;
|
class GameListWidget;
|
||||||
class QtHostInterface;
|
class QtHostInterface;
|
||||||
|
@ -26,6 +28,8 @@ private Q_SLOTS:
|
||||||
void onEmulationPaused(bool paused);
|
void onEmulationPaused(bool paused);
|
||||||
void toggleFullscreen();
|
void toggleFullscreen();
|
||||||
void switchRenderer();
|
void switchRenderer();
|
||||||
|
void onPerformanceCountersUpdated(float speed, float fps, float vps, float average_frame_time,
|
||||||
|
float worst_frame_time);
|
||||||
|
|
||||||
void onStartDiscActionTriggered();
|
void onStartDiscActionTriggered();
|
||||||
void onChangeDiscActionTriggered();
|
void onChangeDiscActionTriggered();
|
||||||
|
@ -53,6 +57,10 @@ private:
|
||||||
GameListWidget* m_game_list_widget = nullptr;
|
GameListWidget* m_game_list_widget = nullptr;
|
||||||
QWidget* m_display_widget = nullptr;
|
QWidget* m_display_widget = nullptr;
|
||||||
|
|
||||||
|
QLabel* m_status_speed_widget = nullptr;
|
||||||
|
QLabel* m_status_fps_widget = nullptr;
|
||||||
|
QLabel* m_status_frame_time_widget = nullptr;
|
||||||
|
|
||||||
SettingsDialog* m_settings_dialog = nullptr;
|
SettingsDialog* m_settings_dialog = nullptr;
|
||||||
|
|
||||||
bool m_emulation_running = false;
|
bool m_emulation_running = false;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<string>DuckStation</string>
|
<string>DuckStation</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/duck.png</normaloff>:/icons/duck.png</iconset>
|
<normaloff>:/icons/duck.png</normaloff>:/icons/duck.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QStackedWidget" name="mainContainer">
|
<widget class="QStackedWidget" name="mainContainer">
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>754</width>
|
<width>754</width>
|
||||||
<height>21</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuSystem">
|
<widget class="QMenu" name="menuSystem">
|
||||||
|
@ -128,9 +128,10 @@
|
||||||
<addaction name="actionFullscreen"/>
|
<addaction name="actionFullscreen"/>
|
||||||
<addaction name="actionSettings"/>
|
<addaction name="actionSettings"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
<action name="actionStartDisc">
|
<action name="actionStartDisc">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/drive-optical.png</normaloff>:/icons/drive-optical.png</iconset>
|
<normaloff>:/icons/drive-optical.png</normaloff>:/icons/drive-optical.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -139,7 +140,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionStartBios">
|
<action name="actionStartBios">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/drive-removable-media.png</normaloff>:/icons/drive-removable-media.png</iconset>
|
<normaloff>:/icons/drive-removable-media.png</normaloff>:/icons/drive-removable-media.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -148,7 +149,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionPowerOff">
|
<action name="actionPowerOff">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/system-shutdown.png</normaloff>:/icons/system-shutdown.png</iconset>
|
<normaloff>:/icons/system-shutdown.png</normaloff>:/icons/system-shutdown.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -157,7 +158,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionReset">
|
<action name="actionReset">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/view-refresh.png</normaloff>:/icons/view-refresh.png</iconset>
|
<normaloff>:/icons/view-refresh.png</normaloff>:/icons/view-refresh.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -169,7 +170,7 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/media-playback-pause.png</normaloff>:/icons/media-playback-pause.png</iconset>
|
<normaloff>:/icons/media-playback-pause.png</normaloff>:/icons/media-playback-pause.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -178,7 +179,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionLoadState">
|
<action name="actionLoadState">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/document-open.png</normaloff>:/icons/document-open.png</iconset>
|
<normaloff>:/icons/document-open.png</normaloff>:/icons/document-open.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -187,7 +188,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionSaveState">
|
<action name="actionSaveState">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/document-save.png</normaloff>:/icons/document-save.png</iconset>
|
<normaloff>:/icons/document-save.png</normaloff>:/icons/document-save.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -201,7 +202,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionConsoleSettings">
|
<action name="actionConsoleSettings">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/utilities-system-monitor.png</normaloff>:/icons/utilities-system-monitor.png</iconset>
|
<normaloff>:/icons/utilities-system-monitor.png</normaloff>:/icons/utilities-system-monitor.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -210,7 +211,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionPortSettings">
|
<action name="actionPortSettings">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/input-gaming.png</normaloff>:/icons/input-gaming.png</iconset>
|
<normaloff>:/icons/input-gaming.png</normaloff>:/icons/input-gaming.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -219,7 +220,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionHotkeySettings">
|
<action name="actionHotkeySettings">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/applications-other.png</normaloff>:/icons/applications-other.png</iconset>
|
<normaloff>:/icons/applications-other.png</normaloff>:/icons/applications-other.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -228,7 +229,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionGPUSettings">
|
<action name="actionGPUSettings">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/video-display.png</normaloff>:/icons/video-display.png</iconset>
|
<normaloff>:/icons/video-display.png</normaloff>:/icons/video-display.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -237,7 +238,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionFullscreen">
|
<action name="actionFullscreen">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/view-fullscreen.png</normaloff>:/icons/view-fullscreen.png</iconset>
|
<normaloff>:/icons/view-fullscreen.png</normaloff>:/icons/view-fullscreen.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -290,7 +291,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionChangeDisc">
|
<action name="actionChangeDisc">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/media-optical.png</normaloff>:/icons/media-optical.png</iconset>
|
<normaloff>:/icons/media-optical.png</normaloff>:/icons/media-optical.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -299,7 +300,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionAudioSettings">
|
<action name="actionAudioSettings">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/audio-card.png</normaloff>:/icons/audio-card.png</iconset>
|
<normaloff>:/icons/audio-card.png</normaloff>:/icons/audio-card.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -308,7 +309,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionGameListSettings">
|
<action name="actionGameListSettings">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/folder-open.png</normaloff>:/icons/folder-open.png</iconset>
|
<normaloff>:/icons/folder-open.png</normaloff>:/icons/folder-open.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -317,7 +318,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionOpenDirectory">
|
<action name="actionOpenDirectory">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/edit-find.png</normaloff>:/icons/edit-find.png</iconset>
|
<normaloff>:/icons/edit-find.png</normaloff>:/icons/edit-find.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -326,7 +327,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionSettings">
|
<action name="actionSettings">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/applications-system.png</normaloff>:/icons/applications-system.png</iconset>
|
<normaloff>:/icons/applications-system.png</normaloff>:/icons/applications-system.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -335,7 +336,7 @@
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="icons.qrc"/>
|
<include location="resources/icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -185,6 +185,13 @@ void QtHostInterface::onDisplayWindowResized(int width, int height)
|
||||||
m_display_window->onWindowResized(width, height);
|
m_display_window->onWindowResized(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtHostInterface::OnPerformanceCountersUpdated()
|
||||||
|
{
|
||||||
|
HostInterface::OnPerformanceCountersUpdated();
|
||||||
|
|
||||||
|
emit performanceCountersUpdated(m_speed, m_fps, m_vps, m_average_frame_time, m_worst_frame_time);
|
||||||
|
}
|
||||||
|
|
||||||
void QtHostInterface::updateInputMap()
|
void QtHostInterface::updateInputMap()
|
||||||
{
|
{
|
||||||
if (!isOnWorkerThread())
|
if (!isOnWorkerThread())
|
||||||
|
@ -508,8 +515,7 @@ void QtHostInterface::threadEntryPoint()
|
||||||
|
|
||||||
// execute the system, polling events inbetween frames
|
// execute the system, polling events inbetween frames
|
||||||
// simulate the system if not paused
|
// simulate the system if not paused
|
||||||
if (m_system && !m_paused)
|
RunFrame();
|
||||||
m_system->RunFrame();
|
|
||||||
|
|
||||||
// rendering
|
// rendering
|
||||||
{
|
{
|
||||||
|
@ -519,7 +525,6 @@ void QtHostInterface::threadEntryPoint()
|
||||||
m_system->GetGPU()->ResetGraphicsAPIState();
|
m_system->GetGPU()->ResetGraphicsAPIState();
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawFPSWindow();
|
|
||||||
DrawOSDMessages();
|
DrawOSDMessages();
|
||||||
|
|
||||||
m_display->Render();
|
m_display->Render();
|
||||||
|
@ -531,8 +536,6 @@ void QtHostInterface::threadEntryPoint()
|
||||||
if (m_speed_limiter_enabled)
|
if (m_speed_limiter_enabled)
|
||||||
Throttle();
|
Throttle();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdatePerformanceCounters();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_worker_thread_event_loop->processEvents(QEventLoop::AllEvents);
|
m_worker_thread_event_loop->processEvents(QEventLoop::AllEvents);
|
||||||
|
|
|
@ -71,6 +71,7 @@ Q_SIGNALS:
|
||||||
void gameListRefreshed();
|
void gameListRefreshed();
|
||||||
void toggleFullscreenRequested();
|
void toggleFullscreenRequested();
|
||||||
void switchRendererRequested();
|
void switchRendererRequested();
|
||||||
|
void performanceCountersUpdated(float speed, float fps, float vps, float avg_frame_time, float worst_frame_time);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void powerOffSystem();
|
void powerOffSystem();
|
||||||
|
@ -87,6 +88,9 @@ private Q_SLOTS:
|
||||||
void doHandleKeyEvent(int key, bool pressed);
|
void doHandleKeyEvent(int key, bool pressed);
|
||||||
void onDisplayWindowResized(int width, int height);
|
void onDisplayWindowResized(int width, int height);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void OnPerformanceCountersUpdated() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using InputButtonHandler = std::function<void(bool)>;
|
using InputButtonHandler = std::function<void(bool)>;
|
||||||
|
|
||||||
|
|
|
@ -1614,7 +1614,7 @@ void SDLHostInterface::Run()
|
||||||
|
|
||||||
if (m_system && !m_paused)
|
if (m_system && !m_paused)
|
||||||
{
|
{
|
||||||
m_system->RunFrame();
|
RunFrame();
|
||||||
if (m_frame_step_request)
|
if (m_frame_step_request)
|
||||||
{
|
{
|
||||||
m_frame_step_request = false;
|
m_frame_step_request = false;
|
||||||
|
@ -1644,8 +1644,6 @@ void SDLHostInterface::Run()
|
||||||
Throttle();
|
Throttle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdatePerformanceCounters();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save state on exit so it can be resumed
|
// Save state on exit so it can be resumed
|
||||||
|
|
Loading…
Reference in a new issue