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 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/yuzu/bootmanager.cpp') 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(), -- 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(-) (limited to 'src/yuzu/bootmanager.cpp') 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 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(-) (limited to 'src/yuzu/bootmanager.cpp') 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/yuzu/bootmanager.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/yuzu/bootmanager.cpp') 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); }()}; -- 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/yuzu/bootmanager.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/yuzu/bootmanager.cpp') 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); }()}; -- cgit v1.2.3