Merge branch 'master' of https://github.com/dolphin-emu/dolphin into dolphin-emu-master

This commit is contained in:
Nayla Hanegan 2023-12-25 20:08:08 -05:00
commit c18016e795
767 changed files with 87644 additions and 70168 deletions

View file

@ -36,6 +36,10 @@ AdvancedWidget::AdvancedWidget(GraphicsWindow* parent)
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
OnEmulationStateChanged(state != Core::State::Uninitialized);
});
connect(m_manual_texture_sampling, &QCheckBox::toggled, [this, parent] {
SaveSettings();
emit parent->UseFastTextureSamplingChanged();
});
OnBackendChanged();
OnEmulationStateChanged(Core::GetState() != Core::State::Uninitialized);
@ -355,8 +359,9 @@ void AdvancedWidget::AddDescriptions()
"level 9 but finish in significantly less time.<br><br>"
"<dolphin_emphasis>If unsure, leave this at 6.</dolphin_emphasis>");
static const char TR_CROPPING_DESCRIPTION[] = QT_TR_NOOP(
"Crops the picture from its native aspect ratio to 4:3 or "
"16:9.<br><br><dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>");
"Crops the picture from its native aspect ratio (which rarely exactly matches 4:3 or 16:9),"
" to the specific user target aspect ratio (e.g. 4:3 or 16:9).<br><br>"
"<dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>");
static const char TR_PROGRESSIVE_SCAN_DESCRIPTION[] = QT_TR_NOOP(
"Enables progressive scan if supported by the emulated software. Most games don't have "
"any issue with this.<br><br><dolphin_emphasis>If unsure, leave this "

View file

@ -51,7 +51,7 @@ void ColorCorrectionConfigWindow::Create()
"Controls the base luminance of a paper white surface in nits. Useful for adjusting to "
"different environmental lighting conditions when using a HDR display.<br><br>HDR output is "
"required for this setting to take effect.<br><br><dolphin_emphasis>If unsure, leave this at "
"200.</dolphin_emphasis>");
"203.</dolphin_emphasis>");
// Color Space:

View file

