diff --git a/src/android/app/src/main/java/io/github/lime3ds/android/display/ScreenAdjustmentUtil.kt b/src/android/app/src/main/java/io/github/lime3ds/android/display/ScreenAdjustmentUtil.kt index 863b0ba2c..01abaf2dd 100644 --- a/src/android/app/src/main/java/io/github/lime3ds/android/display/ScreenAdjustmentUtil.kt +++ b/src/android/app/src/main/java/io/github/lime3ds/android/display/ScreenAdjustmentUtil.kt @@ -27,7 +27,7 @@ class ScreenAdjustmentUtil( } fun cycleLayouts() { // TODO: figure out how to pull these from R.array - val landscape_values = intArrayOf(6,1,3,4,0,5); + val landscape_values = intArrayOf(2,1,3,4,0,5); val portrait_values = intArrayOf(0,1); if (NativeLibrary.isPortraitMode) { val current_layout = IntSetting.PORTRAIT_SCREEN_LAYOUT.int diff --git a/src/android/app/src/main/java/io/github/lime3ds/android/display/ScreenLayout.kt b/src/android/app/src/main/java/io/github/lime3ds/android/display/ScreenLayout.kt index b7617a85d..e3bc4101f 100644 --- a/src/android/app/src/main/java/io/github/lime3ds/android/display/ScreenLayout.kt +++ b/src/android/app/src/main/java/io/github/lime3ds/android/display/ScreenLayout.kt @@ -11,13 +11,12 @@ enum class ScreenLayout(val int: Int) { LARGE_SCREEN(2), SIDE_SCREEN(3), HYBRID_SCREEN(4), - CUSTOM_LAYOUT(5), - MOBILE_LANDSCAPE(6); + CUSTOM_LAYOUT(5); companion object { fun from(int: Int): ScreenLayout { - return entries.firstOrNull { it.int == int } ?: MOBILE_LANDSCAPE + return entries.firstOrNull { it.int == int } ?: LARGE_SCREEN } } } diff --git a/src/android/app/src/main/java/io/github/lime3ds/android/fragments/EmulationFragment.kt b/src/android/app/src/main/java/io/github/lime3ds/android/fragments/EmulationFragment.kt index 40c13c9f6..ae348edc3 100644 --- a/src/android/app/src/main/java/io/github/lime3ds/android/fragments/EmulationFragment.kt +++ b/src/android/app/src/main/java/io/github/lime3ds/android/fragments/EmulationFragment.kt @@ -806,14 +806,14 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram ScreenLayout.CUSTOM_LAYOUT.int -> R.id.menu_screen_layout_custom - else -> R.id.menu_screen_layout_landscape + else -> R.id.menu_screen_layout_largescreen } popupMenu.menu.findItem(layoutOptionMenuItem).setChecked(true) popupMenu.setOnMenuItemClickListener { when (it.itemId) { - R.id.menu_screen_layout_landscape -> { - screenAdjustmentUtil.changeScreenOrientation(ScreenLayout.MOBILE_LANDSCAPE.int) + R.id.menu_screen_layout_largescreen -> { + screenAdjustmentUtil.changeScreenOrientation(ScreenLayout.LARGE_SCREEN.int) true } diff --git a/src/android/app/src/main/jni/config.cpp b/src/android/app/src/main/jni/config.cpp index 320c27b32..e18c5a581 100644 --- a/src/android/app/src/main/jni/config.cpp +++ b/src/android/app/src/main/jni/config.cpp @@ -174,8 +174,18 @@ void Config::ReadValues() { ReadSetting("Renderer", Settings::values.bg_blue); // Layout - Settings::values.layout_option = static_cast(sdl2_config->GetInteger( - "Layout", "layout_option", static_cast(Settings::LayoutOption::LargeScreen))); + // Somewhat inelegant solution to ensure layout value is between 0 and 5 on read + // since older config files may have other values + int layoutInt = (int)sdl2_config->GetInteger( + "Layout", "layout_option", static_cast(Settings::LayoutOption::LargeScreen)); + if (layoutInt < 0 || layoutInt > 5) { + layoutInt = static_cast(Settings::LayoutOption::LargeScreen); + } + Settings::values.layout_option = static_cast(layoutInt); + + Settings::values.large_screen_proportion = + static_cast(sdl2_config->GetReal("Layout", "large_screen_proportion", 2.25)); + ReadSetting("Layout", Settings::values.custom_top_x); ReadSetting("Layout", Settings::values.custom_top_y); ReadSetting("Layout", Settings::values.custom_top_width); diff --git a/src/android/app/src/main/res/menu/menu_landscape_screen_layout.xml b/src/android/app/src/main/res/menu/menu_landscape_screen_layout.xml index e8f3c56a0..0fe950e17 100644 --- a/src/android/app/src/main/res/menu/menu_landscape_screen_layout.xml +++ b/src/android/app/src/main/res/menu/menu_landscape_screen_layout.xml @@ -4,8 +4,8 @@ + android:id="@+id/menu_screen_layout_largescreen" + android:title="@string/emulation_screen_layout_largescreen" /> - @string/emulation_screen_layout_landscape + @string/emulation_screen_layout_largescreen @string/emulation_screen_layout_single @string/emulation_screen_layout_sidebyside @string/emulation_screen_layout_hybrid @string/emulation_screen_layout_original @string/emulation_screen_layout_custom - + - 6 + 2 1 3 4 diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index 15b7755a7..9e4511172 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -363,7 +363,7 @@ Open Cheats Landscape Screen Layout Portrait Screen Layout - Default + Large Screen Portrait Single Screen Side by Side Screens diff --git a/src/common/settings.h b/src/common/settings.h index d7ccef156..7e2518b75 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -44,10 +44,6 @@ enum class LayoutOption : u32 { #endif HybridScreen, CustomLayout, - - // Similiar to LargeScreen, but better for mobile devices in landscape mode. The screens are - // clamped to the top of the frame, and the bottom screen is a bit bigger. - MobileLandscape, }; /** Defines the layout option for mobile portrait */ diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp index 4962c76f3..20edbad66 100644 --- a/src/core/frontend/emu_window.cpp +++ b/src/core/frontend/emu_window.cpp @@ -232,12 +232,6 @@ void EmuWindow::UpdateCurrentFramebufferLayout(u32 width, u32 height, bool is_po Settings::values.upright_screen.GetValue()); break; #endif - case Settings::LayoutOption::MobileLandscape: - layout = - Layout::LargeFrameLayout(width, height, Settings::values.swap_screen.GetValue(), - false, 2.25f, Layout::VerticalAlignment::Top); - break; - case Settings::LayoutOption::Default: default: layout = diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index c03926cbf..c587cbed3 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp @@ -204,7 +204,9 @@ FramebufferLayout LargeFrameLayout(u32 width, u32 height, bool swapped, bool upr float scale_factor, VerticalAlignment vertical_alignment) { ASSERT(width > 0); ASSERT(height > 0); - +#ifdef ANDROID + vertical_alignment = VerticalAlignment::Top; +#endif FramebufferLayout res{width, height, true, true, {}, {}, !upright}; // Split the window into two parts. Give 4x width to the main screen and 1x width to the small // To do that, find the total emulation box and maximize that based on window size @@ -512,23 +514,6 @@ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondar Settings::values.upright_screen.GetValue(), 1, VerticalAlignment::Middle); - case Settings::LayoutOption::MobileLandscape: { - constexpr float large_screen_proportion = 2.25f; - if (Settings::values.swap_screen.GetValue()) { - width = (Core::kScreenBottomWidth + - static_cast(Core::kScreenTopWidth / large_screen_proportion)) * - res_scale; - height = Core::kScreenBottomHeight * res_scale; - } else { - width = (Core::kScreenTopWidth + - static_cast(Core::kScreenBottomWidth / large_screen_proportion)) * - res_scale; - height = Core::kScreenTopHeight * res_scale; - } - return LargeFrameLayout(width, height, Settings::values.swap_screen.GetValue(), false, - large_screen_proportion, VerticalAlignment::Top); - } - case Settings::LayoutOption::Default: default: width = Core::kScreenTopWidth * res_scale; @@ -579,10 +564,7 @@ FramebufferLayout GetCardboardSettings(const FramebufferLayout& layout) { } } else { switch (Settings::values.layout_option.GetValue()) { - case Settings::LayoutOption::MobileLandscape: case Settings::LayoutOption::SideScreen: - // If orientation is portrait, only use MobilePortrait - cardboard_screen_width = top_screen_width + bottom_screen_width; cardboard_screen_height = is_swapped ? bottom_screen_height : top_screen_height; if (is_swapped)