diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp index 87e6ae576..b537620da 100644 --- a/src/core/frontend/emu_window.cpp +++ b/src/core/frontend/emu_window.cpp @@ -90,16 +90,21 @@ bool EmuWindow::IsWithinTouchscreen(const Layout::FramebufferLayout& layout, uns } std::tuple EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) const { + bool separate_win = false; +#ifndef ANDROID + separate_win = + (Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows); +#endif if (new_x >= framebuffer_layout.width / 2) { if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide && - Settings::values.layout_option.GetValue() != Settings::LayoutOption::SeparateWindows) + !separate_win) new_x -= framebuffer_layout.width / 2; else if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::CardboardVR) new_x -= (framebuffer_layout.width / 2) - (framebuffer_layout.cardboard.user_x_shift * 2); } if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide && - Settings::values.layout_option.GetValue() != Settings::LayoutOption::SeparateWindows) { + !separate_win) { new_x = std::max(new_x, framebuffer_layout.bottom_screen.left / 2); new_x = std::min(new_x, framebuffer_layout.bottom_screen.right / 2 - 1); } else { @@ -127,9 +132,15 @@ bool EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) { if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y)) return false; + bool separate_win = false; +#ifndef ANDROID + separate_win = + (Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows); +#endif + if (framebuffer_x >= framebuffer_layout.width / 2) { if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide && - Settings::values.layout_option.GetValue() != Settings::LayoutOption::SeparateWindows) + !separate_win) framebuffer_x -= framebuffer_layout.width / 2; else if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::CardboardVR) framebuffer_x -= @@ -137,7 +148,7 @@ bool EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) { } std::scoped_lock guard(touch_state->mutex); if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide && - Settings::values.layout_option.GetValue() != Settings::LayoutOption::SeparateWindows) { + !separate_win) { touch_state->touch_x = static_cast(framebuffer_x - framebuffer_layout.bottom_screen.left / 2) / (framebuffer_layout.bottom_screen.right / 2 - diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index 1c2e3b758..c528309bb 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp @@ -172,9 +172,13 @@ FramebufferLayout SingleFrameLayout(u32 width, u32 height, bool swapped, bool up bot_screen = MaxRectangle(screen_window_area, BOT_SCREEN_ASPECT_RATIO); emulation_aspect_ratio = (swapped) ? BOT_SCREEN_ASPECT_RATIO : TOP_SCREEN_ASPECT_RATIO; } + bool separate_win = false; +#ifndef ANDROID + separate_win = + (Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows); +#endif if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::FullSideBySide && - !(Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows && - swapped)) { + !(separate_win && swapped)) { emulation_aspect_ratio /= 2; } @@ -182,8 +186,7 @@ FramebufferLayout SingleFrameLayout(u32 width, u32 height, bool swapped, bool up if (window_aspect_ratio < emulation_aspect_ratio) { if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::FullSideBySide && - !(Settings::values.layout_option.GetValue() == - Settings::LayoutOption::SeparateWindows && swapped)) { + !(separate_win && swapped)) { top_screen = top_screen.TranslateX( (screen_window_area.GetWidth() / 2 - top_screen.GetWidth()) / 2); bot_screen = bot_screen.TranslateX( diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 5732e6795..cc95c1112 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -751,8 +751,8 @@ void RendererOpenGL::DrawTopScreen(const Layout::FramebufferLayout& layout, DrawSingleScreen(screen_infos[0], top_screen_left, top_screen_top, top_screen_width, top_screen_height, orientation); glUniform1i(uniform_layer, 1); - DrawSingleScreen(screen_infos[1], static_cast(top_screen_left + (layout.width / 2)), - top_screen_top, top_screen_width, top_screen_height, orientation); + DrawSingleScreen(screen_infos[1], static_cast(top_screen_left + (layout.width / 2)), + top_screen_top, top_screen_width, top_screen_height, orientation); break; } case Settings::StereoRenderOption::CardboardVR: { @@ -789,6 +789,12 @@ void RendererOpenGL::DrawBottomScreen(const Layout::FramebufferLayout& layout, const auto orientation = layout.is_rotated ? Layout::DisplayOrientation::Landscape : Layout::DisplayOrientation::Portrait; + bool separate_win = false; +#ifndef ANDROID + separate_win = + (Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows); +#endif + switch (Settings::values.render_3d.GetValue()) { case Settings::StereoRenderOption::Off: { DrawSingleScreen(screen_infos[2], bottom_screen_left, bottom_screen_top, @@ -796,7 +802,7 @@ void RendererOpenGL::DrawBottomScreen(const Layout::FramebufferLayout& layout, break; } case Settings::StereoRenderOption::SideBySide: { - if (Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows) { + if (separate_win) { DrawSingleScreen(screen_infos[2], bottom_screen_left, bottom_screen_top, bottom_screen_width, bottom_screen_height, orientation); } else { @@ -811,8 +817,8 @@ void RendererOpenGL::DrawBottomScreen(const Layout::FramebufferLayout& layout, } case Settings::StereoRenderOption::FullSideBySide: { DrawSingleScreen(screen_infos[2], bottom_screen_left, bottom_screen_top, - bottom_screen_width, bottom_screen_height, orientation); - if (Settings::values.layout_option.GetValue() != Settings::LayoutOption::SeparateWindows) { + bottom_screen_width, bottom_screen_height, orientation); + if (!separate_win) { glUniform1i(uniform_layer, 1); DrawSingleScreen( screen_infos[2], static_cast(bottom_screen_left + (layout.width / 2)), @@ -833,7 +839,7 @@ void RendererOpenGL::DrawBottomScreen(const Layout::FramebufferLayout& layout, case Settings::StereoRenderOption::Anaglyph: case Settings::StereoRenderOption::Interlaced: case Settings::StereoRenderOption::ReverseInterlaced: { - if (Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows) { + if (separate_win) { DrawSingleScreen(screen_infos[2], bottom_screen_left, bottom_screen_top, bottom_screen_width, bottom_screen_height, orientation); } else { diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index 69f216c84..2b29d73f5 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp @@ -744,6 +744,12 @@ void RendererVulkan::DrawBottomScreen(const Layout::FramebufferLayout& layout, const auto orientation = layout.is_rotated ? Layout::DisplayOrientation::Landscape : Layout::DisplayOrientation::Portrait; + bool separate_win = false; +#ifndef ANDROID + separate_win = + (Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows); +#endif + switch (Settings::values.render_3d.GetValue()) { case Settings::StereoRenderOption::Off: { DrawSingleScreen(2, bottom_screen_left, bottom_screen_top, bottom_screen_width, @@ -751,7 +757,7 @@ void RendererVulkan::DrawBottomScreen(const Layout::FramebufferLayout& layout, break; } case Settings::StereoRenderOption::SideBySide: { - if (Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows) { + if (separate_win) { DrawSingleScreen(2, bottom_screen_left, bottom_screen_top, bottom_screen_width, bottom_screen_height, orientation); } else { @@ -766,8 +772,8 @@ void RendererVulkan::DrawBottomScreen(const Layout::FramebufferLayout& layout, } case Settings::StereoRenderOption::FullSideBySide: { DrawSingleScreen(2, bottom_screen_left, bottom_screen_top, bottom_screen_width, - bottom_screen_height, orientation); - if (Settings::values.layout_option.GetValue() != Settings::LayoutOption::SeparateWindows) { + bottom_screen_height, orientation); + if (!separate_win) { draw_info.layer = 1; DrawSingleScreen(2, static_cast(bottom_screen_left + (layout.width / 2)), bottom_screen_top, bottom_screen_width, bottom_screen_height, @@ -787,7 +793,7 @@ void RendererVulkan::DrawBottomScreen(const Layout::FramebufferLayout& layout, case Settings::StereoRenderOption::Anaglyph: case Settings::StereoRenderOption::Interlaced: case Settings::StereoRenderOption::ReverseInterlaced: { - if (Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows) { + if (separate_win) { DrawSingleScreen(2, bottom_screen_left, bottom_screen_top, bottom_screen_width, bottom_screen_height, orientation); } else {