android: Updated custom layout coordinate system to match desktop

This commit is contained in:
David Griswold
2024-08-11 13:43:27 +01:00
committed by OpenSauce04
parent 6cb61c8ff7
commit c78e893cd7
6 changed files with 84 additions and 76 deletions

View File

@@ -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<u32> top_screen{top_left, top_top, top_right, top_bottom};
Common::Rectangle<u32> bot_screen{bottom_left, bottom_top, bottom_right, bottom_bottom};
Common::Rectangle<u32> top_screen{top_x, top_y, (u32)(top_x + top_width),
(u32)(top_y + top_height)};
Common::Rectangle<u32> 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);
}