@ -39,6 +39,10 @@ EnhancementsWidget::EnhancementsWidget(GraphicsWindow* parent) : m_block_save(fa
AddDescriptions();
connect(parent, &GraphicsWindow::BackendChanged,
[this](const QString& backend) { LoadSettings(); });
connect(parent, &GraphicsWindow::UseFastTextureSamplingChanged, this,
&EnhancementsWidget::LoadSettings);
connect(parent, &GraphicsWindow::UseGPUTextureDecodingChanged, this,
&EnhancementsWidget::LoadSettings);
}
constexpr int TEXTURE_FILTERING_DEFAULT = 0;
@ -62,14 +66,19 @@ void EnhancementsWidget::CreateWidgets()
auto* enhancements_layout = new QGridLayout();
enhancements_box->setLayout(enhancements_layout);
// Only display the first 8 scales, which most users will not go beyond.
QStringList resolution_options{
tr("Auto (Multiple of 640x528)"), tr("Native (640x528)"),
tr("2x Native (1280x1056) for 720p"), tr("3x Native (1920x1584) for 1080p"),
tr("4x Native (2560x2112) for 1440p"), tr("5x Native (3200x2640)"),
tr("6x Native (3840x3168) for 4K"), tr("7x Native (4480x3696)"),
tr("8x Native (5120x4224) for 5K")};
const int visible_resolution_option_count = static_cast<int>(resolution_options.size());
QStringList resolution_options{tr("Auto (Multiple of 640x528)"), tr("Native (640x528)")};
// From 2x up.
// To calculate the suggested internal resolution scale for each common output resolution,
// we find the minimum multiplier that results in an equal or greater resolution than the
// output one, on both width and height.
// Note that often games don't render to the full resolution, but have some black bars
// on the edges; this is not accounted for in the calculations.
const QStringList resolution_extra_options{
tr("720p"), tr("1080p"), tr("1440p"), QStringLiteral(""),
tr("4K"), QStringLiteral(""), tr("5K"), QStringLiteral(""),
QStringLiteral(""), QStringLiteral(""), tr("8K")};
const int visible_resolution_option_count = static_cast<int>(resolution_options.size()) +
static_cast<int>(resolution_extra_options.size());
// If the current scale is greater than the max scale in the ini, add sufficient options so that
// when the settings are saved we don't lose the user-modified value from the ini.
@ -77,10 +86,22 @@ void EnhancementsWidget::CreateWidgets()
std::max(Config::Get(Config::GFX_EFB_SCALE), Config::Get(Config::GFX_MAX_EFB_SCALE));
for (int scale = static_cast<int>(resolution_options.size()); scale <= max_efb_scale; scale++)
{
resolution_options.append(tr("%1x Native (%2x%3)")
.arg(QString::number(scale),
QString::number(static_cast<int>(EFB_WIDTH) * scale),
QString::number(static_cast<int>(EFB_HEIGHT) * scale)));
const QString scale_text = QString::number(scale);
const QString width_text = QString::number(static_cast<int>(EFB_WIDTH) * scale);
const QString height_text = QString::number(static_cast<int>(EFB_HEIGHT) * scale);
const int extra_index = resolution_options.size() - 2;
const QString extra_text = resolution_extra_options.size() > extra_index ?
resolution_extra_options[extra_index] :
QStringLiteral("");
if (extra_text.isEmpty())
{
resolution_options.append(tr("%1x Native (%2x%3)").arg(scale_text, width_text, height_text));
}
else
{
resolution_options.append(
tr("%1x Native (%2x%3) for %4").arg(scale_text, width_text, height_text, extra_text));
}
}
m_ir_combo = new ConfigChoice(resolution_options, Config::GFX_EFB_SCALE);
@ -211,15 +232,13 @@ void EnhancementsWidget::CreateWidgets()
void EnhancementsWidget::ConnectWidgets()
{
connect(m_aa_combo, qOverload<int>(&QComboBox::currentIndexChanged),
connect(m_aa_combo, &QComboBox::currentIndexChanged, [this](int) { SaveSettings(); });
connect(m_texture_filtering_combo, &QComboBox::currentIndexChanged,
[this](int) { SaveSettings(); });
connect(m_texture_filtering_combo, qOverload<int>(&QComboBox::currentIndexChanged),
connect(m_output_resampling_combo, &QComboBox::currentIndexChanged,
[this](int) { SaveSettings(); });
connect(m_output_resampling_combo, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); });
connect(m_pp_effect, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); });
connect(m_3d_mode, qOverload<int>(&QComboBox::currentIndexChanged), [this] {
connect(m_pp_effect, &QComboBox::currentIndexChanged, [this](int) { SaveSettings(); });
connect(m_3d_mode, &QComboBox::currentIndexChanged, [this] {
m_block_save = true;
m_configure_color_correction->setEnabled(g_Config.backend_info.bSupportsPostProcessing);
LoadPPShaders();
@ -278,7 +297,7 @@ void EnhancementsWidget::LoadPPShaders()
.arg(tr(g_video_backend->GetDisplayName().c_str())));
VideoCommon::PostProcessingConfiguration pp_shader;
if (selected_shader != "(off)" && supports_postprocessing)
if (selected_shader != "" && supports_postprocessing)
{
pp_shader.LoadShader(selected_shader);
m_configure_pp_effect->setEnabled(pp_shader.HasOptions());
@ -292,6 +311,9 @@ void EnhancementsWidget::LoadPPShaders()
void EnhancementsWidget::LoadSettings()
{
m_block_save = true;
m_texture_filtering_combo->setEnabled(Config::Get(Config::GFX_HACK_FAST_TEXTURE_SAMPLING));
m_arbitrary_mipmap_detection->setEnabled(!Config::Get(Config::GFX_ENABLE_GPU_TEXTURE_DECODING));
// Anti-Aliasing
const u32 aa_selection = Config::Get(Config::GFX_MSAA);
@ -451,11 +473,11 @@ void EnhancementsWidget::SaveSettings()
const bool passive = g_Config.stereo_mode == StereoMode::Passive;
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_POST_SHADER,
(!anaglyph && !passive && m_pp_effect->currentIndex() == 0) ?
"(off)" :
"" :
m_pp_effect->currentText().toStdString());
VideoCommon::PostProcessingConfiguration pp_shader;
if (Config::Get(Config::GFX_ENHANCE_POST_SHADER) != "(off)")
if (Config::Get(Config::GFX_ENHANCE_POST_SHADER) != "")
{
pp_shader.LoadShader(Config::Get(Config::GFX_ENHANCE_POST_SHADER));
m_configure_pp_effect->setEnabled(pp_shader.HasOptions());
@ -488,7 +510,8 @@ void EnhancementsWidget::AddDescriptions()
"that are at oblique viewing angles. Force Nearest and Force Linear override the texture "
"scaling filter selected by the game.<br><br>Any option except 'Default' will alter the look "
"of the game's textures and might cause issues in a small number of "
"games.<br><br><dolphin_emphasis>If unsure, select 'Default'.</dolphin_emphasis>");
"games.<br><br>This option is incompatible with Manual Texture Sampling.<br><br>"
"<dolphin_emphasis>If unsure, select 'Default'.</dolphin_emphasis>");
static const char TR_OUTPUT_RESAMPLING_DESCRIPTION[] =
QT_TR_NOOP("Affects how the game output is scaled to the window resolution."
"<br>The performance mostly depends on the number of samples each method uses."
@ -538,12 +561,11 @@ void EnhancementsWidget::AddDescriptions()
"causes slowdowns or graphical issues.<br><br><dolphin_emphasis>If unsure, leave "
"this unchecked.</dolphin_emphasis>");
static const char TR_WIDESCREEN_HACK_DESCRIPTION[] = QT_TR_NOOP(
"Forces the game to output graphics for any aspect ratio. Use with \"Aspect Ratio\" set to "
"\"Force 16:9\" to force 4:3-only games to run at 16:9.<br><br>Rarely produces good "
"results and "
"often partially breaks graphics and game UIs. Unnecessary (and detrimental) if using any "
"AR/Gecko-code widescreen patches.<br><br><dolphin_emphasis>If unsure, leave "
"this unchecked.</dolphin_emphasis>");
"Forces the game to output graphics at any aspect ratio by expanding the view frustum "
"without stretching the image.<br>This is a hack, and its results will vary widely game "
"to game (it often causes the UI to stretch).<br>"
"Game-specific AR/Gecko-code aspect ratio patches are preferable over this if available."
"<br><br><dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>");
static const char TR_REMOVE_FOG_DESCRIPTION[] =
QT_TR_NOOP("Makes distant objects more visible by removing fog, thus increasing the overall "
"detail.<br><br>Disabling fog will break some games which rely on proper fog "
@ -584,7 +606,7 @@ void EnhancementsWidget::AddDescriptions()
"resolution, such as in games that use very low resolution mipmaps. Disabling this can also "
"reduce stutter in games that frequently load new textures. This feature is not compatible "
"with GPU Texture Decoding.<br><br><dolphin_emphasis>If unsure, leave this "
"checked.</dolphin_emphasis>");
"unchecked.</dolphin_emphasis>");
static const char TR_HDR_DESCRIPTION[] = QT_TR_NOOP(
"Enables scRGB HDR output (if supported by your graphics backend and monitor)."
" Fullscreen might be required."

View file

@ -20,6 +20,7 @@
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
#include "DolphinQt/Config/ConfigControls/ConfigChoice.h"
#include "DolphinQt/Config/ConfigControls/ConfigInteger.h"
#include "DolphinQt/Config/ConfigControls/ConfigRadio.h"
#include "DolphinQt/Config/Graphics/GraphicsWindow.h"
#include "DolphinQt/Config/ToolTipControls/ToolTipComboBox.h"
@ -54,9 +55,20 @@ void GeneralWidget::CreateWidgets()
m_video_layout = new QGridLayout();
m_backend_combo = new ToolTipComboBox();
m_aspect_combo =
new ConfigChoice({tr("Auto"), tr("Force 16:9"), tr("Force 4:3"), tr("Stretch to Window")},
Config::GFX_ASPECT_RATIO);
m_aspect_combo = new ConfigChoice(
{tr("Auto"), tr("Force 16:9"), tr("Force 4:3"), tr("Stretch to Window"), tr("Custom")},
Config::GFX_ASPECT_RATIO);
m_custom_aspect_label = new QLabel(tr("Custom Aspect Ratio:"));
m_custom_aspect_label->setHidden(true);
constexpr int MAX_CUSTOM_ASPECT_RATIO_RESOLUTION = 10000;
m_custom_aspect_width = new ConfigInteger(1, MAX_CUSTOM_ASPECT_RATIO_RESOLUTION,
Config::GFX_CUSTOM_ASPECT_RATIO_WIDTH);
m_custom_aspect_width->setEnabled(false);
m_custom_aspect_width->setHidden(true);
m_custom_aspect_height = new ConfigInteger(1, MAX_CUSTOM_ASPECT_RATIO_RESOLUTION,
Config::GFX_CUSTOM_ASPECT_RATIO_HEIGHT);
m_custom_aspect_height->setEnabled(false);
m_custom_aspect_height->setHidden(true);
m_adapter_combo = new ToolTipComboBox;
m_enable_vsync = new ConfigBool(tr("V-Sync"), Config::GFX_VSYNC);
m_enable_fullscreen = new ConfigBool(tr("Start in Fullscreen"), Config::MAIN_FULLSCREEN);
@ -70,16 +82,20 @@ void GeneralWidget::CreateWidgets()
}
m_video_layout->addWidget(new QLabel(tr("Backend:")), 0, 0);
m_video_layout->addWidget(m_backend_combo, 0, 1);
m_video_layout->addWidget(m_backend_combo, 0, 1, 1, -1);
m_video_layout->addWidget(new QLabel(tr("Adapter:")), 1, 0);
m_video_layout->addWidget(m_adapter_combo, 1, 1);
m_video_layout->addWidget(m_adapter_combo, 1, 1, 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_aspect_combo, 3, 1, 1, -1);
m_video_layout->addWidget(m_enable_vsync, 4, 0);
m_video_layout->addWidget(m_enable_fullscreen, 4, 1);
m_video_layout->addWidget(m_custom_aspect_label, 4, 0);
m_video_layout->addWidget(m_custom_aspect_width, 4, 1);
m_video_layout->addWidget(m_custom_aspect_height, 4, 2);
m_video_layout->addWidget(m_enable_vsync, 5, 0);
m_video_layout->addWidget(m_enable_fullscreen, 5, 1, 1, -1);
// Other
auto* m_options_box = new QGroupBox(tr("Other"));
@ -134,13 +150,20 @@ void GeneralWidget::CreateWidgets()
void GeneralWidget::ConnectWidgets()
{
// Video Backend
connect(m_backend_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&GeneralWidget::SaveSettings);
connect(m_adapter_combo, qOverload<int>(&QComboBox::currentIndexChanged), this, [&](int index) {
connect(m_backend_combo, &QComboBox::currentIndexChanged, this, &GeneralWidget::SaveSettings);
connect(m_adapter_combo, &QComboBox::currentIndexChanged, this, [&](int index) {
g_Config.iAdapter = index;
Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index);
emit BackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
});
connect(m_aspect_combo, qOverload<int>(&QComboBox::currentIndexChanged), this, [&](int index) {
const bool is_custom_aspect_ratio = (index == static_cast<int>(AspectMode::Custom));
m_custom_aspect_width->setEnabled(is_custom_aspect_ratio);
m_custom_aspect_height->setEnabled(is_custom_aspect_ratio);
m_custom_aspect_label->setHidden(!is_custom_aspect_ratio);
m_custom_aspect_width->setHidden(!is_custom_aspect_ratio);
m_custom_aspect_height->setHidden(!is_custom_aspect_ratio);
});
}
void GeneralWidget::LoadSettings()
@ -148,6 +171,13 @@ void GeneralWidget::LoadSettings()
// Video Backend
m_backend_combo->setCurrentIndex(m_backend_combo->findData(
QVariant(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)))));
const bool is_custom_aspect_ratio = (Config::Get(Config::GFX_ASPECT_RATIO) == AspectMode::Custom);
m_custom_aspect_width->setEnabled(is_custom_aspect_ratio);
m_custom_aspect_height->setEnabled(is_custom_aspect_ratio);
m_custom_aspect_label->setHidden(!is_custom_aspect_ratio);
m_custom_aspect_width->setHidden(!is_custom_aspect_ratio);
m_custom_aspect_height->setHidden(!is_custom_aspect_ratio);
}
void GeneralWidget::SaveSettings()
@ -210,11 +240,15 @@ void GeneralWidget::AddDescriptions()
QT_TR_NOOP("Uses the main Dolphin window for rendering rather than "
"a separate render window.<br><br><dolphin_emphasis>If unsure, leave "
"this unchecked.</dolphin_emphasis>");
static const char TR_ASPECT_RATIO_DESCRIPTION[] = QT_TR_NOOP(
"Selects which aspect ratio to use when rendering.<br><br>Auto: Uses the native aspect "
"ratio<br>Force 16:9: Mimics an analog TV with a widescreen aspect ratio.<br>Force 4:3: "
"Mimics a standard 4:3 analog TV.<br>Stretch to Window: Stretches the picture to the "
"window size.<br><br><dolphin_emphasis>If unsure, select Auto.</dolphin_emphasis>");
static const char TR_ASPECT_RATIO_DESCRIPTION[] =
QT_TR_NOOP("Selects which aspect ratio to use when rendering.<br>"
"Each game can have a slightly different native aspect ratio."
"<br><br>Auto: Uses the native aspect ratio"
"<br>Force 16:9: Mimics an analog TV with a widescreen aspect ratio."
"<br>Force 4:3: Mimics a standard 4:3 analog TV."
"<br>Stretch to Window: Stretches the picture to the window size."
"<br>Custom: For games running with specific custom aspect ratio cheats.<br><br>"
"<dolphin_emphasis>If unsure, select Auto.</dolphin_emphasis>");
static const char TR_VSYNC_DESCRIPTION[] = QT_TR_NOOP(
"Waits for vertical blanks in order to prevent tearing.<br><br>Decreases performance "
"if emulation speed is below 100%.<br><br><dolphin_emphasis>If unsure, leave "
@ -263,6 +297,9 @@ void GeneralWidget::AddDescriptions()
m_aspect_combo->SetTitle(tr("Aspect Ratio"));
m_aspect_combo->SetDescription(tr(TR_ASPECT_RATIO_DESCRIPTION));
m_custom_aspect_width->SetTitle(tr("Custom Aspect Ratio Width"));
m_custom_aspect_height->SetTitle(tr("Custom Aspect Ratio Height"));
m_enable_vsync->SetDescription(tr(TR_VSYNC_DESCRIPTION));
m_enable_fullscreen->SetDescription(tr(TR_FULLSCREEN_DESCRIPTION));

View file

@ -9,10 +9,12 @@
class ConfigBool;
class ConfigChoice;
class ConfigInteger;
class ConfigRadioInt;
class GraphicsWindow;
class QCheckBox;
class QComboBox;
class QLabel;
class QRadioButton;
class QGridLayout;
class ToolTipComboBox;
@ -41,6 +43,9 @@ private:
ToolTipComboBox* m_backend_combo;
ToolTipComboBox* m_adapter_combo;
ConfigChoice* m_aspect_combo;
QLabel* m_custom_aspect_label;
ConfigInteger* m_custom_aspect_width;
ConfigInteger* m_custom_aspect_height;
ConfigBool* m_enable_vsync;
ConfigBool* m_enable_fullscreen;

View file

@ -24,6 +24,8 @@ public:
signals:
void BackendChanged(const QString& backend);
void UseFastTextureSamplingChanged();
void UseGPUTextureDecodingChanged();
private:
void CreateMainLayout();

View file

@ -31,6 +31,10 @@ HacksWidget::HacksWidget(GraphicsWindow* parent)
connect(parent, &GraphicsWindow::BackendChanged, this, &HacksWidget::OnBackendChanged);
OnBackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
connect(&Settings::Instance(), &Settings::ConfigChanged, this, &HacksWidget::LoadSettings);
connect(m_gpu_texture_decoding, &QCheckBox::toggled, [this, parent] {
SaveSettings();
emit parent->UseGPUTextureDecodingChanged();
});
}
void HacksWidget::CreateWidgets()
@ -264,8 +268,8 @@ void HacksWidget::AddDescriptions()
static const char TR_GPU_DECODING_DESCRIPTION[] = QT_TR_NOOP(
"Enables texture decoding using the GPU instead of the CPU.<br><br>This may result in "
"performance gains in some scenarios, or on systems where the CPU is the "
"bottleneck.<br><br><dolphin_emphasis>If unsure, leave this "
"unchecked.</dolphin_emphasis>");
"bottleneck.<br><br>This option is incompatible with Arbitrary Mipmap Detection.<br><br>"
"<dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>");
static const char TR_FAST_DEPTH_CALC_DESCRIPTION[] = QT_TR_NOOP(
"Uses a less accurate algorithm to calculate depth values.<br><br>Causes issues in a few "
"games, but can result in a decent speed increase depending on the game and/or "