mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2025-03-13 09:12:27 +01:00
Merge 8b58e7e9d5488569f3977d4a39d37d5fd5f4dc07 into 26ce7e4f2844a445bf77b4b14977d62e6434df08
This commit is contained in:
commit
9d75dd4e1f
@ -41,7 +41,8 @@ enum class SmallScreenPosition(val int: Int) {
|
|||||||
enum class PortraitScreenLayout(val int: Int) {
|
enum class PortraitScreenLayout(val int: Int) {
|
||||||
// These must match what is defined in src/common/settings.h
|
// These must match what is defined in src/common/settings.h
|
||||||
TOP_FULL_WIDTH(0),
|
TOP_FULL_WIDTH(0),
|
||||||
CUSTOM_PORTRAIT_LAYOUT(1);
|
CUSTOM_PORTRAIT_LAYOUT(1),
|
||||||
|
ORIGINAL(2);
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun from(int: Int): PortraitScreenLayout {
|
fun from(int: Int): PortraitScreenLayout {
|
||||||
|
@ -886,10 +886,10 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
|||||||
val layoutOptionMenuItem = when (IntSetting.PORTRAIT_SCREEN_LAYOUT.int) {
|
val layoutOptionMenuItem = when (IntSetting.PORTRAIT_SCREEN_LAYOUT.int) {
|
||||||
PortraitScreenLayout.TOP_FULL_WIDTH.int ->
|
PortraitScreenLayout.TOP_FULL_WIDTH.int ->
|
||||||
R.id.menu_portrait_layout_top_full
|
R.id.menu_portrait_layout_top_full
|
||||||
|
|
||||||
PortraitScreenLayout.CUSTOM_PORTRAIT_LAYOUT.int ->
|
PortraitScreenLayout.CUSTOM_PORTRAIT_LAYOUT.int ->
|
||||||
R.id.menu_portrait_layout_custom
|
R.id.menu_portrait_layout_custom
|
||||||
|
PortraitScreenLayout.ORIGINAL.int ->
|
||||||
|
R.id.menu_portrait_layout_original
|
||||||
else ->
|
else ->
|
||||||
R.id.menu_portrait_layout_top_full
|
R.id.menu_portrait_layout_top_full
|
||||||
|
|
||||||
@ -914,6 +914,11 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
R.id.menu_portrait_layout_original -> {
|
||||||
|
screenAdjustmentUtil.changePortraitOrientation(PortraitScreenLayout.ORIGINAL.int)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
else -> true
|
else -> true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
android:id="@+id/menu_portrait_layout_custom"
|
android:id="@+id/menu_portrait_layout_custom"
|
||||||
android:title="@string/emulation_screen_layout_custom" />
|
android:title="@string/emulation_screen_layout_custom" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_portrait_layout_original"
|
||||||
|
android:title="@string/emulation_screen_layout_original" />
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -32,11 +32,13 @@
|
|||||||
<string-array name="portraitLayouts">
|
<string-array name="portraitLayouts">
|
||||||
<item>@string/emulation_portrait_layout_top_full</item>
|
<item>@string/emulation_portrait_layout_top_full</item>
|
||||||
<item>@string/emulation_screen_layout_custom</item>
|
<item>@string/emulation_screen_layout_custom</item>
|
||||||
|
<item>@string/emulation_screen_layout_original</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<integer-array name="portraitLayoutValues">
|
<integer-array name="portraitLayoutValues">
|
||||||
<item>0</item>
|
<item>0</item>
|
||||||
<item>1</item>
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
</integer-array>
|
</integer-array>
|
||||||
|
|
||||||
<string-array name="smallScreenPositions">
|
<string-array name="smallScreenPositions">
|
||||||
|
@ -51,6 +51,7 @@ enum class PortraitLayoutOption : u32 {
|
|||||||
// formerly mobile portrait
|
// formerly mobile portrait
|
||||||
PortraitTopFullWidth,
|
PortraitTopFullWidth,
|
||||||
PortraitCustomLayout,
|
PortraitCustomLayout,
|
||||||
|
PortraitOriginal
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Defines where the small screen will appear relative to the large screen
|
/** Defines where the small screen will appear relative to the large screen
|
||||||
|
@ -207,6 +207,9 @@ void EmuWindow::UpdateCurrentFramebufferLayout(u32 width, u32 height, bool is_po
|
|||||||
layout = Layout::CustomFrameLayout(
|
layout = Layout::CustomFrameLayout(
|
||||||
width, height, Settings::values.swap_screen.GetValue(), is_portrait_mode);
|
width, height, Settings::values.swap_screen.GetValue(), is_portrait_mode);
|
||||||
break;
|
break;
|
||||||
|
case Settings::PortraitLayoutOption::PortraitOriginal:
|
||||||
|
layout = Layout::PortraitOriginalLayout(width, height, Settings::values.swap_screen.GetValue());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (layout_option) {
|
switch (layout_option) {
|
||||||
|
@ -51,6 +51,19 @@ FramebufferLayout PortraitTopFullFrameLayout(u32 width, u32 height, bool swapped
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FramebufferLayout PortraitOriginalLayout(u32 width, u32 height, bool swapped) {
|
||||||
|
ASSERT(width > 0);
|
||||||
|
ASSERT(height > 0);
|
||||||
|
const float scale_factor = 1;
|
||||||
|
FramebufferLayout res = LargeFrameLayout(width, height, swapped, false, scale_factor,
|
||||||
|
Settings::SmallScreenPosition::BelowLarge);
|
||||||
|
const int shiftY = -(int)(swapped ? res.bottom_screen.top : res.top_screen.top);
|
||||||
|
res.top_screen = res.top_screen.TranslateY(shiftY);
|
||||||
|
res.bottom_screen = res.bottom_screen.TranslateY(shiftY);
|
||||||
|
return res;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
FramebufferLayout SingleFrameLayout(u32 width, u32 height, bool swapped, bool upright) {
|
FramebufferLayout SingleFrameLayout(u32 width, u32 height, bool swapped, bool upright) {
|
||||||
ASSERT(width > 0);
|
ASSERT(width > 0);
|
||||||
ASSERT(height > 0);
|
ASSERT(height > 0);
|
||||||
@ -346,7 +359,7 @@ FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped, bool
|
|||||||
|
|
||||||
FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondary,
|
FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondary,
|
||||||
bool is_portrait) {
|
bool is_portrait) {
|
||||||
int width, height;
|
u32 width, height;
|
||||||
if (is_portrait) {
|
if (is_portrait) {
|
||||||
auto layout_option = Settings::values.portrait_layout_option.GetValue();
|
auto layout_option = Settings::values.portrait_layout_option.GetValue();
|
||||||
switch (layout_option) {
|
switch (layout_option) {
|
||||||
@ -363,9 +376,13 @@ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondar
|
|||||||
Settings::values.swap_screen.GetValue(), is_portrait);
|
Settings::values.swap_screen.GetValue(), is_portrait);
|
||||||
case Settings::PortraitLayoutOption::PortraitTopFullWidth:
|
case Settings::PortraitLayoutOption::PortraitTopFullWidth:
|
||||||
width = Core::kScreenTopWidth * res_scale;
|
width = Core::kScreenTopWidth * res_scale;
|
||||||
height = (Core::kScreenTopHeight + Core::kScreenBottomHeight) * res_scale;
|
height = static_cast<int>(Core::kScreenTopHeight + Core::kScreenBottomHeight * 1.25) * res_scale;
|
||||||
return PortraitTopFullFrameLayout(width, height,
|
return PortraitTopFullFrameLayout(width, height,
|
||||||
Settings::values.swap_screen.GetValue());
|
Settings::values.swap_screen.GetValue());
|
||||||
|
case Settings::PortraitLayoutOption::PortraitOriginal:
|
||||||
|
width = Core::kScreenTopWidth * res_scale;
|
||||||
|
height = (Core::kScreenTopHeight + Core::kScreenBottomHeight) * res_scale;
|
||||||
|
return PortraitOriginalLayout(width, height, Settings::values.swap_screen.GetValue());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto layout_option = Settings::values.layout_option.GetValue();
|
auto layout_option = Settings::values.layout_option.GetValue();
|
||||||
@ -479,6 +496,7 @@ FramebufferLayout GetCardboardSettings(const FramebufferLayout& layout) {
|
|||||||
if (is_portrait) {
|
if (is_portrait) {
|
||||||
switch (Settings::values.portrait_layout_option.GetValue()) {
|
switch (Settings::values.portrait_layout_option.GetValue()) {
|
||||||
case Settings::PortraitLayoutOption::PortraitTopFullWidth:
|
case Settings::PortraitLayoutOption::PortraitTopFullWidth:
|
||||||
|
case Settings::PortraitLayoutOption::PortraitOriginal:
|
||||||
cardboard_screen_width = top_screen_width;
|
cardboard_screen_width = top_screen_width;
|
||||||
cardboard_screen_height = top_screen_height + bottom_screen_height;
|
cardboard_screen_height = top_screen_height + bottom_screen_height;
|
||||||
bottom_screen_left += (top_screen_width - bottom_screen_width) / 2;
|
bottom_screen_left += (top_screen_width - bottom_screen_width) / 2;
|
||||||
|
@ -62,8 +62,8 @@ FramebufferLayout reverseLayout(FramebufferLayout layout);
|
|||||||
FramebufferLayout DefaultFrameLayout(u32 width, u32 height, bool is_swapped, bool upright);
|
FramebufferLayout DefaultFrameLayout(u32 width, u32 height, bool is_swapped, bool upright);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory method for constructing the mobile Full Width Top layout
|
* Factory method for constructing the mobile Full Width (Default) layout
|
||||||
* Two screens at top, full width, no gap between them
|
* Two screens at top, full width (so different heights)
|
||||||
* @param width Window framebuffer width in pixels
|
* @param width Window framebuffer width in pixels
|
||||||
* @param height Window framebuffer height in pixels
|
* @param height Window framebuffer height in pixels
|
||||||
* @param is_swapped if true, the bottom screen will be displayed above the top screen
|
* @param is_swapped if true, the bottom screen will be displayed above the top screen
|
||||||
@ -71,6 +71,16 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height, bool is_swapped, boo
|
|||||||
*/
|
*/
|
||||||
FramebufferLayout PortraitTopFullFrameLayout(u32 width, u32 height, bool is_swapped);
|
FramebufferLayout PortraitTopFullFrameLayout(u32 width, u32 height, bool is_swapped);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory method for constructing the mobile Original layout
|
||||||
|
* Two screens at top, equal heights
|
||||||
|
* @param width Window framebuffer width in pixels
|
||||||
|
* @param height Window framebuffer height in pixels
|
||||||
|
* @param is_swapped if true, the bottom screen will be displayed above the top screen
|
||||||
|
* @return Newly created FramebufferLayout object with mobile portrait screen regions initialized
|
||||||
|
*/
|
||||||
|
FramebufferLayout PortraitOriginalLayout(u32 width, u32 height, bool is_swapped);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory method for constructing a FramebufferLayout with only the top or bottom screen
|
* Factory method for constructing a FramebufferLayout with only the top or bottom screen
|
||||||
* @param width Window framebuffer width in pixels
|
* @param width Window framebuffer width in pixels
|
||||||
|
Loading…
x
Reference in New Issue
Block a user