From c5709f71b3ef35b486c0908f20653a77355cce81 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Wed, 30 May 2018 12:43:18 +0200 Subject: [PATCH] Qt: Add performance overlay options to the emu tab in the settings dialog --- rpcs3/Emu/System.h | 2 +- rpcs3/Json/tooltips.json | 6 ++ rpcs3/rpcs3qt/emu_settings.h | 14 +++- rpcs3/rpcs3qt/settings_dialog.cpp | 41 ++++++++++- rpcs3/rpcs3qt/settings_dialog.ui | 113 +++++++++++++++++++++++++----- 5 files changed, 154 insertions(+), 22 deletions(-) diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index b831d9ce96..90cefa3bff 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -403,7 +403,7 @@ struct cfg_root : cfg::node struct node_perf_overlay : cfg::node { - node_perf_overlay(cfg::node* _this) : cfg::node(_this, "Perfomance Overlay") {} + node_perf_overlay(cfg::node* _this) : cfg::node(_this, "Performance Overlay") {} cfg::_bool perf_overlay_enabled{this, "Enabled", false}; cfg::_enum level{this, "Detail level", detail_level::high}; diff --git a/rpcs3/Json/tooltips.json b/rpcs3/Json/tooltips.json index c3631deae7..199b97db7b 100644 --- a/rpcs3/Json/tooltips.json +++ b/rpcs3/Json/tooltips.json @@ -63,6 +63,12 @@ "maxLLVMThreads": "Limits the maximum number of threads used for PPU Module compilation.\nLower this in order to increase performance of other open applications.\nThe default uses all available threads.", "showShaderCompilationHint": "Show shader compilation hints using the native overlay.", "useNativeInterface": "Enables use of native HUD within the game window that can interact with game controllers.\nWhen disabled, regular Qt dialogs are used instead.\nCurrently, only the English language is supported." + }, + "overlay": { + "perfOverlayEnabled": "Enables or disables the performance overlay.", + "perfOverlayDetailLevel": "Controls the amount of information displayed on the performance overlay.", + "perfOverlayUpdateInterval": "Sets the time interval in which the performance overlay is being updated (measured in milliseconds).", + "perfOverlayFontSize": "Sets the font size of the performance overlay (measured in pixels)." } }, "gpu": { diff --git a/rpcs3/rpcs3qt/emu_settings.h b/rpcs3/rpcs3qt/emu_settings.h index 3bea8e016a..b9031e8811 100644 --- a/rpcs3/rpcs3qt/emu_settings.h +++ b/rpcs3/rpcs3qt/emu_settings.h @@ -68,6 +68,12 @@ public: DisableOnDiskShaderCache, DisableVulkanMemAllocator, + // Performance Overlay + PerfOverlayEnabled, + PerfOverlayDetailLevel, + PerfOverlayUpdateInterval, + PerfOverlayFontSize, + // Audio AudioRenderer, DumpToFile, @@ -223,13 +229,19 @@ private: { DisableFIFOReordering, { "Video", "Disable FIFO Reordering" }}, { ForceCPUBlitEmulation, { "Video", "Force CPU Blit" }}, { DisableOnDiskShaderCache, { "Video", "Disable On-Disk Shader Cache"}}, - { DisableVulkanMemAllocator, { "Video", "Disable Vulkan Memory Allocator" }}, + { DisableVulkanMemAllocator,{ "Video", "Disable Vulkan Memory Allocator" }}, { AnisotropicFilterOverride,{ "Video", "Anisotropic Filter Override" }}, { ResolutionScale, { "Video", "Resolution Scale" }}, { MinimumScalableDimension, { "Video", "Minimum Scalable Dimension" }}, { D3D12Adapter, { "Video", "D3D12", "Adapter"}}, { VulkanAdapter, { "Video", "Vulkan", "Adapter"}}, + // Performance Overlay + { PerfOverlayEnabled, { "Video", "Performance Overlay", "Enabled" } }, + { PerfOverlayDetailLevel, { "Video", "Performance Overlay", "Detail level" } }, + { PerfOverlayUpdateInterval,{ "Video", "Performance Overlay", "Metrics update interval (ms)" } }, + { PerfOverlayFontSize, { "Video", "Performance Overlay", "Font size (px)" } }, + // Audio { AudioRenderer, { "Audio", "Renderer"}}, { DumpToFile, { "Audio", "Dump to file"}}, diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index 7ea8b7169f..c4029a128a 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -80,8 +80,9 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: QJsonObject json_sys = json_obj.value("system").toObject(); QJsonObject json_net = json_obj.value("network").toObject(); - QJsonObject json_emu = json_obj.value("emulator").toObject(); - QJsonObject json_emu_misc = json_emu.value("misc").toObject(); + QJsonObject json_emu = json_obj.value("emulator").toObject(); + QJsonObject json_emu_misc = json_emu.value("misc").toObject(); + QJsonObject json_emu_overlay = json_emu.value("overlay").toObject(); QJsonObject json_gui = json_obj.value("gui").toObject(); @@ -699,6 +700,9 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: SubscribeTooltip(ui->maxLLVMThreads, json_emu_misc["maxLLVMThreads"].toString()); ui->maxLLVMThreads->setItemText(ui->maxLLVMThreads->findData("0"), tr("All (%1)").arg(std::thread::hardware_concurrency())); + xemu_settings->EnhanceComboBox(ui->perfOverlayDetailLevel, emu_settings::PerfOverlayDetailLevel); + SubscribeTooltip(ui->perfOverlayDetailLevel, json_emu_overlay["perfOverlayDetailLevel"].toString()); + // Checkboxes SubscribeTooltip(ui->gs_resizeOnBoot, json_emu_misc["gs_resizeOnBoot"].toString()); @@ -726,6 +730,39 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: xemu_settings->EnhanceCheckBox(ui->showShaderCompilationHint, emu_settings::ShowShaderCompilationHint); SubscribeTooltip(ui->showShaderCompilationHint, json_emu_misc["showShaderCompilationHint"].toString()); + xemu_settings->EnhanceCheckBox(ui->perfOverlayEnabled, emu_settings::PerfOverlayEnabled); + SubscribeTooltip(ui->perfOverlayEnabled, json_emu_overlay["perfOverlayEnabled"].toString()); + auto EnablePerfOverlayOptions = [this](bool enabled) + { + ui->label_detail_level->setEnabled(enabled); + ui->label_update_interval->setEnabled(enabled); + ui->label_font_size->setEnabled(enabled); + ui->perfOverlayDetailLevel->setEnabled(enabled); + ui->perfOverlayUpdateInterval->setEnabled(enabled); + ui->perfOverlayFontSize->setEnabled(enabled); + }; + EnablePerfOverlayOptions(ui->perfOverlayEnabled->isChecked()); + connect(ui->perfOverlayEnabled, &QCheckBox::clicked, EnablePerfOverlayOptions); + + // Sliders + + xemu_settings->EnhanceSlider(ui->perfOverlayUpdateInterval, emu_settings::PerfOverlayUpdateInterval, true); + SubscribeTooltip(ui->perfOverlayUpdateInterval, json_emu_overlay["perfOverlayUpdateInterval"].toString()); + ui->label_update_interval->setText(tr("Update Interval: %0 ms").arg(ui->perfOverlayUpdateInterval->value())); + connect(ui->perfOverlayUpdateInterval, &QSlider::valueChanged, [this](int value) + { + ui->label_update_interval->setText(tr("Update Interval: %0 ms").arg(value)); + }); + + xemu_settings->EnhanceSlider(ui->perfOverlayFontSize, emu_settings::PerfOverlayFontSize, true); + SubscribeTooltip(ui->perfOverlayFontSize, json_emu_overlay["perfOverlayFontSize"].toString()); + ui->label_font_size->setText(tr("Font Size: %0 px").arg(ui->perfOverlayFontSize->value())); + connect(ui->perfOverlayFontSize, &QSlider::valueChanged, [this](int value) + { + ui->label_font_size->setText(tr("Font Size: %0 px").arg(value)); + }); + + // Global settings (gui_settings) if (!game) { ui->gs_disableMouse->setChecked(xgui_settings->GetValue(gui::gs_disableMouse).toBool()); diff --git a/rpcs3/rpcs3qt/settings_dialog.ui b/rpcs3/rpcs3qt/settings_dialog.ui index 2a5da0ee63..98068eaab2 100644 --- a/rpcs3/rpcs3qt/settings_dialog.ui +++ b/rpcs3/rpcs3qt/settings_dialog.ui @@ -36,7 +36,7 @@ - 7 + 6 @@ -1401,29 +1401,106 @@ + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 0 + 0 + + + + - - - - Qt::Vertical - - - QSizePolicy::MinimumExpanding - - - - 0 - 0 - - - - - + + + + + Performance Overlay + + + + + + Enable performance overlay + + + + + + + Detail Level: + + + + + + + + + + Update Interval: + + + + + + + 10 + + + 100 + + + Qt::Horizontal + + + + + + + Font Size: + + + + + + + Qt::Horizontal + + + + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 0 + 55 + + + + + + + +