mirror of
https://github.com/PabloMK7/citra.git
synced 2025-01-31 08:13:05 +01:00
separate portrait mode custom layouts
This commit is contained in:
parent
959a66d839
commit
33265a7756
8 changed files with 115 additions and 15 deletions
|
@ -189,6 +189,19 @@ 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
|
||||
|
||||
|
||||
// Utility
|
||||
ReadSetting("Utility", Settings::values.dump_textures);
|
||||
ReadSetting("Utility", Settings::values.custom_textures);
|
||||
|
|
|
@ -188,6 +188,7 @@ delay_game_render_thread_us =
|
|||
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 =
|
||||
|
||||
|
@ -202,6 +203,22 @@ custom_bottom_top =
|
|||
custom_bottom_right =
|
||||
custom_bottom_bottom =
|
||||
|
||||
# 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_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 =
|
||||
|
||||
# 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
|
||||
|
|
|
@ -175,7 +175,17 @@ void Config::ReadValues() {
|
|||
ReadSetting("Layout", Settings::values.custom_bottom_right);
|
||||
ReadSetting("Layout", Settings::values.custom_bottom_bottom);
|
||||
ReadSetting("Layout", Settings::values.custom_second_layer_opacity);
|
||||
|
||||
#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
|
||||
// Utility
|
||||
ReadSetting("Utility", Settings::values.dump_textures);
|
||||
ReadSetting("Utility", Settings::values.custom_textures);
|
||||
|
|
|
@ -529,6 +529,15 @@ void Config::ReadLayoutValues() {
|
|||
ReadBasicSetting(Settings::values.custom_bottom_right);
|
||||
ReadBasicSetting(Settings::values.custom_bottom_bottom);
|
||||
ReadBasicSetting(Settings::values.custom_second_layer_opacity);
|
||||
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);
|
||||
}
|
||||
|
||||
qt_config->endGroup();
|
||||
|
@ -1066,6 +1075,15 @@ void Config::SaveLayoutValues() {
|
|||
WriteBasicSetting(Settings::values.custom_bottom_right);
|
||||
WriteBasicSetting(Settings::values.custom_bottom_bottom);
|
||||
WriteBasicSetting(Settings::values.custom_second_layer_opacity);
|
||||
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);
|
||||
}
|
||||
|
||||
qt_config->endGroup();
|
||||
|
|
|
@ -499,6 +499,18 @@ struct Values {
|
|||
Setting<u16> custom_bottom_bottom{480, "custom_bottom_bottom"};
|
||||
Setting<u16> custom_second_layer_opacity{100, "custom_second_layer_opacity"};
|
||||
|
||||
#ifdef ANDROID
|
||||
Setting<bool> custom_portrait_layout{false, "custom_portrait_layout"};
|
||||
Setting<u16> custom_portrait_top_left{0, "custom_portrait_top_left"};
|
||||
Setting<u16> custom_portrait_top_top{0, "custom_portrait_top_top"};
|
||||
Setting<u16> custom_portrait_top_right{400, "custom_portrait_top_right"};
|
||||
Setting<u16> custom_portrait_top_bottom{240, "custom_portrait_top_bottom"};
|
||||
Setting<u16> custom_portrait_bottom_left{40, "custom_portrait_bottom_left"};
|
||||
Setting<u16> custom_portrait_bottom_top{240, "custom_portrait_bottom_top"};
|
||||
Setting<u16> custom_portrait_bottom_right{360, "custom_portrait_bottom_right"};
|
||||
Setting<u16> custom_portrait_bottom_bottom{480, "custom_portrait_bottom_bottom"};
|
||||
#endif
|
||||
|
||||
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);
|
||||
|
|
|
@ -371,20 +371,38 @@ 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_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();
|
||||
|
||||
Common::Rectangle<u32> top_screen{Settings::values.custom_top_left.GetValue(),
|
||||
Settings::values.custom_top_top.GetValue(),
|
||||
Settings::values.custom_top_right.GetValue(),
|
||||
Settings::values.custom_top_bottom.GetValue()};
|
||||
Common::Rectangle<u32> bot_screen{Settings::values.custom_bottom_left.GetValue(),
|
||||
Settings::values.custom_bottom_top.GetValue(),
|
||||
Settings::values.custom_bottom_right.GetValue(),
|
||||
Settings::values.custom_bottom_bottom.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};
|
||||
|
||||
if (is_swapped) {
|
||||
res.top_screen = bot_screen;
|
||||
|
@ -397,12 +415,22 @@ FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped) {
|
|||
}
|
||||
|
||||
FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondary) {
|
||||
if (Settings::values.custom_layout.GetValue() == true) {
|
||||
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()),
|
||||
Settings::values.swap_screen.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()),
|
||||
Settings::values.swap_screen.GetValue(),
|
||||
is_portrait_mode);
|
||||
}
|
||||
|
||||
int width, height;
|
||||
|
|
|
@ -145,7 +145,7 @@ 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
|
||||
|
|
Loading…
Reference in a new issue