config: Add present mode option. (#3502)

* config: Add present mode option.

* settings_dialog: Add details for present modes.
This commit is contained in:
squidbus
2025-09-01 16:42:31 -07:00
committed by GitHub
parent f09c0e5a28
commit 9246b4277b
6 changed files with 101 additions and 15 deletions

View File

@@ -67,6 +67,7 @@ const QVector<int> languageIndexes = {21, 23, 14, 6, 18, 1, 12, 22, 2, 4, 25, 2
QMap<QString, QString> channelMap;
QMap<QString, QString> logTypeMap;
QMap<QString, QString> screenModeMap;
QMap<QString, QString> presentModeMap;
QMap<QString, QString> chooseHomeTabMap;
QMap<QString, QString> micMap;
@@ -93,6 +94,9 @@ SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
screenModeMap = {{tr("Fullscreen (Borderless)"), "Fullscreen (Borderless)"},
{tr("Windowed"), "Windowed"},
{tr("Fullscreen"), "Fullscreen"}};
presentModeMap = {{tr("Mailbox (Vsync)"), "Mailbox"},
{tr("Fifo (Vsync)"), "Fifo"},
{tr("Immediate (No Vsync)"), "Immediate"}};
chooseHomeTabMap = {{tr("General"), "General"}, {tr("GUI"), "GUI"},
{tr("Graphics"), "Graphics"}, {tr("User"), "User"},
{tr("Input"), "Input"}, {tr("Paths"), "Paths"},
@@ -414,6 +418,7 @@ SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
// Graphics
ui->graphicsAdapterGroupBox->installEventFilter(this);
ui->windowSizeGroupBox->installEventFilter(this);
ui->presentModeGroupBox->installEventFilter(this);
ui->heightDivider->installEventFilter(this);
ui->dumpShadersCheckBox->installEventFilter(this);
ui->nullGpuCheckBox->installEventFilter(this);
@@ -540,6 +545,9 @@ void SettingsDialog::LoadValuesFromConfig() {
QString translatedText_FullscreenMode =
screenModeMap.key(QString::fromStdString(Config::getFullscreenMode()));
ui->displayModeComboBox->setCurrentText(translatedText_FullscreenMode);
QString translatedText_PresentMode =
presentModeMap.key(QString::fromStdString(Config::getPresentMode()));
ui->presentModeComboBox->setCurrentText(translatedText_PresentMode);
ui->gameSizeCheckBox->setChecked(toml::find_or<bool>(data, "GUI", "loadGameSizeEnabled", true));
ui->showSplashCheckBox->setChecked(toml::find_or<bool>(data, "General", "showSplash", false));
QString translatedText_logType = logTypeMap.key(QString::fromStdString(Config::getLogType()));
@@ -746,6 +754,11 @@ void SettingsDialog::updateNoteTextEdit(const QString& elementName) {
// Graphics
if (elementName == "graphicsAdapterGroupBox") {
text = tr("Graphics Device:\\nOn multiple GPU systems, select the GPU the emulator will use from the drop down list,\\nor select \"Auto Select\" to automatically determine it.");
} else if (elementName == "presentModeGroupBox") {
text = tr("Present Mode:\\nConfigures how video output will be presented to your screen.\\n\\n"
"Mailbox: Frames synchronize with your screen's refresh rate. New frames will replace any pending frames. Reduces latency but may skip frames if running behind.\\n"
"Fifo: Frames synchronize with your screen's refresh rate. New frames will be queued behind pending frames. Ensures all frames are presented but may increase latency.\\n"
"Immediate: Frames immediately present to your screen when ready. May result in tearing.");
} else if (elementName == "windowSizeGroupBox") {
text = tr("Width/Height:\\nSets the size of the emulator window at launch, which can be resized during gameplay.\\nThis is different from the in-game resolution.");
} else if (elementName == "heightDivider") {
@@ -834,6 +847,8 @@ void SettingsDialog::UpdateSettings() {
"Windowed");
Config::setFullscreenMode(
screenModeMap.value(ui->displayModeComboBox->currentText()).toStdString());
Config::setPresentMode(
presentModeMap.value(ui->presentModeComboBox->currentText()).toStdString());
Config::setIsMotionControlsEnabled(ui->motionControlsCheckBox->isChecked());
Config::setBackgroundControllerInput(ui->backgroundControllerCheckBox->isChecked());
Config::setisTrophyPopupDisabled(ui->disableTrophycheckBox->isChecked());

View File

@@ -1096,6 +1096,40 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="presentModeGroupBox">
<property name="title">
<string>Present Mode</string>
</property>
<layout class="QVBoxLayout" name="presentModeLayout">
<item>
<widget class="QComboBox" name="presentModeComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Mailbox (Vsync)</string>
</property>
</item>
<item>
<property name="text">
<string>Fifo (Vsync)</string>
</property>
</item>
<item>
<property name="text">
<string>Immediate (No Vsync)</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="windowSizeLayout">
<item>