From 3e28e85468cafb928cda5dc9210eba95af26e212 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 15 Aug 2023 22:41:50 -0400 Subject: settings: Add AspectRatio enum, split res scale function --- src/common/settings.cpp | 10 +++++++--- src/common/settings.h | 1 + src/common/settings_enums.h | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 15fd2e222..16a58a750 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -207,9 +207,7 @@ const char* TranslateCategory(Category category) { return "Miscellaneous"; } -void UpdateRescalingInfo() { - const auto setup = values.resolution_setup.GetValue(); - auto& info = values.resolution_info; +void TranslateResolutionInfo(ResolutionSetup setup, ResolutionScalingInfo& info) { info.downscale = false; switch (setup) { case ResolutionSetup::Res1_2X: @@ -269,6 +267,12 @@ void UpdateRescalingInfo() { info.active = info.up_scale != 1 || info.down_shift != 0; } +void UpdateRescalingInfo() { + const auto setup = values.resolution_setup.GetValue(); + auto& info = values.resolution_info; + TranslateResolutionInfo(setup, info); +} + void RestoreGlobalState(bool is_powered_on) { // If a game is running, DO NOT restore the global settings state if (is_powered_on) { diff --git a/src/common/settings.h b/src/common/settings.h index b0bc6519a..4407c1e6d 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -525,6 +525,7 @@ std::string GetTimeZoneString(TimeZone time_zone); void LogSettings(); +void TranslateResolutionInfo(ResolutionSetup setup, ResolutionScalingInfo& info); void UpdateRescalingInfo(); // Restore the global state of all applicable settings in the Values struct diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h index e7cb59ea5..4edfd2bfb 100644 --- a/src/common/settings_enums.h +++ b/src/common/settings_enums.h @@ -146,6 +146,8 @@ ENUM(AntiAliasing, None, Fxaa, Smaa, MaxEnum); ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch); +ENUM(ScreenshotAspectRatio, Auto, R16_9, R4_3, R21_9, R16_10); + template inline std::string CanonicalizeEnum(Type id) { const auto group = EnumMetadata::Canonicalizations(); -- cgit v1.2.3 From d9275b77570562a94c726f3fe630886c96850396 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 15 Aug 2023 22:42:28 -0400 Subject: yuzu-qt: Enable specifying screenshot resolution --- src/yuzu/bootmanager.cpp | 16 +++++- src/yuzu/configuration/configure_ui.cpp | 93 ++++++++++++++++++++++++++++++++- src/yuzu/configuration/configure_ui.ui | 51 ++++++++++++++++++ src/yuzu/uisettings.cpp | 31 +++++++++++ src/yuzu/uisettings.h | 10 ++++ 5 files changed, 198 insertions(+), 3 deletions(-) diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index bdd1497b5..593e59e8e 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -11,6 +11,8 @@ #include #include +#include "common/settings_enums.h" +#include "uisettings.h" #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA #include #include @@ -924,7 +926,19 @@ void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) { return; } - const Layout::FramebufferLayout layout{Layout::FrameLayoutFromResolutionScale(res_scale)}; + const Layout::FramebufferLayout layout{[res_scale]() { + if (UISettings::values.screenshot_height.GetValue() == 0 && + UISettings::values.screenshot_aspect_ratio.GetValue() == + Settings::ScreenshotAspectRatio::Auto) { + return Layout::FrameLayoutFromResolutionScale(res_scale); + } + const u32 height = UISettings::values.screenshot_height.GetValue(); + const u32 width = UISettings::CalculateWidth( + height, UISettings::ConvertScreenshotRatioToRatio( + UISettings::values.screenshot_aspect_ratio.GetValue())); + return Layout::DefaultFrameLayout(width, height); + }()}; + screenshot_image = QImage(QSize(layout.width, layout.height), QImage::Format_RGB32); renderer.RequestScreenshot( screenshot_image.bits(), diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index 2ebb80302..3c99c5709 100644 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp @@ -1,18 +1,30 @@ // SPDX-FileCopyrightText: 2016 Citra Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "yuzu/configuration/configure_ui.h" + #include +#include +#include +#include #include -#include +#include +#include +#include #include +#include +#include +#include +#include + #include "common/common_types.h" #include "common/fs/path_util.h" #include "common/logging/log.h" #include "common/settings.h" +#include "common/settings_enums.h" #include "core/core.h" #include "ui_configure_ui.h" -#include "yuzu/configuration/configure_ui.h" #include "yuzu/uisettings.h" namespace { @@ -54,6 +66,52 @@ QString GetTranslatedRowTextName(size_t index) { } } // Anonymous namespace +constexpr static std::array, 5> + screenshot_aspect_ratio_translations = { + std::pair{Settings::ScreenshotAspectRatio::Auto, "Auto"}, + std::pair{Settings::ScreenshotAspectRatio::R16_9, "16:9"}, + std::pair{Settings::ScreenshotAspectRatio::R4_3, "4:3"}, + std::pair{Settings::ScreenshotAspectRatio::R21_9, "21:9"}, + std::pair{Settings::ScreenshotAspectRatio::R16_10, "16:10"}, +}; + +static void PopulateAspectRatioComboBox(QComboBox* screenshot_aspect_ratio) { + screenshot_aspect_ratio->clear(); + + for (const auto& [value, name] : screenshot_aspect_ratio_translations) { + screenshot_aspect_ratio->addItem(QString::fromStdString(name)); + } +} + +static void PopulateResolutionComboBox(QComboBox* screenshot_height) { + screenshot_height->clear(); + + const auto& enumeration = + Settings::EnumMetadata::Canonicalizations(); + Settings::ResolutionScalingInfo info{}; + std::set resolutions{}; + for (const auto& [name, value] : enumeration) { + Settings::TranslateResolutionInfo(value, info); + u32 height_undocked = 720 * info.up_factor; + u32 height_docked = 1080 * info.up_factor; + resolutions.emplace(height_undocked); + resolutions.emplace(height_docked); + } + + screenshot_height->addItem(QStringLiteral("0")); + for (const auto res : resolutions) { + screenshot_height->addItem(QString::fromStdString(std::to_string(res))); + } +} + +static u32 HeightToInt(const QString& height) { + try { + return std::stoi(height.toStdString()); + } catch (std::invalid_argument& e) { + return 0; + } +} + ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) : QWidget(parent), ui{std::make_unique()}, system{system_} { ui->setupUi(this); @@ -68,6 +126,9 @@ ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) InitializeIconSizeComboBox(); InitializeRowComboBoxes(); + PopulateAspectRatioComboBox(ui->screenshot_aspect_ratio); + PopulateResolutionComboBox(ui->screenshot_height); + SetConfiguration(); // Force game list reload if any of the relevant settings are changed. @@ -104,6 +165,25 @@ ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) ui->screenshot_path_edit->setText(dir); } }); + + const auto update_height_text = [this]() { + const auto index = ui->screenshot_aspect_ratio->currentIndex(); + const Settings::AspectRatio ratio = UISettings::ConvertScreenshotRatioToRatio( + screenshot_aspect_ratio_translations[index].first); + const auto height = HeightToInt(ui->screenshot_height->currentText()); + const auto width = UISettings::CalculateWidth(height, ratio); + if (height == 0) { + ui->screenshot_width->setText(QString::fromStdString(fmt::format("Auto"))); + } else { + ui->screenshot_width->setText(QString::fromStdString(std::to_string(width))); + } + }; + + connect(ui->screenshot_aspect_ratio, QOverload::of(&QComboBox::currentIndexChanged), + update_height_text); + connect(ui->screenshot_height, &QComboBox::currentTextChanged, update_height_text); + + update_height_text(); } ConfigureUi::~ConfigureUi() = default; @@ -123,6 +203,15 @@ void ConfigureUi::ApplyConfiguration() { UISettings::values.enable_screenshot_save_as = ui->enable_screenshot_save_as->isChecked(); Common::FS::SetYuzuPath(Common::FS::YuzuPath::ScreenshotsDir, ui->screenshot_path_edit->text().toStdString()); + + const auto ratio = + screenshot_aspect_ratio_translations[ui->screenshot_aspect_ratio->currentIndex()].first; + UISettings::values.screenshot_aspect_ratio.SetValue(ratio); + const u32 height = HeightToInt(ui->screenshot_height->currentText()); + UISettings::values.screenshot_height.SetValue(height); + UISettings::values.screenshot_width.SetValue( + UISettings::CalculateWidth(height, UISettings::ConvertScreenshotRatioToRatio(ratio))); + system.ApplySettings(); } diff --git a/src/yuzu/configuration/configure_ui.ui b/src/yuzu/configuration/configure_ui.ui index 10bb27312..906fdd5b3 100644 --- a/src/yuzu/configuration/configure_ui.ui +++ b/src/yuzu/configuration/configure_ui.ui @@ -201,6 +201,57 @@ + + + + 6 + + + + + Resolution: + + + + + + + + + + Aspect Ratio: + + + + + + + + + true + + + + 0 + 0 + + + + true + + + + + + + true + + + + + + + diff --git a/src/yuzu/uisettings.cpp b/src/yuzu/uisettings.cpp index f03dc01dd..3ab0d1b45 100644 --- a/src/yuzu/uisettings.cpp +++ b/src/yuzu/uisettings.cpp @@ -36,4 +36,35 @@ bool IsDarkTheme() { Values values = {}; +u32 CalculateWidth(u32 height, Settings::AspectRatio ratio) { + switch (ratio) { + case Settings::AspectRatio::R4_3: + return height * 4 / 3; + case Settings::AspectRatio::R21_9: + return height * 21 / 9; + case Settings::AspectRatio::R16_10: + return height * 16 / 10; + case Settings::AspectRatio::R16_9: + case Settings::AspectRatio::Stretch: + break; + } + return height * 16 / 9; +} + +Settings::AspectRatio ConvertScreenshotRatioToRatio(Settings::ScreenshotAspectRatio ratio) { + switch (ratio) { + case Settings::ScreenshotAspectRatio::Auto: + return Settings::values.aspect_ratio.GetValue(); + case Settings::ScreenshotAspectRatio::R16_9: + return Settings::AspectRatio::R16_9; + case Settings::ScreenshotAspectRatio::R4_3: + return Settings::AspectRatio::R4_3; + case Settings::ScreenshotAspectRatio::R21_9: + return Settings::AspectRatio::R21_9; + case Settings::ScreenshotAspectRatio::R16_10: + return Settings::AspectRatio::R16_10; + } + return Settings::AspectRatio::R16_9; +} + } // namespace UISettings diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index c9c89cee4..7b5d630d7 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h @@ -13,6 +13,7 @@ #include #include "common/common_types.h" #include "common/settings.h" +#include "common/settings_enums.h" using Settings::Category; using Settings::Setting; @@ -127,8 +128,14 @@ struct Values { // logging Setting show_console{linkage, false, "showConsole", Category::Ui}; + // Screenshots Setting enable_screenshot_save_as{linkage, true, "enable_screenshot_save_as", Category::Screenshots}; + Setting screenshot_height{linkage, 0, "screenshot_height", Category::Screenshots}; + Setting screenshot_width{linkage, 0, "screenshot_width", Category::Screenshots}; + Setting screenshot_aspect_ratio{ + linkage, Settings::ScreenshotAspectRatio::Auto, "screenshot_aspect_ratio", + Category::Screenshots}; QString roms_path; QString symbols_path; @@ -187,6 +194,9 @@ struct Values { extern Values values; +u32 CalculateWidth(u32 height, Settings::AspectRatio ratio); +Settings::AspectRatio ConvertScreenshotRatioToRatio(Settings::ScreenshotAspectRatio ratio); + } // namespace UISettings Q_DECLARE_METATYPE(UISettings::GameDir*); -- cgit v1.2.3 From bc5ec1049881e0cc3d19eca1f9b854b2bb762540 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 15 Aug 2023 22:57:38 -0400 Subject: bootmanager: Consider the default resolution --- src/yuzu/bootmanager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 593e59e8e..e522845a3 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -932,7 +932,11 @@ void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) { Settings::ScreenshotAspectRatio::Auto) { return Layout::FrameLayoutFromResolutionScale(res_scale); } - const u32 height = UISettings::values.screenshot_height.GetValue(); + u32 height = UISettings::values.screenshot_height.GetValue(); + if (height == 0) { + height = Settings::values.use_docked_mode.GetValue() ? 1080 : 720; + height *= Settings::values.resolution_info.up_factor; + } const u32 width = UISettings::CalculateWidth( height, UISettings::ConvertScreenshotRatioToRatio( UISettings::values.screenshot_aspect_ratio.GetValue())); -- cgit v1.2.3 From 227950ac99dcea16c9eebbdab93d3c1e2f24a894 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 15 Aug 2023 23:07:49 -0400 Subject: config: Read the entire screenshots category --- src/yuzu/configuration/config.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index b2405f9b8..b22c83303 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -592,8 +592,7 @@ void Config::ReadRendererValues() { void Config::ReadScreenshotValues() { qt_config->beginGroup(QStringLiteral("Screenshots")); - UISettings::values.enable_screenshot_save_as = - ReadSetting(QStringLiteral("enable_screenshot_save_as"), true).toBool(); + ReadCategory(Settings::Category::Screenshots); FS::SetYuzuPath( FS::YuzuPath::ScreenshotsDir, qt_config -- cgit v1.2.3 From 95409c68597c509e9f6ced959a73a41a05de372c Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 15 Aug 2023 23:08:02 -0400 Subject: configure_ui: Update the screenshots data --- src/yuzu/configuration/configure_ui.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index 3c99c5709..77aff01b7 100644 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp @@ -166,7 +166,7 @@ ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) } }); - const auto update_height_text = [this]() { + const auto update_width_text = [this]() { const auto index = ui->screenshot_aspect_ratio->currentIndex(); const Settings::AspectRatio ratio = UISettings::ConvertScreenshotRatioToRatio( screenshot_aspect_ratio_translations[index].first); @@ -180,10 +180,10 @@ ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) }; connect(ui->screenshot_aspect_ratio, QOverload::of(&QComboBox::currentIndexChanged), - update_height_text); - connect(ui->screenshot_height, &QComboBox::currentTextChanged, update_height_text); + update_width_text); + connect(ui->screenshot_height, &QComboBox::currentTextChanged, update_width_text); - update_height_text(); + update_width_text(); } ConfigureUi::~ConfigureUi() = default; @@ -236,6 +236,15 @@ void ConfigureUi::SetConfiguration() { UISettings::values.enable_screenshot_save_as.GetValue()); ui->screenshot_path_edit->setText(QString::fromStdString( Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir))); + + for (u32 i = 0; i < screenshot_aspect_ratio_translations.size(); i++) { + const auto ratio = screenshot_aspect_ratio_translations[i].first; + if (ratio == UISettings::values.screenshot_aspect_ratio.GetValue()) { + ui->screenshot_aspect_ratio->setCurrentIndex(i); + } + } + ui->screenshot_height->setCurrentText( + QString::fromStdString(fmt::format("{}", UISettings::values.screenshot_height.GetValue()))); } void ConfigureUi::changeEvent(QEvent* event) { -- cgit v1.2.3 From 76a03e99b68ea691029cf7eef20a55e3cb1837ad Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Wed, 16 Aug 2023 00:18:16 -0400 Subject: bootmanager: Remove old path Causes issues with different selected aspect ratios in graphics. --- src/yuzu/bootmanager.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index e522845a3..2a9f423a0 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -918,7 +918,6 @@ void GRenderWindow::ReleaseRenderTarget() { void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) { auto& renderer = system.Renderer(); - const f32 res_scale = Settings::values.resolution_info.up_factor; if (renderer.IsScreenshotPending()) { LOG_WARNING(Render, @@ -926,15 +925,11 @@ void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) { return; } - const Layout::FramebufferLayout layout{[res_scale]() { - if (UISettings::values.screenshot_height.GetValue() == 0 && - UISettings::values.screenshot_aspect_ratio.GetValue() == - Settings::ScreenshotAspectRatio::Auto) { - return Layout::FrameLayoutFromResolutionScale(res_scale); - } + const Layout::FramebufferLayout layout{[]() { u32 height = UISettings::values.screenshot_height.GetValue(); if (height == 0) { - height = Settings::values.use_docked_mode.GetValue() ? 1080 : 720; + height = Settings::values.use_docked_mode.GetValue() ? Layout::ScreenDocked::Height + : Layout::ScreenUndocked::Height; height *= Settings::values.resolution_info.up_factor; } const u32 width = UISettings::CalculateWidth( -- cgit v1.2.3 From 96c98d09cb9200c9b623404381c33b3379411eeb Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Wed, 16 Aug 2023 00:18:47 -0400 Subject: yuzu-qt: Implement unspecified screenshot ratio --- src/common/settings_enums.h | 2 +- src/yuzu/bootmanager.cpp | 10 +++++++--- src/yuzu/configuration/configure_ui.cpp | 27 ++++++++++++++++++++------- src/yuzu/uisettings.cpp | 2 ++ 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h index 4edfd2bfb..7b2e558b6 100644 --- a/src/common/settings_enums.h +++ b/src/common/settings_enums.h @@ -146,7 +146,7 @@ ENUM(AntiAliasing, None, Fxaa, Smaa, MaxEnum); ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch); -ENUM(ScreenshotAspectRatio, Auto, R16_9, R4_3, R21_9, R16_10); +ENUM(ScreenshotAspectRatio, Auto, Unspecified, R16_9, R4_3, R21_9, R16_10); template inline std::string CanonicalizeEnum(Type id) { diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 2a9f423a0..24630e4cb 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -932,9 +932,13 @@ void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) { : Layout::ScreenUndocked::Height; height *= Settings::values.resolution_info.up_factor; } - const u32 width = UISettings::CalculateWidth( - height, UISettings::ConvertScreenshotRatioToRatio( - UISettings::values.screenshot_aspect_ratio.GetValue())); + const auto selected_ratio = UISettings::values.screenshot_aspect_ratio.GetValue(); + const u32 width = + selected_ratio == Settings::ScreenshotAspectRatio::Unspecified + ? UISettings::values.screenshot_width.GetValue() + : UISettings::CalculateWidth( + height, UISettings::ConvertScreenshotRatioToRatio( + UISettings::values.screenshot_aspect_ratio.GetValue())); return Layout::DefaultFrameLayout(width, height); }()}; diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index 77aff01b7..206af81a8 100644 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp @@ -66,9 +66,10 @@ QString GetTranslatedRowTextName(size_t index) { } } // Anonymous namespace -constexpr static std::array, 5> +constexpr static std::array, 6> screenshot_aspect_ratio_translations = { std::pair{Settings::ScreenshotAspectRatio::Auto, "Auto"}, + std::pair{Settings::ScreenshotAspectRatio::Unspecified, "Unspecified"}, std::pair{Settings::ScreenshotAspectRatio::R16_9, "16:9"}, std::pair{Settings::ScreenshotAspectRatio::R4_3, "4:3"}, std::pair{Settings::ScreenshotAspectRatio::R21_9, "21:9"}, @@ -104,7 +105,7 @@ static void PopulateResolutionComboBox(QComboBox* screenshot_height) { } } -static u32 HeightToInt(const QString& height) { +static u32 ScreenshotDimensionToInt(const QString& height) { try { return std::stoi(height.toStdString()); } catch (std::invalid_argument& e) { @@ -168,9 +169,16 @@ ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) const auto update_width_text = [this]() { const auto index = ui->screenshot_aspect_ratio->currentIndex(); - const Settings::AspectRatio ratio = UISettings::ConvertScreenshotRatioToRatio( - screenshot_aspect_ratio_translations[index].first); - const auto height = HeightToInt(ui->screenshot_height->currentText()); + const auto selected_ratio = screenshot_aspect_ratio_translations[index].first; + if (selected_ratio == Settings::ScreenshotAspectRatio::Unspecified) { + ui->screenshot_width->setReadOnly(false); + return; + } else { + ui->screenshot_width->setReadOnly(true); + } + const Settings::AspectRatio ratio = + UISettings::ConvertScreenshotRatioToRatio(selected_ratio); + const auto height = ScreenshotDimensionToInt(ui->screenshot_height->currentText()); const auto width = UISettings::CalculateWidth(height, ratio); if (height == 0) { ui->screenshot_width->setText(QString::fromStdString(fmt::format("Auto"))); @@ -207,10 +215,13 @@ void ConfigureUi::ApplyConfiguration() { const auto ratio = screenshot_aspect_ratio_translations[ui->screenshot_aspect_ratio->currentIndex()].first; UISettings::values.screenshot_aspect_ratio.SetValue(ratio); - const u32 height = HeightToInt(ui->screenshot_height->currentText()); + const u32 height = ScreenshotDimensionToInt(ui->screenshot_height->currentText()); + const u32 calculated_width = + UISettings::CalculateWidth(height, UISettings::ConvertScreenshotRatioToRatio(ratio)); + const u32 width_readout = ScreenshotDimensionToInt(ui->screenshot_width->text()); UISettings::values.screenshot_height.SetValue(height); UISettings::values.screenshot_width.SetValue( - UISettings::CalculateWidth(height, UISettings::ConvertScreenshotRatioToRatio(ratio))); + ratio == Settings::ScreenshotAspectRatio::Unspecified ? width_readout : calculated_width); system.ApplySettings(); } @@ -245,6 +256,8 @@ void ConfigureUi::SetConfiguration() { } ui->screenshot_height->setCurrentText( QString::fromStdString(fmt::format("{}", UISettings::values.screenshot_height.GetValue()))); + ui->screenshot_width->setText( + QString::fromStdString(fmt::format("{}", UISettings::values.screenshot_width.GetValue()))); } void ConfigureUi::changeEvent(QEvent* event) { diff --git a/src/yuzu/uisettings.cpp b/src/yuzu/uisettings.cpp index 3ab0d1b45..606268a5f 100644 --- a/src/yuzu/uisettings.cpp +++ b/src/yuzu/uisettings.cpp @@ -63,6 +63,8 @@ Settings::AspectRatio ConvertScreenshotRatioToRatio(Settings::ScreenshotAspectRa return Settings::AspectRatio::R21_9; case Settings::ScreenshotAspectRatio::R16_10: return Settings::AspectRatio::R16_10; + case Settings::ScreenshotAspectRatio::Unspecified: + break; } return Settings::AspectRatio::R16_9; } -- cgit v1.2.3 From 6fe51b48e960e81b1304d833b2d69b468a4a238a Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Wed, 16 Aug 2023 16:12:42 -0400 Subject: yuzu-qt: Screenshots depend more on the graphics settings --- src/common/settings_enums.h | 2 - src/yuzu/bootmanager.cpp | 7 +- src/yuzu/configuration/configure_dialog.cpp | 8 +- src/yuzu/configuration/configure_dialog.h | 2 +- src/yuzu/configuration/configure_graphics.cpp | 44 ++++++++-- src/yuzu/configuration/configure_graphics.h | 17 ++-- src/yuzu/configuration/configure_per_game.cpp | 3 +- src/yuzu/configuration/configure_ui.cpp | 113 +++++++++++--------------- src/yuzu/configuration/configure_ui.h | 8 ++ src/yuzu/configuration/configure_ui.ui | 42 +++------- src/yuzu/uisettings.cpp | 18 ---- src/yuzu/uisettings.h | 5 -- 12 files changed, 127 insertions(+), 142 deletions(-) diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h index 7b2e558b6..e7cb59ea5 100644 --- a/src/common/settings_enums.h +++ b/src/common/settings_enums.h @@ -146,8 +146,6 @@ ENUM(AntiAliasing, None, Fxaa, Smaa, MaxEnum); ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch); -ENUM(ScreenshotAspectRatio, Auto, Unspecified, R16_9, R4_3, R21_9, R16_10); - template inline std::string CanonicalizeEnum(Type id) { const auto group = EnumMetadata::Canonicalizations(); diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 24630e4cb..407988b8f 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -932,13 +932,8 @@ void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) { : Layout::ScreenUndocked::Height; height *= Settings::values.resolution_info.up_factor; } - const auto selected_ratio = UISettings::values.screenshot_aspect_ratio.GetValue(); const u32 width = - selected_ratio == Settings::ScreenshotAspectRatio::Unspecified - ? UISettings::values.screenshot_width.GetValue() - : UISettings::CalculateWidth( - height, UISettings::ConvertScreenshotRatioToRatio( - UISettings::values.screenshot_aspect_ratio.GetValue())); + UISettings::CalculateWidth(height, Settings::values.aspect_ratio.GetValue()); return Layout::DefaultFrameLayout(width, height); }()}; diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 3c6bb3eb1..0ad95cc02 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp @@ -4,6 +4,7 @@ #include #include "common/logging/log.h" #include "common/settings.h" +#include "common/settings_enums.h" #include "core/core.h" #include "ui_configure.h" #include "vk_device_info.h" @@ -41,16 +42,19 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_, general_tab{std::make_unique(system_, nullptr, *builder, this)}, graphics_advanced_tab{ std::make_unique(system_, nullptr, *builder, this)}, + ui_tab{std::make_unique(system_, this)}, graphics_tab{std::make_unique( system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); }, + [this](Settings::AspectRatio ratio, Settings::ResolutionSetup setup) { + ui_tab->UpdateScreenshotInfo(ratio, setup); + }, nullptr, *builder, this)}, hotkeys_tab{std::make_unique(system_.HIDCore(), this)}, input_tab{std::make_unique(system_, this)}, network_tab{std::make_unique(system_, this)}, profile_tab{std::make_unique(system_, this)}, system_tab{std::make_unique(system_, nullptr, *builder, this)}, - ui_tab{std::make_unique(system_, this)}, web_tab{std::make_unique( - this)} { + web_tab{std::make_unique(this)} { Settings::SetConfiguringGlobal(true); ui->setupUi(this); diff --git a/src/yuzu/configuration/configure_dialog.h b/src/yuzu/configuration/configure_dialog.h index 96e9a8c3e..b28ce288c 100644 --- a/src/yuzu/configuration/configure_dialog.h +++ b/src/yuzu/configuration/configure_dialog.h @@ -81,12 +81,12 @@ private: std::unique_ptr filesystem_tab; std::unique_ptr general_tab; std::unique_ptr graphics_advanced_tab; + std::unique_ptr ui_tab; std::unique_ptr graphics_tab; std::unique_ptr hotkeys_tab; std::unique_ptr input_tab; std::unique_ptr network_tab; std::unique_ptr profile_tab; std::unique_ptr system_tab; - std::unique_ptr ui_tab; std::unique_ptr web_tab; }; diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index a94fbc89a..8622dc184 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -77,13 +78,16 @@ static constexpr Settings::VSyncMode PresentModeToSetting(VkPresentModeKHR mode) } } -ConfigureGraphics::ConfigureGraphics(const Core::System& system_, - std::vector& records_, - const std::function& expose_compute_option_, - std::shared_ptr> group_, - const ConfigurationShared::Builder& builder, QWidget* parent) +ConfigureGraphics::ConfigureGraphics( + const Core::System& system_, std::vector& records_, + const std::function& expose_compute_option_, + const std::function& + update_aspect_ratio_, + std::shared_ptr> group_, + const ConfigurationShared::Builder& builder, QWidget* parent) : ConfigurationShared::Tab(group_, parent), ui{std::make_unique()}, - records{records_}, expose_compute_option{expose_compute_option_}, system{system_}, + records{records_}, expose_compute_option{expose_compute_option_}, + update_aspect_ratio{update_aspect_ratio_}, system{system_}, combobox_translations{builder.ComboboxTranslations()}, shader_mapping{ combobox_translations.at(Settings::EnumMetadata::Index())} { @@ -140,6 +144,26 @@ ConfigureGraphics::ConfigureGraphics(const Core::System& system_, UpdateBackgroundColorButton(new_bg_color); }); + const auto& update_screenshot_info = [this, &builder]() { + const auto& combobox_enumerations = builder.ComboboxTranslations().at( + Settings::EnumMetadata::Index()); + const auto index = aspect_ratio_combobox->currentIndex(); + const auto ratio = static_cast(combobox_enumerations[index].first); + + const auto& combobox_enumerations_resolution = builder.ComboboxTranslations().at( + Settings::EnumMetadata::Index()); + const auto res_index = resolution_combobox->currentIndex(); + const auto setup = static_cast( + combobox_enumerations_resolution[res_index].first); + + update_aspect_ratio(ratio, setup); + }; + + connect(aspect_ratio_combobox, QOverload::of(&QComboBox::currentIndexChanged), + update_screenshot_info); + connect(resolution_combobox, QOverload::of(&QComboBox::currentIndexChanged), + update_screenshot_info); + api_combobox->setEnabled(!UISettings::values.has_broken_vulkan && api_combobox->isEnabled()); ui->api_widget->setEnabled( (!UISettings::values.has_broken_vulkan || Settings::IsConfiguringGlobal()) && @@ -280,6 +304,14 @@ void ConfigureGraphics::Setup(const ConfigurationShared::Builder& builder) { // Keep track of vsync_mode's combobox so we can populate it vsync_mode_combobox = widget->combobox; hold_graphics.emplace(setting->Id(), widget); + } else if (setting->Id() == Settings::values.aspect_ratio.Id()) { + // Keep track of the aspect ratio combobox to update other UI tabs that need it + aspect_ratio_combobox = widget->combobox; + hold_graphics.emplace(setting->Id(), widget); + } else if (setting->Id() == Settings::values.resolution_setup.Id()) { + // Keep track of the resolution combobox to update other UI tabs that need it + resolution_combobox = widget->combobox; + hold_graphics.emplace(setting->Id(), widget); } else { hold_graphics.emplace(setting->Id(), widget); } diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h index 02d9b00f1..9c24a56db 100644 --- a/src/yuzu/configuration/configure_graphics.h +++ b/src/yuzu/configuration/configure_graphics.h @@ -14,6 +14,7 @@ #include #include #include "common/common_types.h" +#include "common/settings_enums.h" #include "configuration/shared_translation.h" #include "vk_device_info.h" #include "yuzu/configuration/configuration_shared.h" @@ -43,12 +44,13 @@ class Builder; class ConfigureGraphics : public ConfigurationShared::Tab { public: - explicit ConfigureGraphics(const Core::System& system_, - std::vector& records, - const std::function& expose_compute_option_, - std::shared_ptr> group, - const ConfigurationShared::Builder& builder, - QWidget* parent = nullptr); + explicit ConfigureGraphics( + const Core::System& system_, std::vector& records, + const std::function& expose_compute_option, + const std::function& + update_aspect_ratio, + std::shared_ptr> group, + const ConfigurationShared::Builder& builder, QWidget* parent = nullptr); ~ConfigureGraphics() override; void ApplyConfiguration() override; @@ -91,6 +93,7 @@ private: u32 vulkan_device{}; Settings::ShaderBackend shader_backend{}; const std::function& expose_compute_option; + const std::function update_aspect_ratio; const Core::System& system; const ConfigurationShared::ComboboxTranslationMap& combobox_translations; @@ -104,4 +107,6 @@ private: QWidget* vulkan_device_widget; QWidget* api_widget; QWidget* shader_backend_widget; + QComboBox* aspect_ratio_combobox; + QComboBox* resolution_combobox; }; diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp index cd8b3012e..4f9e8db08 100644 --- a/src/yuzu/configuration/configure_per_game.cpp +++ b/src/yuzu/configuration/configure_per_game.cpp @@ -17,6 +17,7 @@ #include #include "common/fs/fs_util.h" +#include "common/settings_enums.h" #include "configuration/shared_widget.h" #include "core/core.h" #include "core/file_sys/control_metadata.h" @@ -57,7 +58,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st std::make_unique(system_, tab_group, *builder, this); graphics_tab = std::make_unique( system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); }, - tab_group, *builder, this); + [](Settings::AspectRatio, Settings::ResolutionSetup) {}, tab_group, *builder, this); input_tab = std::make_unique(system_, game_config.get(), this); system_tab = std::make_unique(system_, tab_group, *builder, this); diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index 206af81a8..8d298993a 100644 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp @@ -24,6 +24,7 @@ #include "common/settings.h" #include "common/settings_enums.h" #include "core/core.h" +#include "core/frontend/framebuffer_layout.h" #include "ui_configure_ui.h" #include "yuzu/uisettings.h" @@ -66,40 +67,27 @@ QString GetTranslatedRowTextName(size_t index) { } } // Anonymous namespace -constexpr static std::array, 6> - screenshot_aspect_ratio_translations = { - std::pair{Settings::ScreenshotAspectRatio::Auto, "Auto"}, - std::pair{Settings::ScreenshotAspectRatio::Unspecified, "Unspecified"}, - std::pair{Settings::ScreenshotAspectRatio::R16_9, "16:9"}, - std::pair{Settings::ScreenshotAspectRatio::R4_3, "4:3"}, - std::pair{Settings::ScreenshotAspectRatio::R21_9, "21:9"}, - std::pair{Settings::ScreenshotAspectRatio::R16_10, "16:10"}, -}; - -static void PopulateAspectRatioComboBox(QComboBox* screenshot_aspect_ratio) { - screenshot_aspect_ratio->clear(); - - for (const auto& [value, name] : screenshot_aspect_ratio_translations) { - screenshot_aspect_ratio->addItem(QString::fromStdString(name)); - } +static float GetUpFactor(Settings::ResolutionSetup res_setup) { + Settings::ResolutionScalingInfo info{}; + Settings::TranslateResolutionInfo(res_setup, info); + return info.up_factor; } -static void PopulateResolutionComboBox(QComboBox* screenshot_height) { +static void PopulateResolutionComboBox(QComboBox* screenshot_height, QWidget* parent) { screenshot_height->clear(); const auto& enumeration = Settings::EnumMetadata::Canonicalizations(); - Settings::ResolutionScalingInfo info{}; std::set resolutions{}; for (const auto& [name, value] : enumeration) { - Settings::TranslateResolutionInfo(value, info); - u32 height_undocked = 720 * info.up_factor; - u32 height_docked = 1080 * info.up_factor; + const float up_factor = GetUpFactor(value); + u32 height_undocked = Layout::ScreenUndocked::Height * up_factor; + u32 height_docked = Layout::ScreenDocked::Height * up_factor; resolutions.emplace(height_undocked); resolutions.emplace(height_docked); } - screenshot_height->addItem(QStringLiteral("0")); + screenshot_height->addItem(parent->tr("Auto", "Screenshot height option")); for (const auto res : resolutions) { screenshot_height->addItem(QString::fromStdString(std::to_string(res))); } @@ -114,7 +102,9 @@ static u32 ScreenshotDimensionToInt(const QString& height) { } ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) - : QWidget(parent), ui{std::make_unique()}, system{system_} { + : QWidget(parent), ui{std::make_unique()}, + ratio{Settings::values.aspect_ratio.GetValue()}, + resolution_setting{Settings::values.resolution_setup.GetValue()}, system{system_} { ui->setupUi(this); InitializeLanguageComboBox(); @@ -127,8 +117,7 @@ ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) InitializeIconSizeComboBox(); InitializeRowComboBoxes(); - PopulateAspectRatioComboBox(ui->screenshot_aspect_ratio); - PopulateResolutionComboBox(ui->screenshot_height); + PopulateResolutionComboBox(ui->screenshot_height, this); SetConfiguration(); @@ -167,31 +156,9 @@ ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) } }); - const auto update_width_text = [this]() { - const auto index = ui->screenshot_aspect_ratio->currentIndex(); - const auto selected_ratio = screenshot_aspect_ratio_translations[index].first; - if (selected_ratio == Settings::ScreenshotAspectRatio::Unspecified) { - ui->screenshot_width->setReadOnly(false); - return; - } else { - ui->screenshot_width->setReadOnly(true); - } - const Settings::AspectRatio ratio = - UISettings::ConvertScreenshotRatioToRatio(selected_ratio); - const auto height = ScreenshotDimensionToInt(ui->screenshot_height->currentText()); - const auto width = UISettings::CalculateWidth(height, ratio); - if (height == 0) { - ui->screenshot_width->setText(QString::fromStdString(fmt::format("Auto"))); - } else { - ui->screenshot_width->setText(QString::fromStdString(std::to_string(width))); - } - }; + connect(ui->screenshot_height, &QComboBox::currentTextChanged, [this]() { UpdateWidthText(); }); - connect(ui->screenshot_aspect_ratio, QOverload::of(&QComboBox::currentIndexChanged), - update_width_text); - connect(ui->screenshot_height, &QComboBox::currentTextChanged, update_width_text); - - update_width_text(); + UpdateWidthText(); } ConfigureUi::~ConfigureUi() = default; @@ -212,16 +179,8 @@ void ConfigureUi::ApplyConfiguration() { Common::FS::SetYuzuPath(Common::FS::YuzuPath::ScreenshotsDir, ui->screenshot_path_edit->text().toStdString()); - const auto ratio = - screenshot_aspect_ratio_translations[ui->screenshot_aspect_ratio->currentIndex()].first; - UISettings::values.screenshot_aspect_ratio.SetValue(ratio); const u32 height = ScreenshotDimensionToInt(ui->screenshot_height->currentText()); - const u32 calculated_width = - UISettings::CalculateWidth(height, UISettings::ConvertScreenshotRatioToRatio(ratio)); - const u32 width_readout = ScreenshotDimensionToInt(ui->screenshot_width->text()); UISettings::values.screenshot_height.SetValue(height); - UISettings::values.screenshot_width.SetValue( - ratio == Settings::ScreenshotAspectRatio::Unspecified ? width_readout : calculated_width); system.ApplySettings(); } @@ -248,16 +207,12 @@ void ConfigureUi::SetConfiguration() { ui->screenshot_path_edit->setText(QString::fromStdString( Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir))); - for (u32 i = 0; i < screenshot_aspect_ratio_translations.size(); i++) { - const auto ratio = screenshot_aspect_ratio_translations[i].first; - if (ratio == UISettings::values.screenshot_aspect_ratio.GetValue()) { - ui->screenshot_aspect_ratio->setCurrentIndex(i); - } + const auto height = UISettings::values.screenshot_height.GetValue(); + if (height == 0) { + ui->screenshot_height->setCurrentIndex(0); + } else { + ui->screenshot_height->setCurrentText(QStringLiteral("%1").arg(height)); } - ui->screenshot_height->setCurrentText( - QString::fromStdString(fmt::format("{}", UISettings::values.screenshot_height.GetValue()))); - ui->screenshot_width->setText( - QString::fromStdString(fmt::format("{}", UISettings::values.screenshot_width.GetValue()))); } void ConfigureUi::changeEvent(QEvent* event) { @@ -428,3 +383,29 @@ void ConfigureUi::OnLanguageChanged(int index) { emit LanguageChanged(ui->language_combobox->itemData(index).toString()); } + +void ConfigureUi::UpdateWidthText() { + const u32 height = ScreenshotDimensionToInt(ui->screenshot_height->currentText()); + const u32 width = UISettings::CalculateWidth(height, ratio); + if (height == 0) { + const auto up_factor = GetUpFactor(resolution_setting); + const u32 height_docked = Layout::ScreenDocked::Height * up_factor; + const u32 width_docked = UISettings::CalculateWidth(height_docked, ratio); + const u32 height_undocked = Layout::ScreenUndocked::Height * up_factor; + const u32 width_undocked = UISettings::CalculateWidth(height_undocked, ratio); + ui->screenshot_width->setText(tr("Auto (%1 x %2, %3 x %4)", "Screenshot width value") + .arg(width_undocked) + .arg(height_undocked) + .arg(width_docked) + .arg(height_docked)); + } else { + ui->screenshot_width->setText(QStringLiteral("%1 x").arg(width)); + } +} + +void ConfigureUi::UpdateScreenshotInfo(Settings::AspectRatio ratio_, + Settings::ResolutionSetup resolution_setting_) { + ratio = ratio_; + resolution_setting = resolution_setting_; + UpdateWidthText(); +} diff --git a/src/yuzu/configuration/configure_ui.h b/src/yuzu/configuration/configure_ui.h index 95af8370e..2a2563a13 100644 --- a/src/yuzu/configuration/configure_ui.h +++ b/src/yuzu/configuration/configure_ui.h @@ -5,6 +5,7 @@ #include #include +#include "common/settings_enums.h" namespace Core { class System; @@ -23,6 +24,9 @@ public: void ApplyConfiguration(); + void UpdateScreenshotInfo(Settings::AspectRatio ratio, + Settings::ResolutionSetup resolution_info); + private slots: void OnLanguageChanged(int index); @@ -44,7 +48,11 @@ private: void UpdateFirstRowComboBox(bool init = false); void UpdateSecondRowComboBox(bool init = false); + void UpdateWidthText(); + std::unique_ptr ui; + Settings::AspectRatio ratio; + Settings::ResolutionSetup resolution_setting; Core::System& system; }; diff --git a/src/yuzu/configuration/configure_ui.ui b/src/yuzu/configuration/configure_ui.ui index 906fdd5b3..cb66ef104 100644 --- a/src/yuzu/configuration/configure_ui.ui +++ b/src/yuzu/configuration/configure_ui.ui @@ -7,7 +7,7 @@ 0 0 363 - 562 + 603 @@ -206,38 +206,15 @@ 6 - - - - Resolution: - - - - - - - - - Aspect Ratio: - - - - - - - true - - - - 0 - 0 - + + + TextLabel - - true + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -250,6 +227,13 @@ + + + + Resolution: + + + diff --git a/src/yuzu/uisettings.cpp b/src/yuzu/uisettings.cpp index 606268a5f..78f927ba9 100644 --- a/src/yuzu/uisettings.cpp +++ b/src/yuzu/uisettings.cpp @@ -51,22 +51,4 @@ u32 CalculateWidth(u32 height, Settings::AspectRatio ratio) { return height * 16 / 9; } -Settings::AspectRatio ConvertScreenshotRatioToRatio(Settings::ScreenshotAspectRatio ratio) { - switch (ratio) { - case Settings::ScreenshotAspectRatio::Auto: - return Settings::values.aspect_ratio.GetValue(); - case Settings::ScreenshotAspectRatio::R16_9: - return Settings::AspectRatio::R16_9; - case Settings::ScreenshotAspectRatio::R4_3: - return Settings::AspectRatio::R4_3; - case Settings::ScreenshotAspectRatio::R21_9: - return Settings::AspectRatio::R21_9; - case Settings::ScreenshotAspectRatio::R16_10: - return Settings::AspectRatio::R16_10; - case Settings::ScreenshotAspectRatio::Unspecified: - break; - } - return Settings::AspectRatio::R16_9; -} - } // namespace UISettings diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 7b5d630d7..8efd63f31 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h @@ -132,10 +132,6 @@ struct Values { Setting enable_screenshot_save_as{linkage, true, "enable_screenshot_save_as", Category::Screenshots}; Setting screenshot_height{linkage, 0, "screenshot_height", Category::Screenshots}; - Setting screenshot_width{linkage, 0, "screenshot_width", Category::Screenshots}; - Setting screenshot_aspect_ratio{ - linkage, Settings::ScreenshotAspectRatio::Auto, "screenshot_aspect_ratio", - Category::Screenshots}; QString roms_path; QString symbols_path; @@ -195,7 +191,6 @@ struct Values { extern Values values; u32 CalculateWidth(u32 height, Settings::AspectRatio ratio); -Settings::AspectRatio ConvertScreenshotRatioToRatio(Settings::ScreenshotAspectRatio ratio); } // namespace UISettings -- cgit v1.2.3 From e28b93695096a15aa46eb7ffe9ab66a92d7d8330 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Wed, 16 Aug 2023 16:28:44 -0400 Subject: configure_ui: Silence MSVC warning --- src/yuzu/configuration/configure_ui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index 8d298993a..34ab01617 100644 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp @@ -96,7 +96,7 @@ static void PopulateResolutionComboBox(QComboBox* screenshot_height, QWidget* pa static u32 ScreenshotDimensionToInt(const QString& height) { try { return std::stoi(height.toStdString()); - } catch (std::invalid_argument& e) { + } catch (std::invalid_argument&) { return 0; } } -- cgit v1.2.3 From 6af8cca2c1596f935cc9f71bf8b4b1497b9db5f7 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Wed, 16 Aug 2023 22:57:19 -0400 Subject: uisettings: Add TODO for stretched aspect being ignored --- src/yuzu/uisettings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/yuzu/uisettings.cpp b/src/yuzu/uisettings.cpp index 78f927ba9..1c833767b 100644 --- a/src/yuzu/uisettings.cpp +++ b/src/yuzu/uisettings.cpp @@ -46,6 +46,7 @@ u32 CalculateWidth(u32 height, Settings::AspectRatio ratio) { return height * 16 / 10; case Settings::AspectRatio::R16_9: case Settings::AspectRatio::Stretch: + // TODO: Move this function wherever appropriate to implement Stretched aspect break; } return height * 16 / 9; -- cgit v1.2.3