Skip to content

Commit

Permalink
Qt: Move some settings around, add OSD options
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Oct 13, 2022
1 parent 5498ddf commit 1538f26
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 54 deletions.
3 changes: 0 additions & 3 deletions src/duckstation-qt/advancedsettingswidget.cpp
Expand Up @@ -221,8 +221,6 @@ void AdvancedSettingsWidget::addTweakOptions()
{
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Disable All Enhancements"), "Main",
"DisableAllEnhancements", false);
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Show Enhancement Settings"), "Display", "ShowEnhancements",
false);
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Show Status Indicators"), "Display",
"ShowStatusIndicators", true);
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Apply Compatibility Settings"), "Main",
Expand Down Expand Up @@ -301,7 +299,6 @@ void AdvancedSettingsWidget::onResetToDefaultClicked()
int i = 0;

setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Disable all enhancements
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Show enhancement settings
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Show status indicators
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Apply compatibility settings
setIntRangeTweakOption(m_ui.tweakOptionTable, i++, 0); // Display FPS limit
Expand Down
35 changes: 12 additions & 23 deletions src/duckstation-qt/displaysettingswidget.cpp
Expand Up @@ -45,16 +45,16 @@ DisplaySettingsWidget::DisplaySettingsWidget(SettingsDialog* dialog, QWidget* pa
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.internalResolutionScreenshots, "Display",
"InternalResolutionScreenshots", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.vsync, "Display", "VSync", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.displayAllFrames, "Display", "DisplayAllFrames", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.gpuThread, "GPU", "UseThread", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.threadedPresentation, "GPU", "ThreadedPresentation", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.syncToHostRefreshRate, "Main", "SyncToHostRefreshRate", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showOSDMessages, "Display", "ShowOSDMessages", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showFPS, "Display", "ShowFPS", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showSpeed, "Display", "ShowSpeed", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showResolution, "Display", "ShowResolution", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showCPU, "Display", "ShowCPU", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showGPU, "Display", "ShowGPU", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showInput, "Display", "ShowInputs", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showSettings, "Display", "ShowEnhancements", false);

connect(m_ui.renderer, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&DisplaySettingsWidget::populateGPUAdaptersAndResolutions);
Expand Down Expand Up @@ -119,23 +119,12 @@ DisplaySettingsWidget::DisplaySettingsWidget(SettingsDialog* dialog, QWidget* pa
m_ui.vsync, tr("VSync"), tr("Checked"),
tr("Enable this option to match DuckStation's refresh rate with your current monitor or screen. "
"VSync is automatically disabled when it is not possible (e.g. running at non-100% speed)."));
dialog->registerWidgetHelp(m_ui.displayAllFrames, tr("Optimal Frame Pacing"), tr("Unchecked"),
tr("Enable this option will ensure every frame the console renders is displayed to the "
"screen, for optimal frame pacing. If you are having difficulties maintaining full "
"speed, or are getting audio glitches, try disabling this option."));
dialog->registerWidgetHelp(m_ui.threadedPresentation, tr("Threaded Presentation"), tr("Checked"),
tr("Presents frames on a background thread when fast forwarding or vsync is disabled. "
"This can measurably improve performance in the Vulkan renderer."));
dialog->registerWidgetHelp(m_ui.gpuThread, tr("Threaded Rendering"), tr("Checked"),
tr("Uses a second thread for drawing graphics. Currently only available for the software "
"renderer, but can provide a significant speed improvement, and is safe to use."));
dialog->registerWidgetHelp(
m_ui.syncToHostRefreshRate, tr("Sync To Host Refresh Rate"), tr("Unchecked"),
tr("Adjusts the emulation speed so the console's refresh rate matches the host's refresh rate when both VSync and "
"Audio Resampling settings are enabled. This results in the smoothest animations possible, at the cost of "
"potentially increasing the emulation speed by less than 1%. Sync To Host Refresh Rate will not take effect if "
"the console's refresh rate is too far from the host's refresh rate. Users with variable refresh rate displays "
"should disable this option."));
dialog->registerWidgetHelp(m_ui.showOSDMessages, tr("Show OSD Messages"), tr("Checked"),
tr("Shows on-screen-display messages when events occur such as save states being "
"created/loaded, screenshots being taken, etc."));
Expand All @@ -148,21 +137,21 @@ DisplaySettingsWidget::DisplaySettingsWidget(SettingsDialog* dialog, QWidget* pa
tr("Shows the resolution of the game in the top-right corner of the display."));
dialog->registerWidgetHelp(
m_ui.showCPU, tr("Show CPU Usage"), tr("Unchecked"),
tr("Shows the host's CPU usage based on threads in the top-right corner of the display. This does not display the emulated system CPU's usage. If a value close to 100% is being displayed, this means your host's CPU is likely the bottleneck. In this case, you should reduce enhancement-related settings such as overclocking."));
tr("Shows the host's CPU usage based on threads in the top-right corner of the display. This does not display the "
"emulated system CPU's usage. If a value close to 100% is being displayed, this means your host's CPU is likely "
"the bottleneck. In this case, you should reduce enhancement-related settings such as overclocking."));
dialog->registerWidgetHelp(
m_ui.showInput, tr("Show Controller Input"), tr("Unchecked"),
tr("Shows the current controller state of the system in the bottom-left corner of the display."));

