mirror of
https://github.com/mandarine3ds/mandarine.git
synced 2024-11-27 00:10:23 +00:00
android: Added portrait-specific config values for custom layouts
This commit is contained in:
parent
9a45cc03d7
commit
90eb440e02
@ -198,6 +198,16 @@ void Config::ReadValues() {
|
||||
ReadSetting("Layout", Settings::values.cardboard_x_shift);
|
||||
ReadSetting("Layout", Settings::values.cardboard_y_shift);
|
||||
|
||||
ReadSetting("Layout", Settings::values.custom_portrait_layout);
|
||||
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);
|
||||
ReadSetting("Utility", Settings::values.custom_textures);
|
||||
|
@ -220,6 +220,7 @@ disable_flush_cpu_write =
|
||||
layout_option =
|
||||
|
||||
# Toggle custom layout (using the settings below) on or off.
|
||||
# Only applies to landscape on Android
|
||||
# 0 (default): Off, 1: On
|
||||
custom_layout =
|
||||
|
||||
@ -234,6 +235,22 @@ custom_bottom_y =
|
||||
custom_bottom_width =
|
||||
custom_bottom_height =
|
||||
|
||||
# Custom Layout Options for Android Portrait Mode
|
||||
# Toggle custom layout (using the settings below) on or off.
|
||||
# 0 (default): Off, 1: On
|
||||
custom_portrait_layout =
|
||||
|
||||
# Screen placement when using Custom layout option
|
||||
# 0x, 0y is the top left corner of the render window.
|
||||
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.
|
||||
# 0 (default): Top Screen is prominent, 1: Bottom Screen is prominent
|
||||
|
@ -509,6 +509,16 @@ struct Values {
|
||||
Setting<u16> screen_bottom_leftright_padding{0, "screen_bottom_leftright_padding"};
|
||||
Setting<u16> screen_bottom_topbottom_padding{0, "screen_bottom_topbottom_padding"};
|
||||
|
||||
Setting<bool> custom_portrait_layout{false, "custom_portrait_layout"};
|
||||
Setting<u16> custom_portrait_top_x{0, "custom_portrait_top_x"};
|
||||
Setting<u16> custom_portrait_top_y{0, "custom_portrait_top_y"};
|
||||
Setting<u16> custom_portrait_top_width{400, "custom_portrait_top_width"};
|
||||
Setting<u16> custom_portrait_top_height{240, "custom_portrait_top_height"};
|
||||
Setting<u16> custom_portrait_bottom_x{40, "custom_portrait_bottom_x"};
|
||||
Setting<u16> custom_portrait_bottom_y{240, "custom_portrait_bottom_y"};
|
||||
Setting<u16> custom_portrait_bottom_width{360, "custom_portrait_bottom_width"};
|
||||
Setting<u16> custom_portrait_bottom_height{480, "custom_portrait_bottom_height"};
|
||||
|
||||
SwitchableSetting<float> bg_red{0.f, "bg_red"};
|
||||
SwitchableSetting<float> bg_green{0.f, "bg_green"};
|
||||
SwitchableSetting<float> bg_blue{0.f, "bg_blue"};
|
||||
|
@ -183,8 +183,10 @@ void EmuWindow::UpdateCurrentFramebufferLayout(u32 width, u32 height, bool is_po
|
||||
const auto min_size =
|
||||
Layout::GetMinimumSizeFromLayout(layout_option, Settings::values.upright_screen.GetValue());
|
||||
|
||||
if (Settings::values.custom_layout.GetValue() == true) {
|
||||
layout = Layout::CustomFrameLayout(width, height, Settings::values.swap_screen.GetValue());
|
||||
if ((Settings::values.custom_layout.GetValue() == true && !is_portrait_mode) ||
|
||||
(Settings::values.custom_portrait_layout.GetValue() == true && is_portrait_mode)) {
|
||||
layout = Layout::CustomFrameLayout(width, height, Settings::values.swap_screen.GetValue(),
|
||||
is_portrait_mode);
|
||||
} else {
|
||||
width = std::max(width, min_size.first);
|
||||
height = std::max(height, min_size.second);
|
||||
|
@ -382,24 +382,32 @@ FramebufferLayout SeparateWindowsLayout(u32 width, u32 height, bool is_secondary
|
||||
return SingleFrameLayout(width, height, is_secondary, upright);
|
||||
}
|
||||
|
||||
FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped) {
|
||||
FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped, bool is_portrait_mode) {
|
||||
ASSERT(width > 0);
|
||||
ASSERT(height > 0);
|
||||
|
||||
FramebufferLayout res{width, height, true, true, {}, {}, !Settings::values.upright_screen};
|
||||
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{Settings::values.custom_top_x.GetValue(),
|
||||
Settings::values.custom_top_y.GetValue(),
|
||||
(u32)(Settings::values.custom_top_x.GetValue() +
|
||||
Settings::values.custom_top_width.GetValue()),
|
||||
(u32)(Settings::values.custom_top_y.GetValue() +
|
||||
Settings::values.custom_top_height.GetValue())};
|
||||
Common::Rectangle<u32> bot_screen{Settings::values.custom_bottom_x.GetValue(),
|
||||
Settings::values.custom_bottom_y.GetValue(),
|
||||
(u32)(Settings::values.custom_bottom_x.GetValue() +
|
||||
Settings::values.custom_bottom_width.GetValue()),
|
||||
(u32)(Settings::values.custom_bottom_y.GetValue() +
|
||||
Settings::values.custom_bottom_height.GetValue())};
|
||||
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;
|
||||
@ -412,12 +420,29 @@ FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped) {
|
||||
}
|
||||
|
||||
FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondary) {
|
||||
if (Settings::values.custom_layout.GetValue() == true) {
|
||||
return CustomFrameLayout(std::max(Settings::values.custom_top_width.GetValue(),
|
||||
Settings::values.custom_bottom_width.GetValue()),
|
||||
std::max(Settings::values.custom_top_height.GetValue(),
|
||||
Settings::values.custom_bottom_height.GetValue()),
|
||||
Settings::values.swap_screen.GetValue());
|
||||
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_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_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);
|
||||
}
|
||||
|
||||
int width, height;
|
||||
|
@ -145,7 +145,8 @@ FramebufferLayout SeparateWindowsLayout(u32 width, u32 height, bool is_secondary
|
||||
* @param height Window framebuffer height in pixels
|
||||
* @return Newly created FramebufferLayout object with default screen regions initialized
|
||||
*/
|
||||
FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped);
|
||||
FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped,
|
||||
bool is_portrait_mode = false);
|
||||
|
||||
/**
|
||||
* Convenience method to get frame layout by resolution scale
|
||||
|
@ -193,6 +193,16 @@ void Config::ReadValues() {
|
||||
ReadSetting("Layout", Settings::values.screen_bottom_leftright_padding);
|
||||
ReadSetting("Layout", Settings::values.screen_bottom_topbottom_padding);
|
||||
|
||||
ReadSetting("Layout", Settings::values.custom_portrait_layout);
|
||||
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);
|
||||
ReadSetting("Utility", Settings::values.custom_textures);
|
||||
|
@ -544,6 +544,15 @@ void Config::ReadLayoutValues() {
|
||||
ReadBasicSetting(Settings::values.screen_bottom_stretch);
|
||||
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_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();
|
||||
@ -1106,6 +1115,15 @@ void Config::SaveLayoutValues() {
|
||||
WriteBasicSetting(Settings::values.screen_bottom_stretch);
|
||||
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_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();
|
||||
|
Loading…
Reference in New Issue
Block a user