diff --git a/src/android/app/src/main/jni/config.cpp b/src/android/app/src/main/jni/config.cpp index 17b0e1e9b..6abfbf2f1 100644 --- a/src/android/app/src/main/jni/config.cpp +++ b/src/android/app/src/main/jni/config.cpp @@ -188,17 +188,15 @@ void Config::ReadValues() { ReadSetting("Layout", Settings::values.cardboard_x_shift); ReadSetting("Layout", Settings::values.cardboard_y_shift); -#ifdef ANDROID ReadSetting("Layout", Settings::values.custom_portrait_layout); - ReadSetting("Layout", Settings::values.custom_portrait_top_left); - ReadSetting("Layout", Settings::values.custom_portrait_top_top); - ReadSetting("Layout", Settings::values.custom_portrait_top_right); - ReadSetting("Layout", Settings::values.custom_portrait_top_bottom); - ReadSetting("Layout", Settings::values.custom_portrait_bottom_left); - ReadSetting("Layout", Settings::values.custom_portrait_bottom_top); - ReadSetting("Layout", Settings::values.custom_portrait_bottom_right); - ReadSetting("Layout", Settings::values.custom_portrait_bottom_bottom); -#endif + ReadSetting("Layout", Settings::values.custom_portrait_top_x); + ReadSetting("Layout", Settings::values.custom_portrait_top_y); + ReadSetting("Layout", Settings::values.custom_portrait_top_width); + ReadSetting("Layout", Settings::values.custom_portrait_top_height); + ReadSetting("Layout", Settings::values.custom_portrait_bottom_x); + ReadSetting("Layout", Settings::values.custom_portrait_bottom_y); + ReadSetting("Layout", Settings::values.custom_portrait_bottom_width); + ReadSetting("Layout", Settings::values.custom_portrait_bottom_height); // Utility ReadSetting("Utility", Settings::values.dump_textures); diff --git a/src/android/app/src/main/jni/default_ini.h b/src/android/app/src/main/jni/default_ini.h index 856ad3eb4..02bc7f41b 100644 --- a/src/android/app/src/main/jni/default_ini.h +++ b/src/android/app/src/main/jni/default_ini.h @@ -206,14 +206,14 @@ custom_portrait_layout = # Screen placement when using Custom layout option # 0x, 0y is the top left corner of the render window. -custom_portrait_top_left = -custom_portrait_top_top = -custom_portrait_top_right = -custom_portrait_top_bottom = -custom_portrait_bottom_left = -custom_portrait_bottom_top = -custom_portrait_bottom_right = -custom_portrait_bottom_bottom = +custom_portrait_top_x = +custom_portrait_top_y = +custom_portrait_top_width = +custom_portrait_top_height = +custom_portrait_bottom_x = +custom_portrait_bottom_y = +custom_portrait_bottom_width = +custom_portrait_bottom_height = # Swaps the prominent screen with the other screen. # For example, if Single Screen is chosen, setting this to 1 will display the bottom screen instead of the top screen. diff --git a/src/common/settings.h b/src/common/settings.h index 38c70a2bc..3f294ae05 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -507,14 +507,14 @@ struct Values { Setting screen_bottom_topbottom_padding{0, "screen_bottom_topbottom_padding"}; Setting custom_portrait_layout{false, "custom_portrait_layout"}; - Setting custom_portrait_top_left{0, "custom_portrait_top_left"}; - Setting custom_portrait_top_top{0, "custom_portrait_top_top"}; - Setting custom_portrait_top_right{400, "custom_portrait_top_right"}; - Setting custom_portrait_top_bottom{240, "custom_portrait_top_bottom"}; - Setting custom_portrait_bottom_left{40, "custom_portrait_bottom_left"}; - Setting custom_portrait_bottom_top{240, "custom_portrait_bottom_top"}; - Setting custom_portrait_bottom_right{360, "custom_portrait_bottom_right"}; - Setting custom_portrait_bottom_bottom{480, "custom_portrait_bottom_bottom"}; + Setting custom_portrait_top_x{0, "custom_portrait_top_x"}; + Setting custom_portrait_top_y{0, "custom_portrait_top_y"}; + Setting custom_portrait_top_width{400, "custom_portrait_top_width"}; + Setting custom_portrait_top_height{240, "custom_portrait_top_height"}; + Setting custom_portrait_bottom_x{40, "custom_portrait_bottom_x"}; + Setting custom_portrait_bottom_y{240, "custom_portrait_bottom_y"}; + Setting custom_portrait_bottom_width{360, "custom_portrait_bottom_width"}; + Setting custom_portrait_bottom_height{480, "custom_portrait_bottom_height"}; SwitchableSetting bg_red{0.f, "bg_red"}; SwitchableSetting bg_green{0.f, "bg_green"}; diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index 44f82f012..c55444feb 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp @@ -387,25 +387,27 @@ FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped, bool ASSERT(height > 0); FramebufferLayout res{width, height, true, true, {}, {}, !Settings::values.upright_screen}; - u16 top_left = is_portrait_mode ? Settings::values.custom_portrait_top_left.GetValue() - : Settings::values.custom_top_left.GetValue(); - u16 top_right = is_portrait_mode ? Settings::values.custom_portrait_top_right.GetValue() - : Settings::values.custom_top_right.GetValue(); - u16 top_top = is_portrait_mode ? Settings::values.custom_portrait_top_top.GetValue() - : Settings::values.custom_top_top.GetValue(); - u16 top_bottom = is_portrait_mode ? Settings::values.custom_portrait_top_bottom.GetValue() - : Settings::values.custom_top_bottom.GetValue(); - u16 bottom_left = is_portrait_mode ? Settings::values.custom_portrait_bottom_left.GetValue() - : Settings::values.custom_bottom_left.GetValue(); - u16 bottom_right = is_portrait_mode ? Settings::values.custom_portrait_bottom_right.GetValue() - : Settings::values.custom_bottom_right.GetValue(); - u16 bottom_top = is_portrait_mode ? Settings::values.custom_portrait_bottom_top.GetValue() - : Settings::values.custom_bottom_top.GetValue(); - u16 bottom_bottom = is_portrait_mode ? Settings::values.custom_portrait_bottom_bottom.GetValue() - : Settings::values.custom_bottom_bottom.GetValue(); + u16 top_x = is_portrait_mode ? Settings::values.custom_portrait_top_x.GetValue() + : Settings::values.custom_top_x.GetValue(); + u16 top_width = is_portrait_mode ? Settings::values.custom_portrait_top_width.GetValue() + : Settings::values.custom_top_width.GetValue(); + u16 top_y = is_portrait_mode ? Settings::values.custom_portrait_top_y.GetValue() + : Settings::values.custom_top_y.GetValue(); + u16 top_height = is_portrait_mode ? Settings::values.custom_portrait_top_height.GetValue() + : Settings::values.custom_top_height.GetValue(); + u16 bottom_x = is_portrait_mode ? Settings::values.custom_portrait_bottom_x.GetValue() + : Settings::values.custom_bottom_x.GetValue(); + u16 bottom_width = is_portrait_mode ? Settings::values.custom_portrait_bottom_width.GetValue() + : Settings::values.custom_bottom_width.GetValue(); + u16 bottom_y = is_portrait_mode ? Settings::values.custom_portrait_bottom_y.GetValue() + : Settings::values.custom_bottom_y.GetValue(); + u16 bottom_height = is_portrait_mode ? Settings::values.custom_portrait_bottom_height.GetValue() + : Settings::values.custom_bottom_height.GetValue(); - Common::Rectangle top_screen{top_left, top_top, top_right, top_bottom}; - Common::Rectangle bot_screen{bottom_left, bottom_top, bottom_right, bottom_bottom}; + Common::Rectangle top_screen{top_x, top_y, (u32)(top_x + top_width), + (u32)(top_y + top_height)}; + Common::Rectangle bot_screen{bottom_x, bottom_y, (u32)(bottom_x + bottom_width), + (u32)(bottom_y + bottom_height)}; if (is_swapped) { res.top_screen = bot_screen; @@ -421,17 +423,25 @@ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondar bool is_portrait_mode = Settings::values.layout_option.GetValue() == Settings::LayoutOption::MobilePortrait; if (Settings::values.custom_layout.GetValue() == true && !is_portrait_mode) { - return CustomFrameLayout(std::max(Settings::values.custom_top_right.GetValue(), - Settings::values.custom_bottom_right.GetValue()), - std::max(Settings::values.custom_top_bottom.GetValue(), - Settings::values.custom_bottom_bottom.GetValue()), + return CustomFrameLayout(std::max(Settings::values.custom_top_x.GetValue() + + Settings::values.custom_top_width.GetValue(), + Settings::values.custom_bottom_x.GetValue() + + Settings::values.custom_bottom_width.GetValue()), + std::max(Settings::values.custom_top_y.GetValue() + + Settings::values.custom_top_height.GetValue(), + Settings::values.custom_bottom_y.GetValue() + + Settings::values.custom_bottom_height.GetValue()), Settings::values.swap_screen.GetValue(), is_portrait_mode); } else if (Settings::values.custom_portrait_layout.GetValue() == true && is_portrait_mode) { return CustomFrameLayout( - std::max(Settings::values.custom_portrait_top_right.GetValue(), - Settings::values.custom_portrait_bottom_right.GetValue()), - std::max(Settings::values.custom_portrait_top_bottom.GetValue(), - Settings::values.custom_portrait_bottom_bottom.GetValue()), + std::max(Settings::values.custom_portrait_top_x.GetValue() + + Settings::values.custom_portrait_top_width.GetValue(), + Settings::values.custom_portrait_bottom_x.GetValue() + + Settings::values.custom_portrait_bottom_width.GetValue()), + std::max(Settings::values.custom_portrait_top_y.GetValue() + + Settings::values.custom_portrait_top_height.GetValue(), + Settings::values.custom_portrait_bottom_y.GetValue() + + Settings::values.custom_portrait_bottom_height.GetValue()), Settings::values.swap_screen.GetValue(), is_portrait_mode); } diff --git a/src/lime/config.cpp b/src/lime/config.cpp index 8532cf83c..e18de2ad2 100644 --- a/src/lime/config.cpp +++ b/src/lime/config.cpp @@ -184,14 +184,14 @@ void Config::ReadValues() { ReadSetting("Layout", Settings::values.screen_bottom_topbottom_padding); ReadSetting("Layout", Settings::values.custom_portrait_layout); - ReadSetting("Layout", Settings::values.custom_portrait_top_left); - ReadSetting("Layout", Settings::values.custom_portrait_top_top); - ReadSetting("Layout", Settings::values.custom_portrait_top_right); - ReadSetting("Layout", Settings::values.custom_portrait_top_bottom); - ReadSetting("Layout", Settings::values.custom_portrait_bottom_left); - ReadSetting("Layout", Settings::values.custom_portrait_bottom_top); - ReadSetting("Layout", Settings::values.custom_portrait_bottom_right); - ReadSetting("Layout", Settings::values.custom_portrait_bottom_bottom); + ReadSetting("Layout", Settings::values.custom_portrait_top_x); + ReadSetting("Layout", Settings::values.custom_portrait_top_y); + ReadSetting("Layout", Settings::values.custom_portrait_top_width); + ReadSetting("Layout", Settings::values.custom_portrait_top_height); + ReadSetting("Layout", Settings::values.custom_portrait_bottom_x); + ReadSetting("Layout", Settings::values.custom_portrait_bottom_y); + ReadSetting("Layout", Settings::values.custom_portrait_bottom_width); + ReadSetting("Layout", Settings::values.custom_portrait_bottom_height); // Utility ReadSetting("Utility", Settings::values.dump_textures); diff --git a/src/lime_qt/configuration/config.cpp b/src/lime_qt/configuration/config.cpp index 752fd6509..b26507fb2 100644 --- a/src/lime_qt/configuration/config.cpp +++ b/src/lime_qt/configuration/config.cpp @@ -539,14 +539,14 @@ void Config::ReadLayoutValues() { ReadBasicSetting(Settings::values.screen_bottom_leftright_padding); ReadBasicSetting(Settings::values.screen_bottom_topbottom_padding); ReadBasicSetting(Settings::values.custom_portrait_layout); - ReadBasicSetting(Settings::values.custom_portrait_top_left); - ReadBasicSetting(Settings::values.custom_portrait_top_top); - ReadBasicSetting(Settings::values.custom_portrait_top_right); - ReadBasicSetting(Settings::values.custom_portrait_top_bottom); - ReadBasicSetting(Settings::values.custom_portrait_bottom_left); - ReadBasicSetting(Settings::values.custom_portrait_bottom_top); - ReadBasicSetting(Settings::values.custom_portrait_bottom_right); - ReadBasicSetting(Settings::values.custom_portrait_bottom_bottom); + ReadBasicSetting(Settings::values.custom_portrait_top_x); + ReadBasicSetting(Settings::values.custom_portrait_top_y); + ReadBasicSetting(Settings::values.custom_portrait_top_width); + ReadBasicSetting(Settings::values.custom_portrait_top_height); + ReadBasicSetting(Settings::values.custom_portrait_bottom_x); + ReadBasicSetting(Settings::values.custom_portrait_bottom_y); + ReadBasicSetting(Settings::values.custom_portrait_bottom_width); + ReadBasicSetting(Settings::values.custom_portrait_bottom_height); } qt_config->endGroup(); @@ -1100,14 +1100,14 @@ void Config::SaveLayoutValues() { WriteBasicSetting(Settings::values.screen_bottom_leftright_padding); WriteBasicSetting(Settings::values.screen_bottom_topbottom_padding); WriteBasicSetting(Settings::values.custom_portrait_layout); - WriteBasicSetting(Settings::values.custom_portrait_top_left); - WriteBasicSetting(Settings::values.custom_portrait_top_top); - WriteBasicSetting(Settings::values.custom_portrait_top_right); - WriteBasicSetting(Settings::values.custom_portrait_top_bottom); - WriteBasicSetting(Settings::values.custom_portrait_bottom_left); - WriteBasicSetting(Settings::values.custom_portrait_bottom_top); - WriteBasicSetting(Settings::values.custom_portrait_bottom_right); - WriteBasicSetting(Settings::values.custom_portrait_bottom_bottom); + WriteBasicSetting(Settings::values.custom_portrait_top_x); + WriteBasicSetting(Settings::values.custom_portrait_top_y); + WriteBasicSetting(Settings::values.custom_portrait_top_width); + WriteBasicSetting(Settings::values.custom_portrait_top_height); + WriteBasicSetting(Settings::values.custom_portrait_bottom_x); + WriteBasicSetting(Settings::values.custom_portrait_bottom_y); + WriteBasicSetting(Settings::values.custom_portrait_bottom_width); + WriteBasicSetting(Settings::values.custom_portrait_bottom_height); } qt_config->endGroup();