summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/settings_enums.h2
-rw-r--r--src/yuzu/bootmanager.cpp10
-rw-r--r--src/yuzu/configuration/configure_ui.cpp27
-rw-r--r--src/yuzu/uisettings.cpp2
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 <typename Type>
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<std::pair<Settings::ScreenshotAspectRatio, std::string>, 5>
+constexpr static std::array<std::pair<Settings::ScreenshotAspectRatio, std::string>, 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;
}