| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | // Copyright 2017 Dolphin Emulator Project5~5~5~
 | 
					
						
							|  |  |  | // Licensed under GPLv2+
 | 
					
						
							|  |  |  | // Refer to the license.txt file included.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-07 00:40:15 +02:00
										 |  |  | #include "DolphinQt/Config/Graphics/GeneralWidget.h"
 | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <QCheckBox>
 | 
					
						
							|  |  |  | #include <QComboBox>
 | 
					
						
							|  |  |  | #include <QGridLayout>
 | 
					
						
							|  |  |  | #include <QGroupBox>
 | 
					
						
							|  |  |  | #include <QHBoxLayout>
 | 
					
						
							|  |  |  | #include <QLabel>
 | 
					
						
							|  |  |  | #include <QMessageBox>
 | 
					
						
							| 
									
										
										
										
											2018-03-16 23:10:22 +10:00
										 |  |  | #include <QRadioButton>
 | 
					
						
							| 
									
										
										
										
											2018-08-23 07:11:52 -04:00
										 |  |  | #include <QSignalBlocker>
 | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | #include <QVBoxLayout>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "Core/Config/GraphicsSettings.h"
 | 
					
						
							|  |  |  | #include "Core/ConfigManager.h"
 | 
					
						
							| 
									
										
										
										
											2017-09-04 11:12:13 -07:00
										 |  |  | #include "Core/Core.h"
 | 
					
						
							| 
									
										
										
										
											2018-05-28 03:48:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-07 00:40:15 +02:00
										 |  |  | #include "DolphinQt/Config/Graphics/GraphicsBool.h"
 | 
					
						
							|  |  |  | #include "DolphinQt/Config/Graphics/GraphicsChoice.h"
 | 
					
						
							|  |  |  | #include "DolphinQt/Config/Graphics/GraphicsRadio.h"
 | 
					
						
							|  |  |  | #include "DolphinQt/Config/Graphics/GraphicsWindow.h"
 | 
					
						
							|  |  |  | #include "DolphinQt/Settings.h"
 | 
					
						
							| 
									
										
										
										
											2018-05-28 03:48:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | #include "UICommon/VideoUtils.h"
 | 
					
						
							| 
									
										
										
										
											2018-05-28 03:48:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | #include "VideoCommon/VideoBackendBase.h"
 | 
					
						
							|  |  |  | #include "VideoCommon/VideoConfig.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GeneralWidget::GeneralWidget(X11Utils::XRRConfiguration* xrr_config, GraphicsWindow* parent) | 
					
						
							|  |  |  |     : GraphicsWidget(parent), m_xrr_config(xrr_config) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   CreateWidgets(); | 
					
						
							|  |  |  |   LoadSettings(); | 
					
						
							|  |  |  |   ConnectWidgets(); | 
					
						
							|  |  |  |   AddDescriptions(); | 
					
						
							|  |  |  |   emit BackendChanged(QString::fromStdString(SConfig::GetInstance().m_strVideoBackend)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   connect(parent, &GraphicsWindow::BackendChanged, this, &GeneralWidget::OnBackendChanged); | 
					
						
							| 
									
										
										
										
											2017-09-04 11:12:13 -07:00
										 |  |  |   connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, | 
					
						
							|  |  |  |           [=](Core::State state) { OnEmulationStateChanged(state != Core::State::Uninitialized); }); | 
					
						
							| 
									
										
										
										
											2018-07-13 12:38:21 +02:00
										 |  |  |   OnEmulationStateChanged(Core::GetState() != Core::State::Uninitialized); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneralWidget::CreateWidgets() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   auto* main_layout = new QVBoxLayout; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |   // Basic Section
 | 
					
						
							|  |  |  |   auto* m_video_box = new QGroupBox(tr("Basic")); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |   m_video_layout = new QGridLayout(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_backend_combo = new QComboBox(); | 
					
						
							|  |  |  |   m_aspect_combo = | 
					
						
							|  |  |  |       new GraphicsChoice({tr("Auto"), tr("Force 16:9"), tr("Force 4:3"), tr("Stretch to Window")}, | 
					
						
							|  |  |  |                          Config::GFX_ASPECT_RATIO); | 
					
						
							| 
									
										
										
										
											2018-05-02 19:14:38 +02:00
										 |  |  |   m_adapter_combo = new QComboBox; | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |   m_enable_vsync = new GraphicsBool(tr("V-Sync"), Config::GFX_VSYNC); | 
					
						
							|  |  |  |   m_enable_fullscreen = new QCheckBox(tr("Use Fullscreen")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_video_box->setLayout(m_video_layout); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   for (auto& backend : g_available_video_backends) | 
					
						
							| 
									
										
										
										
											2018-06-30 04:28:45 -04:00
										 |  |  |     m_backend_combo->addItem(tr(backend->GetDisplayName().c_str()), | 
					
						
							|  |  |  |                              QVariant(QString::fromStdString(backend->GetName()))); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   m_video_layout->addWidget(new QLabel(tr("Backend:")), 0, 0); | 
					
						
							|  |  |  |   m_video_layout->addWidget(m_backend_combo, 0, 1); | 
					
						
							| 
									
										
										
										
											2017-11-17 12:55:43 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |   m_video_layout->addWidget(new QLabel(tr("Adapter:")), 1, 0); | 
					
						
							|  |  |  |   m_video_layout->addWidget(m_adapter_combo, 1, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_video_layout->addWidget(new QLabel(tr("Aspect Ratio:")), 3, 0); | 
					
						
							|  |  |  |   m_video_layout->addWidget(m_aspect_combo, 3, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_video_layout->addWidget(m_enable_vsync, 4, 0); | 
					
						
							|  |  |  |   m_video_layout->addWidget(m_enable_fullscreen, 4, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |   // Other
 | 
					
						
							|  |  |  |   auto* m_options_box = new QGroupBox(tr("Other")); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |   auto* m_options_layout = new QGridLayout(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_show_fps = new GraphicsBool(tr("Show FPS"), Config::GFX_SHOW_FPS); | 
					
						
							|  |  |  |   m_show_ping = new GraphicsBool(tr("Show NetPlay Ping"), Config::GFX_SHOW_NETPLAY_PING); | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |   m_log_render_time = | 
					
						
							|  |  |  |       new GraphicsBool(tr("Log Render Time to File"), Config::GFX_LOG_RENDER_TIME_TO_FILE); | 
					
						
							|  |  |  |   m_autoadjust_window_size = new QCheckBox(tr("Auto-Adjust Window Size")); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |   m_show_messages = | 
					
						
							|  |  |  |       new GraphicsBool(tr("Show NetPlay Messages"), Config::GFX_SHOW_NETPLAY_MESSAGES); | 
					
						
							|  |  |  |   m_render_main_window = new QCheckBox(tr("Render to Main Window")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_options_box->setLayout(m_options_layout); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_options_layout->addWidget(m_show_fps, 0, 0); | 
					
						
							|  |  |  |   m_options_layout->addWidget(m_show_ping, 0, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_options_layout->addWidget(m_log_render_time, 1, 0); | 
					
						
							|  |  |  |   m_options_layout->addWidget(m_autoadjust_window_size, 1, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_options_layout->addWidget(m_show_messages, 2, 0); | 
					
						
							| 
									
										
										
										
											2018-04-22 16:58:33 +02:00
										 |  |  |   m_options_layout->addWidget(m_render_main_window, 2, 1); | 
					
						
							| 
									
										
										
										
											2018-03-16 23:10:22 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Other
 | 
					
						
							|  |  |  |   auto* shader_compilation_box = new QGroupBox(tr("Shader Compilation")); | 
					
						
							|  |  |  |   auto* shader_compilation_layout = new QGridLayout(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   const std::array<const char*, 4> modes = {{ | 
					
						
							| 
									
										
										
										
											2018-04-12 14:18:04 +02:00
										 |  |  |       "Synchronous", | 
					
						
							|  |  |  |       "Synchronous (Ubershaders)", | 
					
						
							|  |  |  |       "Asynchronous (Ubershaders)", | 
					
						
							| 
									
										
										
										
											2018-03-16 23:10:22 +10:00
										 |  |  |       "Asynchronous (Skip Drawing)", | 
					
						
							|  |  |  |   }}; | 
					
						
							|  |  |  |   for (size_t i = 0; i < modes.size(); i++) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     m_shader_compilation_mode[i] = new GraphicsRadioInt( | 
					
						
							|  |  |  |         tr(modes[i]), Config::GFX_SHADER_COMPILATION_MODE, static_cast<int>(i)); | 
					
						
							|  |  |  |     shader_compilation_layout->addWidget(m_shader_compilation_mode[i], static_cast<int>(i / 2), | 
					
						
							|  |  |  |                                          static_cast<int>(i % 2)); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   m_wait_for_shaders = new GraphicsBool(tr("Compile Shaders Before Starting"), | 
					
						
							|  |  |  |                                         Config::GFX_WAIT_FOR_SHADERS_BEFORE_STARTING); | 
					
						
							|  |  |  |   shader_compilation_layout->addWidget(m_wait_for_shaders); | 
					
						
							|  |  |  |   shader_compilation_box->setLayout(shader_compilation_layout); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   main_layout->addWidget(m_video_box); | 
					
						
							|  |  |  |   main_layout->addWidget(m_options_box); | 
					
						
							| 
									
										
										
										
											2018-03-16 23:10:22 +10:00
										 |  |  |   main_layout->addWidget(shader_compilation_box); | 
					
						
							| 
									
										
										
										
											2017-09-14 18:48:20 +02:00
										 |  |  |   main_layout->addStretch(); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   setLayout(main_layout); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneralWidget::ConnectWidgets() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   // Video Backend
 | 
					
						
							|  |  |  |   connect(m_backend_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), | 
					
						
							| 
									
										
										
										
											2018-05-14 21:09:43 +02:00
										 |  |  |           this, &GeneralWidget::SaveSettings); | 
					
						
							|  |  |  |   connect(m_adapter_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), | 
					
						
							|  |  |  |           this, [](int index) { | 
					
						
							|  |  |  |             g_Config.iAdapter = index; | 
					
						
							|  |  |  |             Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index); | 
					
						
							|  |  |  |           }); | 
					
						
							| 
									
										
										
										
											2018-04-22 16:58:33 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-07 17:50:03 +02:00
										 |  |  |   for (QCheckBox* checkbox : {m_enable_fullscreen, m_render_main_window, m_autoadjust_window_size}) | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |     connect(checkbox, &QCheckBox::toggled, this, &GeneralWidget::SaveSettings); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneralWidget::LoadSettings() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   // Video Backend
 | 
					
						
							| 
									
										
										
										
											2018-06-30 04:28:45 -04:00
										 |  |  |   m_backend_combo->setCurrentIndex(m_backend_combo->findData( | 
					
						
							|  |  |  |       QVariant(QString::fromStdString(SConfig::GetInstance().m_strVideoBackend)))); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Enable Fullscreen
 | 
					
						
							|  |  |  |   m_enable_fullscreen->setChecked(SConfig::GetInstance().bFullscreen); | 
					
						
							| 
									
										
										
										
											2018-04-22 16:58:33 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |   // Render to Main Window
 | 
					
						
							| 
									
										
										
										
											2018-05-07 17:50:03 +02:00
										 |  |  |   m_render_main_window->setChecked(SConfig::GetInstance().bRenderToMain); | 
					
						
							| 
									
										
										
										
											2018-04-22 16:58:33 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Autoadjust window size
 | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |   m_autoadjust_window_size->setChecked(SConfig::GetInstance().bRenderWindowAutoSize); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneralWidget::SaveSettings() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   // Video Backend
 | 
					
						
							| 
									
										
										
										
											2018-06-30 04:28:45 -04:00
										 |  |  |   const auto current_backend = m_backend_combo->currentData().toString().toStdString(); | 
					
						
							|  |  |  |   if (SConfig::GetInstance().m_strVideoBackend != current_backend) | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |   { | 
					
						
							| 
									
										
										
										
											2018-06-30 04:28:45 -04:00
										 |  |  |     if (current_backend == "Software Renderer") | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-06-30 04:28:45 -04:00
										 |  |  |       QMessageBox confirm_sw(this); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       confirm_sw.setIcon(QMessageBox::Warning); | 
					
						
							|  |  |  |       confirm_sw.setStandardButtons(QMessageBox::Yes | QMessageBox::No); | 
					
						
							|  |  |  |       confirm_sw.setWindowTitle(tr("Confirm backend change")); | 
					
						
							|  |  |  |       confirm_sw.setText(tr("Software rendering is an order of magnitude slower than using the " | 
					
						
							|  |  |  |                             "other backends.\nIt's only useful for debugging purposes.\nDo you " | 
					
						
							|  |  |  |                             "really want to enable software rendering? If unsure, select 'No'.")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (confirm_sw.exec() != QMessageBox::Yes) | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2018-06-30 04:28:45 -04:00
										 |  |  |         m_backend_combo->setCurrentIndex(m_backend_combo->findData( | 
					
						
							|  |  |  |             QVariant(QString::fromStdString(SConfig::GetInstance().m_strVideoBackend)))); | 
					
						
							|  |  |  |         return; | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-06-30 04:28:45 -04:00
										 |  |  |     emit BackendChanged(QString::fromStdString(current_backend)); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Enable Fullscreen
 | 
					
						
							|  |  |  |   SConfig::GetInstance().bFullscreen = m_enable_fullscreen->isChecked(); | 
					
						
							| 
									
										
										
										
											2018-04-22 16:58:33 +02:00
										 |  |  |   // Autoadjust window size
 | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |   SConfig::GetInstance().bRenderWindowAutoSize = m_autoadjust_window_size->isChecked(); | 
					
						
							| 
									
										
										
										
											2018-05-06 04:42:23 +02:00
										 |  |  |   // Render To Main
 | 
					
						
							|  |  |  |   SConfig::GetInstance().bRenderToMain = m_render_main_window->isChecked(); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneralWidget::OnEmulationStateChanged(bool running) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   m_backend_combo->setEnabled(!running); | 
					
						
							|  |  |  |   m_render_main_window->setEnabled(!running); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_adapter_combo->setEnabled(!running); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneralWidget::AddDescriptions() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | // We need QObject::tr
 | 
					
						
							|  |  |  | #if defined(_WIN32)
 | 
					
						
							| 
									
										
										
										
											2018-06-18 11:32:24 -05:00
										 |  |  |   static const char TR_BACKEND_DESCRIPTION[] = QT_TR_NOOP( | 
					
						
							|  |  |  |       "Selects which graphics API to use internally.\n\nThe software renderer is extremely " | 
					
						
							|  |  |  |       "slow and only useful for debugging, so you will want to use either OpenGL, Direct3D, " | 
					
						
							|  |  |  |       "or Vulkan. Different games and different GPUs will behave differently on each " | 
					
						
							|  |  |  |       "backend, so for the best emulation experience it is recommended to try each and " | 
					
						
							|  |  |  |       "select the backend that is least problematic.\n\nIf unsure, select OpenGL."); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_BACKEND_DESCRIPTION[] = | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |       QT_TR_NOOP("Selects what graphics API to use internally.\nThe software renderer is extremely " | 
					
						
							|  |  |  |                  "slow and only useful for debugging, so unless you have a reason to use it you'll " | 
					
						
							|  |  |  |                  "want to select OpenGL here.\n\nIf unsure, select OpenGL."); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_ADAPTER_DESCRIPTION[] = | 
					
						
							| 
									
										
										
										
											2018-04-30 06:51:01 +02:00
										 |  |  |       QT_TR_NOOP("Selects a hardware adapter to use.\n\nIf unsure, use the first one."); | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_FULLSCREEN_DESCRIPTION[] = QT_TR_NOOP( | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |       "Enable this if you want the whole screen to be used for rendering.\nIf this is disabled, a " | 
					
						
							|  |  |  |       "render window will be created instead.\n\nIf unsure, leave this unchecked."); | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_AUTOSIZE_DESCRIPTION[] = | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |       QT_TR_NOOP("Automatically adjusts the window size to your internal resolution.\n\nIf unsure, " | 
					
						
							|  |  |  |                  "leave this unchecked."); | 
					
						
							| 
									
										
										
										
											2018-04-22 16:58:33 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_RENDER_TO_MAINWINDOW_DESCRIPTION[] = | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |       QT_TR_NOOP("Enable this if you want to use the main Dolphin window for rendering rather than " | 
					
						
							|  |  |  |                  "a separate render window.\n\nIf unsure, leave this unchecked."); | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_ASPECT_RATIO_DESCRIPTION[] = QT_TR_NOOP( | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |       "Select what aspect ratio to use when rendering:\nAuto: Use the native aspect " | 
					
						
							|  |  |  |       "ratio\nForce 16:9: Mimic an analog TV with a widescreen aspect ratio.\nForce 4:3: " | 
					
						
							|  |  |  |       "Mimic a standard 4:3 analog TV.\nStretch to Window: Stretch the picture to the " | 
					
						
							|  |  |  |       "window size.\n\nIf unsure, select Auto."); | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_VSYNC_DESCRIPTION[] = | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |       QT_TR_NOOP("Wait for vertical blanks in order to reduce tearing.\nDecreases performance if " | 
					
						
							|  |  |  |                  "emulation speed is below 100%.\n\nIf unsure, leave this unchecked."); | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_SHOW_FPS_DESCRIPTION[] = | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |       QT_TR_NOOP("Show the number of frames rendered per second as a measure of " | 
					
						
							|  |  |  |                  "emulation speed.\n\nIf unsure, leave this unchecked."); | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_SHOW_NETPLAY_PING_DESCRIPTION[] = | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |       QT_TR_NOOP("Show the players' maximum Ping while playing on " | 
					
						
							|  |  |  |                  "NetPlay.\n\nIf unsure, leave this unchecked."); | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_LOG_RENDERTIME_DESCRIPTION[] = | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |       QT_TR_NOOP("Log the render time of every frame to User/Logs/render_time.txt. Use this " | 
					
						
							|  |  |  |                  "feature when you want to measure the performance of Dolphin.\n\nIf " | 
					
						
							|  |  |  |                  "unsure, leave this unchecked."); | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_SHOW_NETPLAY_MESSAGES_DESCRIPTION[] = | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |       QT_TR_NOOP("When playing on NetPlay, show chat messages, buffer changes and " | 
					
						
							|  |  |  |                  "desync alerts.\n\nIf unsure, leave this unchecked."); | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_SHADER_COMPILE_SYNC_DESCRIPTION[] = | 
					
						
							| 
									
										
										
										
											2018-03-16 23:10:22 +10:00
										 |  |  |       QT_TR_NOOP("Ubershaders are never used. Stuttering will occur during shader " | 
					
						
							|  |  |  |                  "compilation, but GPU demands are low. Recommended for low-end hardware.\n\nIf " | 
					
						
							|  |  |  |                  "unsure, select this mode."); | 
					
						
							| 
									
										
										
										
											2018-07-10 12:22:21 -04:00
										 |  |  |   static const char TR_SHADER_COMPILE_SYNC_UBER_DESCRIPTION[] = QT_TR_NOOP( | 
					
						
							| 
									
										
										
										
											2018-05-01 18:57:34 -04:00
										 |  |  |       "Ubershaders will always be used. Provides a near stutter-free experience at the cost of " | 
					
						
							|  |  |  |       "high GPU performance requirements. Only recommended for high-end systems."); | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_SHADER_COMPILE_ASYNC_UBER_DESCRIPTION[] = | 
					
						
							| 
									
										
										
										
											2018-03-16 23:10:22 +10:00
										 |  |  |       QT_TR_NOOP("Ubershaders will be used to prevent stuttering during shader compilation, but " | 
					
						
							| 
									
										
										
										
											2018-05-01 18:57:34 -04:00
										 |  |  |                  "specialized shaders will be used when they will not cause stuttering. In the " | 
					
						
							|  |  |  |                  "best case it eliminates shader compilation stuttering while having minimal " | 
					
						
							|  |  |  |                  "performance impact, but results depend on video driver behavior."); | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_SHADER_COMPILE_ASYNC_SKIP_DESCRIPTION[] = QT_TR_NOOP( | 
					
						
							| 
									
										
										
										
											2018-05-01 18:57:34 -04:00
										 |  |  |       "Prevents shader compilation stuttering by not rendering waiting objects. Can work in " | 
					
						
							|  |  |  |       "scenarios where Ubershaders doesn't, at the cost of introducing visual glitches and broken " | 
					
						
							|  |  |  |       "effects. Not recommended, only use if the other options give poor results on your system."); | 
					
						
							| 
									
										
										
										
											2018-06-06 09:05:18 -04:00
										 |  |  |   static const char TR_SHADER_COMPILE_BEFORE_START_DESCRIPTION[] = | 
					
						
							| 
									
										
										
										
											2018-03-16 23:10:22 +10:00
										 |  |  |       QT_TR_NOOP("Waits for all shaders to finish compiling before starting a game. Enabling this " | 
					
						
							|  |  |  |                  "option may reduce stuttering or hitching for a short time after the game is " | 
					
						
							|  |  |  |                  "started, at the cost of a longer delay before the game starts. For systems with " | 
					
						
							|  |  |  |                  "two or fewer cores, it is recommended to enable this option, as a large shader " | 
					
						
							|  |  |  |                  "queue may reduce frame rates. Otherwise, if unsure, leave this unchecked."); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   AddDescription(m_backend_combo, TR_BACKEND_DESCRIPTION); | 
					
						
							|  |  |  |   AddDescription(m_adapter_combo, TR_ADAPTER_DESCRIPTION); | 
					
						
							|  |  |  |   AddDescription(m_aspect_combo, TR_ASPECT_RATIO_DESCRIPTION); | 
					
						
							|  |  |  |   AddDescription(m_enable_vsync, TR_VSYNC_DESCRIPTION); | 
					
						
							| 
									
										
										
										
											2018-05-14 18:18:18 +02:00
										 |  |  |   AddDescription(m_enable_fullscreen, TR_FULLSCREEN_DESCRIPTION); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |   AddDescription(m_show_fps, TR_SHOW_FPS_DESCRIPTION); | 
					
						
							|  |  |  |   AddDescription(m_show_ping, TR_SHOW_NETPLAY_PING_DESCRIPTION); | 
					
						
							|  |  |  |   AddDescription(m_log_render_time, TR_LOG_RENDERTIME_DESCRIPTION); | 
					
						
							| 
									
										
										
										
											2018-05-14 18:18:18 +02:00
										 |  |  |   AddDescription(m_autoadjust_window_size, TR_AUTOSIZE_DESCRIPTION); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |   AddDescription(m_show_messages, TR_SHOW_NETPLAY_MESSAGES_DESCRIPTION); | 
					
						
							| 
									
										
										
										
											2018-05-14 18:18:18 +02:00
										 |  |  |   AddDescription(m_render_main_window, TR_RENDER_TO_MAINWINDOW_DESCRIPTION); | 
					
						
							| 
									
										
										
										
											2018-03-16 23:10:22 +10:00
										 |  |  |   AddDescription(m_shader_compilation_mode[0], TR_SHADER_COMPILE_SYNC_DESCRIPTION); | 
					
						
							| 
									
										
										
										
											2018-07-10 12:22:21 -04:00
										 |  |  |   AddDescription(m_shader_compilation_mode[1], TR_SHADER_COMPILE_SYNC_UBER_DESCRIPTION); | 
					
						
							| 
									
										
										
										
											2018-03-16 23:10:22 +10:00
										 |  |  |   AddDescription(m_shader_compilation_mode[2], TR_SHADER_COMPILE_ASYNC_UBER_DESCRIPTION); | 
					
						
							|  |  |  |   AddDescription(m_shader_compilation_mode[3], TR_SHADER_COMPILE_ASYNC_SKIP_DESCRIPTION); | 
					
						
							|  |  |  |   AddDescription(m_wait_for_shaders, TR_SHADER_COMPILE_BEFORE_START_DESCRIPTION); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2018-05-02 19:14:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | void GeneralWidget::OnBackendChanged(const QString& backend_name) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-06-30 04:28:45 -04:00
										 |  |  |   m_backend_combo->setCurrentIndex(m_backend_combo->findData(QVariant(backend_name))); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 07:11:52 -04:00
										 |  |  |   const QSignalBlocker blocker(m_adapter_combo); | 
					
						
							| 
									
										
										
										
											2018-05-14 21:09:43 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |   m_adapter_combo->clear(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-02 19:14:38 +02:00
										 |  |  |   const auto& adapters = g_Config.backend_info.Adapters; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   for (const auto& adapter : adapters) | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |     m_adapter_combo->addItem(QString::fromStdString(adapter)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-31 03:52:18 +02:00
										 |  |  |   const bool supports_adapters = !adapters.empty(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  |   m_adapter_combo->setCurrentIndex(g_Config.iAdapter); | 
					
						
							| 
									
										
										
										
											2018-09-28 22:01:23 +10:00
										 |  |  |   m_adapter_combo->setEnabled(supports_adapters && !Core::IsRunning()); | 
					
						
							| 
									
										
										
										
											2018-05-31 03:52:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-30 04:28:45 -04:00
										 |  |  |   m_adapter_combo->setToolTip(supports_adapters ? | 
					
						
							|  |  |  |                                   QStringLiteral("") : | 
					
						
							|  |  |  |                                   tr("%1 doesn't support this feature.") | 
					
						
							|  |  |  |                                       .arg(tr(g_video_backend->GetDisplayName().c_str()))); | 
					
						
							| 
									
										
										
										
											2017-06-16 01:43:14 +02:00
										 |  |  | } |