mirror of
https://github.com/azahar-emu/azahar.git
synced 2025-04-28 13:47:59 +03:00
android: Original Portrait Layout (#625)
Some checks are pending
citra-build / source (push) Waiting to run
citra-build / linux (appimage) (push) Waiting to run
citra-build / linux (fresh) (push) Waiting to run
citra-build / macos (arm64) (push) Waiting to run
citra-build / macos (x86_64) (push) Waiting to run
citra-build / macos-universal (push) Blocked by required conditions
citra-build / windows (msvc) (push) Waiting to run
citra-build / windows (msys2) (push) Waiting to run
citra-build / android (push) Waiting to run
citra-build / ios (push) Waiting to run
citra-format / clang-format (push) Waiting to run
citra-transifex / transifex (push) Waiting to run
Some checks are pending
citra-build / source (push) Waiting to run
citra-build / linux (appimage) (push) Waiting to run
citra-build / linux (fresh) (push) Waiting to run
citra-build / macos (arm64) (push) Waiting to run
citra-build / macos (x86_64) (push) Waiting to run
citra-build / macos-universal (push) Blocked by required conditions
citra-build / windows (msvc) (push) Waiting to run
citra-build / windows (msys2) (push) Waiting to run
citra-build / android (push) Waiting to run
citra-build / ios (push) Waiting to run
citra-format / clang-format (push) Waiting to run
citra-transifex / transifex (push) Waiting to run
* Original Portrait Layout Original Portrait Layout * type conversion fix for win * Updated license headers * Applied clang-format * android: Reordered Portrait Screen Layout menu Custom Layout is now at the bottom of the list --------- Co-authored-by: OpenSauce04 <opensauce04@gmail.com>
This commit is contained in:
parent
89d2e67459
commit
8e477e35bb
8 changed files with 54 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2023 Citra Emulator Project
|
// Copyright Citra Emulator Project / Azahar Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
@ -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 {
|
||||||
|
|
|
@ -902,10 +902,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.ORIGINAL.int ->
|
||||||
|
R.id.menu_portrait_layout_original
|
||||||
PortraitScreenLayout.CUSTOM_PORTRAIT_LAYOUT.int ->
|
PortraitScreenLayout.CUSTOM_PORTRAIT_LAYOUT.int ->
|
||||||
R.id.menu_portrait_layout_custom
|
R.id.menu_portrait_layout_custom
|
||||||
|
|
||||||
else ->
|
else ->
|
||||||
R.id.menu_portrait_layout_top_full
|
R.id.menu_portrait_layout_top_full
|
||||||
|
|
||||||
|
@ -920,6 +920,11 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
R.id.menu_portrait_layout_original -> {
|
||||||
|
screenAdjustmentUtil.changePortraitOrientation(PortraitScreenLayout.ORIGINAL.int)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
R.id.menu_portrait_layout_custom -> {
|
R.id.menu_portrait_layout_custom -> {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
android:id="@+id/menu_portrait_layout_top_full"
|
android:id="@+id/menu_portrait_layout_top_full"
|
||||||
android:title="@string/emulation_portrait_layout_top_full" />
|
android:title="@string/emulation_portrait_layout_top_full" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_portrait_layout_original"
|
||||||
|
android:title="@string/emulation_screen_layout_original" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
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" />
|
||||||
|
|
|
@ -31,11 +31,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_original</item>
|
||||||
<item>@string/emulation_screen_layout_custom</item>
|
<item>@string/emulation_screen_layout_custom</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<integer-array name="portraitLayoutValues">
|
<integer-array name="portraitLayoutValues">
|
||||||
<item>0</item>
|
<item>0</item>
|
||||||
|
<item>2</item>
|
||||||
<item>1</item>
|
<item>1</item>
|
||||||
</integer-array>
|
</integer-array>
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -221,6 +221,10 @@ 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,18 @@ 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 +358,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 +375,14 @@ 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();
|
||||||
|
@ -497,6 +514,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;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2016 Citra Emulator Project
|
// Copyright Citra Emulator Project / Azahar Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
@ -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…
Add table
Add a link
Reference in a new issue