diff --git a/src/common/config.cpp b/src/common/config.cpp index 77ff08567..74c2816f3 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -100,6 +100,12 @@ public: void setTomlValue(toml::ordered_value& data, const std::string& header, const std::string& key, bool is_game_specific = false) { if (is_game_specific) { + if (game_specific_value == std::nullopt) { + fmt::print("Attempted to save std::nullopt value to {}-{}, matching config entry " + "may not be correctly set-up\n", + header, key); + return; + } data[header][key] = game_specific_value.value_or(base_value); game_specific_value = std::nullopt; } else { @@ -1110,6 +1116,8 @@ void setDefaultValues(bool is_game_specific) { // Entries with game-specific settings that are in the game-specific setings GUI but not in // the global settings GUI if (is_game_specific) { + readbacksEnabled.set(false, is_game_specific); + readbackLinearImagesEnabled.set(false, is_game_specific); isNeo.set(false, is_game_specific); isDevKit.set(false, is_game_specific); isPSNSignedIn.set(false, is_game_specific); @@ -1141,8 +1149,6 @@ void setDefaultValues(bool is_game_specific) { windowHeight.set(720, is_game_specific); isNullGpu.set(false, is_game_specific); shouldCopyGPUBuffers.set(false, is_game_specific); - readbacksEnabled.set(false, is_game_specific); - readbackLinearImagesEnabled.set(false, is_game_specific); shouldDumpShaders.set(false, is_game_specific); vblankFrequency.set(60, is_game_specific); isFullscreen.set(false, is_game_specific); diff --git a/src/qt_gui/settings_dialog.cpp b/src/qt_gui/settings_dialog.cpp index 62e5be691..531dd927e 100644 --- a/src/qt_gui/settings_dialog.cpp +++ b/src/qt_gui/settings_dialog.cpp @@ -94,25 +94,18 @@ SettingsDialog::SettingsDialog(std::shared_ptr gui_settings, ui->logFilterLineEdit->setClearButtonEnabled(true); if (game_specific) { + // Paths tab ui->tabWidgetSettings->setTabVisible(5, false); ui->chooseHomeTabComboBox->removeItem(5); - ui->label_Trophy->setVisible(false); - ui->trophyKeyLineEdit->setVisible(false); - ui->CompatgroupBox->setVisible(false); - ui->gameSizeCheckBox->setVisible(false); - ui->GUIBackgroundImageGroupBox->setVisible(false); - ui->GUIMusicGroupBox->setVisible(false); - ui->gameSizeCheckBox->setVisible(false); - ui->updaterGroupBox->setVisible(false); - ui->discordRPCCheckbox->setVisible(false); - ui->emulatorLanguageGroupBox->setVisible(false); + // Frontend tab + ui->tabWidgetSettings->setTabVisible(1, false); + ui->chooseHomeTabComboBox->removeItem(1); + } else { - ui->dmaCheckBox->setVisible(false); - ui->devkitCheckBox->setVisible(false); - ui->neoCheckBox->setVisible(false); - ui->networkConnectedCheckBox->setVisible(false); - ui->psnSignInCheckBox->setVisible(false); + // Experimental tab + ui->tabWidgetSettings->setTabVisible(8, false); + ui->chooseHomeTabComboBox->removeItem(8); } std::filesystem::path config_file = @@ -130,10 +123,15 @@ SettingsDialog::SettingsDialog(std::shared_ptr gui_settings, 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"}, - {tr("Log"), "Log"}, {tr("Debug"), "Debug"}}; + chooseHomeTabMap = {{tr("General"), "General"}, + {tr("Frontend"), "Frontend"}, + {tr("Graphics"), "Graphics"}, + {tr("User"), "User"}, + {tr("Input"), "Input"}, + {tr("Paths"), "Paths"}, + {tr("Log"), "Log"}, + {tr("Debug"), "Debug"}, + {tr("Experimental"), "Experimental"}}; micMap = {{tr("None"), "None"}, {tr("Default Device"), "Default Device"}}; if (m_physical_devices.empty()) { @@ -646,6 +644,9 @@ void SettingsDialog::LoadValuesFromConfig() { ui->micComboBox->setCurrentIndex(0); } + ui->readbacksCheckBox->setChecked(toml::find_or(data, "GPU", "readbacks", false)); + ui->readbackLinearImagesCheckBox->setChecked( + toml::find_or(data, "GPU", "readbackLinearImages", false)); ui->dmaCheckBox->setChecked(toml::find_or(data, "GPU", "directMemoryAccess", false)); ui->neoCheckBox->setChecked(toml::find_or(data, "General", "isPS4Pro", false)); ui->devkitCheckBox->setChecked(toml::find_or(data, "General", "isDevKit", false)); @@ -725,10 +726,7 @@ void SettingsDialog::LoadValuesFromConfig() { toml::find_or(data, "GPU", "copyGPUBuffers", false)); ui->collectShaderCheckBox->setChecked( toml::find_or(data, "Debug", "CollectShader", false)); - ui->readbacksCheckBox->setChecked(toml::find_or(data, "GPU", "readbacks", false)); ui->enableLoggingCheckBox->setChecked(toml::find_or(data, "Debug", "logEnabled", true)); - ui->readbackLinearImagesCheckBox->setChecked( - toml::find_or(data, "GPU", "readbackLinearImages", false)); std::string chooseHomeTab = toml::find_or(data, "General", "chooseHomeTab", "General"); @@ -981,17 +979,15 @@ bool SettingsDialog::eventFilter(QObject* obj, QEvent* event) { } void SettingsDialog::UpdateSettings(bool game_specific) { - // Entries that are only in the game-specific gui - - if (game_specific) { - Config::setDirectMemoryAccess(ui->dmaCheckBox->isChecked(), true); - Config::setDevKitConsole(ui->devkitCheckBox->isChecked(), true); - Config::setNeoMode(ui->neoCheckBox->isChecked(), true); - Config::setConnectedToNetwork(ui->networkConnectedCheckBox->isChecked(), true); - Config::setPSNSignedIn(ui->psnSignInCheckBox->isChecked(), true); - } - // Entries with game-specific settings, needs the game-specific arg + Config::setReadbacks(ui->readbacksCheckBox->isChecked(), game_specific); + Config::setReadbackLinearImages(ui->readbackLinearImagesCheckBox->isChecked(), game_specific); + Config::setDirectMemoryAccess(ui->dmaCheckBox->isChecked(), game_specific); + Config::setDevKitConsole(ui->devkitCheckBox->isChecked(), game_specific); + Config::setNeoMode(ui->neoCheckBox->isChecked(), game_specific); + Config::setConnectedToNetwork(ui->networkConnectedCheckBox->isChecked(), game_specific); + Config::setPSNSignedIn(ui->psnSignInCheckBox->isChecked(), game_specific); + Config::setIsFullscreen( screenModeMap.value(ui->displayModeComboBox->currentText()) != "Windowed", game_specific); Config::setFullscreenMode( @@ -1025,7 +1021,8 @@ void SettingsDialog::UpdateSettings(bool game_specific) { Config::setCursorHideTimeout(ui->hideCursorComboBox->currentIndex(), game_specific); Config::setGpuId(ui->graphicsAdapterBox->currentIndex() - 1, game_specific); Config::setVolumeSlider(ui->horizontalVolumeSlider->value(), game_specific); - Config::setLanguage(languageIndexes[ui->consoleLanguageComboBox->currentIndex()]); + Config::setLanguage(languageIndexes[ui->consoleLanguageComboBox->currentIndex()], + game_specific); Config::setWindowWidth(ui->widthSpinBox->value(), game_specific); Config::setWindowHeight(ui->heightSpinBox->value(), game_specific); Config::setVblankFreq(ui->vblankSpinBox->value(), game_specific); @@ -1043,8 +1040,6 @@ void SettingsDialog::UpdateSettings(bool game_specific) { Config::setVkHostMarkersEnabled(ui->hostMarkersCheckBox->isChecked(), game_specific); Config::setVkGuestMarkersEnabled(ui->guestMarkersCheckBox->isChecked(), game_specific); Config::setVkCrashDiagnosticEnabled(ui->crashDiagnosticsCheckBox->isChecked(), game_specific); - Config::setReadbacks(ui->readbacksCheckBox->isChecked(), game_specific); - Config::setReadbackLinearImages(ui->readbackLinearImagesCheckBox->isChecked(), game_specific); Config::setCollectShaderForDebug(ui->collectShaderCheckBox->isChecked(), game_specific); Config::setCopyGPUCmdBuffers(ui->copyGPUBuffersCheckBox->isChecked(), game_specific); Config::setChooseHomeTab( diff --git a/src/qt_gui/settings_dialog.ui b/src/qt_gui/settings_dialog.ui index d8fb498c4..c80335c40 100644 --- a/src/qt_gui/settings_dialog.ui +++ b/src/qt_gui/settings_dialog.ui @@ -59,7 +59,10 @@ - 7 + 1 + + + true @@ -106,7 +109,7 @@ - Emulator + Miscellaneous false @@ -114,7 +117,7 @@ false - + 6 @@ -131,44 +134,113 @@ 9 - - - 10 + + + + 0 + 0 + - - - - Show Splash - - - - - - - Enable Discord Rich Presence - - - - - - - Qt::Orientation::Vertical - - - - 20 - 40 - - - - - + + Default tab when opening settings + + + + + + + 0 + 0 + + + + + General + + + + + Frontend + + + + + Graphics + + + + + User + + + + + Input + + + + + Paths + + + + + Log + + + + + Debug + + + + + Experimental + + + + + + + + + + + Show Splash Screen When Launching Game + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + @@ -224,303 +296,91 @@ - + - Emulator Language + Volume - + - - - - - - - - - - - - - - Qt::Orientation::Vertical - - - - 20 - 40 - - - - - - - - 6 - - - QLayout::SizeConstraint::SetDefaultConstraint - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Update - - - - 6 - - - 9 - - - 9 - - - 80 - - - - - - 0 - 0 - - - - - 11 - false - - - - Check for Updates at Startup - - - - - - - Always Show Changelog - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Update Channel - - - - 7 - - - 11 - - - 11 - - - 11 - - - 11 - - - + - + 0 0 - - - Release + + + + + true + + + + + 0 + 0 + 408 + 68 + - - - - Nightly - - + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + 100% + + + Qt::AlignmentFlag::AlignCenter + + + true + + + + + + + Qt::FocusPolicy::StrongFocus + + + 500 + + + 100 + + + 100 + + + Qt::Orientation::Horizontal + + + + + - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Check for Updates - - - - - - - Volume - - - - - - - 0 - 0 - - - - - - - true - - - - - 0 - 0 - 400 - 68 - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - 100% - - - Qt::AlignmentFlag::AlignCenter - - - true - - - - - - - Qt::FocusPolicy::StrongFocus - - - 500 - - - 100 - - - 100 - - - Qt::Orientation::Horizontal - - - - - - - - - - - - - - Qt::Orientation::Vertical - - - - 20 - 40 - - - - @@ -531,15 +391,15 @@ true - GUI + Frontend 0 0 - 946 - 501 + 932 + 507 @@ -577,7 +437,7 @@ - GUI Settings + General Frontend Settings @@ -587,62 +447,10 @@ 9 - - - Default tab when opening settings + + + Enable Discord Rich Presence - - - - - - 0 - 0 - - - - - General - - - - - GUI - - - - - Graphics - - - - - User - - - - - Input - - - - - Paths - - - - - Log - - - - - Debug - - - - - @@ -652,6 +460,18 @@ + + + + Emulator Language + + + + + + + + @@ -865,6 +685,45 @@ + + + + Trophy Key + + + + + + 0 + + + + + Trophy Key + + + + + + + + 0 + 0 + + + + + 10 + false + + + + + + + + + @@ -884,7 +743,7 @@ - + 6 @@ -967,7 +826,159 @@ - + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Update + + + + 6 + + + 9 + + + 9 + + + 80 + + + + + + 0 + 0 + + + + + 11 + false + + + + Check for Updates at Startup + + + + + + + Always Show Changelog + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Update Channel + + + + 7 + + + 11 + + + 11 + + + 11 + + + 11 + + + + + + 0 + 0 + + + + + Release + + + + + Nightly + + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Check for Updates + + + + + + + + Qt::Orientation::Vertical @@ -1559,36 +1570,6 @@ - - - - 0 - - - - - Trophy Key - - - - - - - - 0 - 0 - - - - - 10 - false - - - - - - @@ -1614,6 +1595,9 @@ + + + @@ -1651,7 +1635,7 @@ 501 - + @@ -1872,30 +1856,31 @@ + + + 0 + 0 + + Microphone - - - - 14 - 33 - 431 - 31 - - - + + + + + - + - Qt::Orientation::Vertical + Qt::Orientation::Horizontal - 0 - 40 + 40 + 20 @@ -1904,6 +1889,19 @@ + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + @@ -2234,8 +2232,8 @@ 0 0 - 932 - 507 + 946 + 234 @@ -2379,10 +2377,59 @@ + + + + Qt::Orientation::Vertical + + + + 20 + 5 + + + + + + + + + + + + true + + + Experimental + + + + + 0 + 0 + 946 + 287 + + + + + 0 + 0 + + + + + - + + + + 0 + 0 + + Experimental Features @@ -2496,19 +2543,6 @@ - - - - Qt::Orientation::Vertical - - - - 20 - 5 - - - -