#ifdef _WIN32
{
QCheckBox* cb = new QCheckBox(tr("Use Blit Swap Chain"), m_ui.basicGroupBox);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, cb, "Display", "UseBlitSwapChain", false);
m_ui.basicCheckboxGridLayout->addWidget(cb, 2, 1, 1, 1);
dialog->registerWidgetHelp(cb, tr("Use Blit Swap Chain"), tr("Unchecked"),
tr("Uses a blit presentation model instead of flipping when using the Direct3D 11 "
"renderer. This usually results in slower performance, but may be required for some "
"streaming applications, or to uncap framerates on some systems."));
}
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.blitSwapChain, "Display", "UseBlitSwapChain", false);
dialog->registerWidgetHelp(m_ui.blitSwapChain, tr("Use Blit Swap Chain"), tr("Unchecked"),
tr("Uses a blit presentation model instead of flipping when using the Direct3D 11 "
"renderer. This usually results in slower performance, but may be required for some "
"streaming applications, or to uncap framerates on some systems."));
#else
m_ui.blitSwapChain->setEnabled(false);
#endif
}

Expand Down
63 changes: 35 additions & 28 deletions src/duckstation-qt/displaysettingswidget.ui
Expand Up @@ -64,6 +64,13 @@
</item>
<item row="3" column="0" colspan="2">
<layout class="QGridLayout" name="basicCheckboxGridLayout">
<item row="1" column="0">
<widget class="QCheckBox" name="vsync">
<property name="text">
<string>VSync</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="gpuThread">
<property name="text">
Expand All @@ -78,24 +85,10 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="vsync">
<property name="text">
<string>VSync</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="syncToHostRefreshRate">
<property name="text">
<string>Sync To Host Refresh Rate</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="displayAllFrames">
<widget class="QCheckBox" name="blitSwapChain">
<property name="text">
<string>Optimal Frame Pacing</string>
<string>Use Blit Swap Chain</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -212,17 +205,24 @@
<string>On-Screen Display</string>
</property>
<layout class="QGridLayout" name="formLayout_5">
<item row="2" column="0">
<widget class="QCheckBox" name="showOSDMessages">
<item row="3" column="0">
<widget class="QCheckBox" name="showSpeed">
<property name="text">
<string>Show OSD Messages</string>
<string>Show Emulation Speed</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="showSpeed">
<item row="4" column="0">
<widget class="QCheckBox" name="showCPU">
<property name="text">
<string>Show Emulation Speed</string>
<string>Show CPU Usage</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="showOSDMessages">
<property name="text">
<string>Show OSD Messages</string>
</property>
</widget>
</item>
Expand All @@ -233,24 +233,31 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="showInput">
<property name="text">
<string>Show Controller Input</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="showResolution">
<property name="text">
<string>Show Resolution</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="showCPU">
<item row="5" column="0">
<widget class="QCheckBox" name="showGPU">
<property name="text">
<string>Show CPU Usage</string>
<string>Show GPU Usage</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="showInput">
<item row="5" column="1">
<widget class="QCheckBox" name="showSettings">
<property name="text">
<string>Show Controller Input</string>
<string>Show Settings Overlay</string>
</property>
</widget>
</item>
Expand Down
13 changes: 13 additions & 0 deletions src/duckstation-qt/emulationsettingswidget.cpp
Expand Up @@ -14,6 +14,8 @@ EmulationSettingsWidget::EmulationSettingsWidget(SettingsDialog* dialog, QWidget

m_ui.setupUi(this);

SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.syncToHostRefreshRate, "Main", "SyncToHostRefreshRate", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.displayAllFrames, "Display", "DisplayAllFrames", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.rewindEnable, "Main", "RewindEnable", false);
SettingWidgetBinder::BindWidgetToFloatSetting(sif, m_ui.rewindSaveFrequency, "Main", "RewindFrequency", 10.0f);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.rewindSaveSlots, "Main", "RewindSaveSlots", 10);
Expand Down Expand Up @@ -83,6 +85,17 @@ EmulationSettingsWidget::EmulationSettingsWidget(SettingsDialog* dialog, QWidget
m_ui.turboSpeed, tr("Turbo Speed"), tr("User Preference"),
tr("Sets the turbo speed. This speed will be used when the turbo hotkey is pressed/toggled. Turboing will take "
"priority over fast forwarding if both hotkeys are pressed/toggled."));
dialog->registerWidgetHelp(
m_ui.syncToHostRefreshRate, tr("Sync To Host Refresh Rate"), tr("Unchecked"),
tr("Adjusts the emulation speed so the console's refresh rate matches the host's refresh rate when both VSync and "
"Audio Resampling settings are enabled. This results in the smoothest animations possible, at the cost of "
"potentially increasing the emulation speed by less than 1%. Sync To Host Refresh Rate will not take effect if "
"the console's refresh rate is too far from the host's refresh rate. Users with variable refresh rate displays "
"should disable this option."));
dialog->registerWidgetHelp(m_ui.displayAllFrames, tr("Optimal Frame Pacing"), tr("Unchecked"),
tr("Enable this option will ensure every frame the console renders is displayed to the "
"screen, for optimal frame pacing. If you are having difficulties maintaining full "
"speed, or are getting audio glitches, try disabling this option."));
dialog->registerWidgetHelp(
m_ui.rewindEnable, tr("Rewinding"), tr("Unchecked"),
tr("<b>Enable Rewinding:</b> Saves state periodically so you can rewind any mistakes while playing.<br> "
Expand Down
18 changes: 18 additions & 0 deletions src/duckstation-qt/emulationsettingswidget.ui
Expand Up @@ -62,6 +62,24 @@
<item row="2" column="1">
<widget class="QComboBox" name="turboSpeed"/>
</item>
<item row="3" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QCheckBox" name="syncToHostRefreshRate">
<property name="text">
<string>Sync To Host Refresh Rate</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="displayAllFrames">
<property name="text">
<string>Optimal Frame Pacing</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
Expand Down

0 comments on commit 1538f26

Please sign in to comment.