From 2282f6f3cff7fef521c9e79ca0011cd30d2c3412 Mon Sep 17 00:00:00 2001 From: Kleidis <167202775+kleidis@users.noreply.github.com> Date: Tue, 11 Mar 2025 15:21:51 +0100 Subject: [PATCH] Add upright boolean for portrait mode --- src/core/frontend/emu_window.cpp | 3 ++- src/core/frontend/framebuffer_layout.cpp | 7 ++++--- src/core/frontend/framebuffer_layout.h | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp index 6c2811cf0..aefb5184a 100644 --- a/src/core/frontend/emu_window.cpp +++ b/src/core/frontend/emu_window.cpp @@ -201,7 +201,8 @@ void EmuWindow::UpdateCurrentFramebufferLayout(u32 width, u32 height, bool is_po switch (portrait_layout_option) { case Settings::PortraitLayoutOption::PortraitTopFullWidth: layout = Layout::PortraitTopFullFrameLayout(width, height, - Settings::values.swap_screen.GetValue()); + Settings::values.swap_screen.GetValue(), + Settings::values.upright_screen.GetValue()); break; case Settings::PortraitLayoutOption::PortraitCustomLayout: layout = Layout::CustomFrameLayout( diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index 7cf52a29c..0f386781f 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp @@ -39,11 +39,11 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height, bool swapped, bool u Settings::SmallScreenPosition::BelowLarge); } -FramebufferLayout PortraitTopFullFrameLayout(u32 width, u32 height, bool swapped) { +FramebufferLayout PortraitTopFullFrameLayout(u32 width, u32 height, bool swapped, bool upright) { ASSERT(width > 0); ASSERT(height > 0); const float scale_factor = swapped ? 1.25f : 0.8f; - FramebufferLayout res = LargeFrameLayout(width, height, swapped, false, scale_factor, + FramebufferLayout res = LargeFrameLayout(width, height, swapped, upright, scale_factor, Settings::SmallScreenPosition::BelowLarge); const int shiftY = -(int)(swapped ? res.bottom_screen.top : res.top_screen.top); res.top_screen = res.top_screen.TranslateY(shiftY); @@ -365,7 +365,8 @@ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondar width = Core::kScreenTopWidth * res_scale; height = (Core::kScreenTopHeight + Core::kScreenBottomHeight) * res_scale; return PortraitTopFullFrameLayout(width, height, - Settings::values.swap_screen.GetValue()); + Settings::values.swap_screen.GetValue(), + Settings::values.upright_screen.GetValue()); } } else { auto layout_option = Settings::values.layout_option.GetValue(); diff --git a/src/core/frontend/framebuffer_layout.h b/src/core/frontend/framebuffer_layout.h index adcf26630..554f81d45 100644 --- a/src/core/frontend/framebuffer_layout.h +++ b/src/core/frontend/framebuffer_layout.h @@ -69,7 +69,8 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height, bool is_swapped, boo * @param is_swapped if true, the bottom screen will be displayed above the top screen * @return Newly created FramebufferLayout object with mobile portrait screen regions initialized */ -FramebufferLayout PortraitTopFullFrameLayout(u32 width, u32 height, bool is_swapped); +FramebufferLayout PortraitTopFullFrameLayout(u32 width, u32 height, bool is_swapped, + bool upright = false); /** * Factory method for constructing a FramebufferLayout with only the top or bottom screen