2016-05-03 00:07:17 -06:00
|
|
|
// Copyright 2016 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/math_util.h"
|
2023-05-03 12:24:10 -03:00
|
|
|
|
|
|
|
namespace Settings {
|
|
|
|
enum class LayoutOption : u32;
|
|
|
|
}
|
2017-05-27 18:06:59 -07:00
|
|
|
|
2016-05-03 00:07:17 -06:00
|
|
|
namespace Layout {
|
2017-05-27 18:06:59 -07:00
|
|
|
|
2023-05-01 19:57:42 +05:30
|
|
|
/// Orientation of the 3DS displays
|
|
|
|
enum class DisplayOrientation {
|
|
|
|
Landscape, // Default orientation of the 3DS
|
|
|
|
Portrait, // 3DS rotated 90 degrees counter-clockwise
|
|
|
|
LandscapeFlipped, // 3DS rotated 180 degrees counter-clockwise
|
|
|
|
PortraitFlipped, // 3DS rotated 270 degrees counter-clockwise
|
|
|
|
};
|
|
|
|
|
2024-01-02 14:22:03 +05:30
|
|
|
/// Describes the vertical alignment of the top and bottom screens in LargeFrameLayout
|
|
|
|
/// Top
|
|
|
|
/// +-------------+-----+
|
|
|
|
/// | | |
|
|
|
|
/// | +-----+
|
|
|
|
/// | |
|
|
|
|
/// +-------------+
|
|
|
|
/// Middle
|
|
|
|
/// +-------------+
|
|
|
|
/// | +-----+
|
|
|
|
/// | | |
|
|
|
|
/// | +-----+
|
|
|
|
/// +-------------+
|
|
|
|
/// Bottom
|
|
|
|
/// +-------------+
|
|
|
|
/// | |
|
|
|
|
/// | +-----+
|
|
|
|
/// | | |
|
|
|
|
/// +-------------+-----+
|
|
|
|
enum class VerticalAlignment {
|
|
|
|
Top,
|
|
|
|
Middle,
|
|
|
|
Bottom,
|
|
|
|
};
|
|
|
|
|
2020-06-10 13:44:21 +03:00
|
|
|
/// Describes the horizontal coordinates for the right eye screen when using Cardboard VR
|
|
|
|
struct CardboardSettings {
|
2023-04-09 10:59:25 +05:30
|
|
|
u32 top_screen_right_eye;
|
|
|
|
u32 bottom_screen_right_eye;
|
|
|
|
s32 user_x_shift;
|
2020-06-10 13:44:21 +03:00
|
|
|
};
|
|
|
|
|
2016-05-03 00:07:17 -06:00
|
|
|
/// Describes the layout of the window framebuffer (size and top/bottom screen positions)
|
|
|
|
struct FramebufferLayout {
|
2019-07-11 18:46:44 +02:00
|
|
|
u32 width;
|
|
|
|
u32 height;
|
2016-05-03 00:07:17 -06:00
|
|
|
bool top_screen_enabled;
|
|
|
|
bool bottom_screen_enabled;
|
2019-07-11 18:46:44 +02:00
|
|
|
Common::Rectangle<u32> top_screen;
|
|
|
|
Common::Rectangle<u32> bottom_screen;
|
2019-10-25 20:21:10 -03:00
|
|
|
bool is_rotated = true;
|
2017-05-27 18:06:59 -07:00
|
|
|
|
2023-06-29 00:42:57 +02:00
|
|
|
bool additional_screen_enabled;
|
|
|
|
Common::Rectangle<u32> additional_screen;
|
|
|
|
|
2020-06-10 13:44:21 +03:00
|
|
|
CardboardSettings cardboard;
|
|
|
|
|
2017-05-27 18:06:59 -07:00
|
|
|
/**
|
2024-01-02 14:22:03 +05:30
|
|
|
* Returns the ratio of pixel size of the top screen, compared to the native size of the 3DS
|
2017-05-27 18:06:59 -07:00
|
|
|
* screen.
|
|
|
|
*/
|
2019-07-11 18:46:44 +02:00
|
|
|
u32 GetScalingRatio() const;
|
2016-05-03 00:07:17 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Factory method for constructing a default FramebufferLayout
|
|
|
|
* @param width Window framebuffer width in pixels
|
|
|
|
* @param height Window framebuffer height in pixels
|
2016-11-10 00:36:07 -07:00
|
|
|
* @param is_swapped if true, the bottom screen will be displayed above the top screen
|
2024-01-02 14:22:03 +05:30
|
|
|
* @param upright if true, the screens will be rotated 90 degrees anti-clockwise
|
2016-05-03 00:07:17 -06:00
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
2019-10-25 20:21:10 -03:00
|
|
|
FramebufferLayout DefaultFrameLayout(u32 width, u32 height, bool is_swapped, bool upright);
|
2016-05-03 00:07:17 -06:00
|
|
|
|
2019-07-20 22:59:38 -04:00
|
|
|
/**
|
|
|
|
* Factory method for constructing a mobile portrait FramebufferLayout
|
|
|
|
* @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 MobilePortraitFrameLayout(u32 width, u32 height, bool is_swapped);
|
|
|
|
|
2016-05-03 00:07:17 -06:00
|
|
|
/**
|
2016-11-10 00:36:07 -07:00
|
|
|
* Factory method for constructing a FramebufferLayout with only the top or bottom screen
|
2016-05-03 00:07:17 -06:00
|
|
|
* @param width Window framebuffer width in pixels
|
|
|
|
* @param height Window framebuffer height in pixels
|
2016-11-10 00:36:07 -07:00
|
|
|
* @param is_swapped if true, the bottom screen will be displayed (and the top won't be displayed)
|
2024-01-02 14:22:03 +05:30
|
|
|
* @param upright if true, the screens will be rotated 90 degrees anti-clockwise
|
2016-05-03 00:07:17 -06:00
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
2019-10-25 20:21:10 -03:00
|
|
|
FramebufferLayout SingleFrameLayout(u32 width, u32 height, bool is_swapped, bool upright);
|
2016-05-03 00:07:17 -06:00
|
|
|
|
|
|
|
/**
|
2016-11-05 02:58:11 -06:00
|
|
|
* Factory method for constructing a Frame with the a 4x size Top screen with a 1x size bottom
|
|
|
|
* screen on the right
|
2016-05-03 00:07:17 -06:00
|
|
|
* This is useful in particular because it matches well with a 1920x1080 resolution monitor
|
|
|
|
* @param width Window framebuffer width in pixels
|
|
|
|
* @param height Window framebuffer height in pixels
|
2016-11-10 00:36:07 -07:00
|
|
|
* @param is_swapped if true, the bottom screen will be the large display
|
2024-01-02 14:22:03 +05:30
|
|
|
* @param upright if true, the screens will be rotated 90 degrees anti-clockwise
|
2023-02-17 09:19:52 -05:00
|
|
|
* @param scale_factor The ratio between the large screen with respect to the smaller screen
|
2024-01-02 14:22:03 +05:30
|
|
|
* @param vertical_alignment The vertical alignment of the smaller screen relative to the larger
|
|
|
|
* screen
|
2016-05-03 00:07:17 -06:00
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
2023-02-17 09:19:52 -05:00
|
|
|
FramebufferLayout LargeFrameLayout(u32 width, u32 height, bool is_swapped, bool upright,
|
2024-01-02 14:22:03 +05:30
|
|
|
float scale_factor, VerticalAlignment vertical_alignment);
|
2023-06-29 00:42:57 +02:00
|
|
|
/**
|
|
|
|
* Factory method for constructing a frame with 2.5 times bigger top screen on the right,
|
|
|
|
* and 1x top and bottom screen on the left
|
|
|
|
* @param width Window framebuffer width in pixels
|
|
|
|
* @param height Window framebuffer height in pixels
|
|
|
|
* @param is_swapped if true, the bottom screen will be the large display
|
2024-01-02 14:22:03 +05:30
|
|
|
* @param upright if true, the screens will be rotated 90 degrees anti-clockwise
|
2023-06-29 00:42:57 +02:00
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
|
|
|
FramebufferLayout HybridScreenLayout(u32 width, u32 height, bool swapped, bool upright);
|
2017-02-01 00:22:47 -08:00
|
|
|
|
2022-11-17 10:37:30 -05:00
|
|
|
/**
|
|
|
|
* Factory method for constructing a Frame with the Top screen and bottom
|
|
|
|
* screen on separate windows
|
|
|
|
* @param width Window framebuffer width in pixels
|
|
|
|
* @param height Window framebuffer height in pixels
|
|
|
|
* @param is_secondary if true, the bottom screen will be enabled instead of the top screen
|
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
|
|
|
FramebufferLayout SeparateWindowsLayout(u32 width, u32 height, bool is_secondary, bool upright);
|
|
|
|
|
2017-02-01 00:22:47 -08:00
|
|
|
/**
|
|
|
|
* Factory method for constructing a custom FramebufferLayout
|
|
|
|
* @param width Window framebuffer width in pixels
|
|
|
|
* @param height Window framebuffer height in pixels
|
|
|
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
|
|
|
*/
|
2024-08-11 13:41:25 +01:00
|
|
|
FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped,
|
|
|
|
bool is_portrait_mode = false);
|
2017-05-27 18:06:59 -07:00
|
|
|
|
2018-08-31 14:16:16 +08:00
|
|
|
/**
|
|
|
|
* Convenience method to get frame layout by resolution scale
|
|
|
|
* Read from the current settings to determine which layout to use.
|
|
|
|
* @param res_scale resolution scale factor
|
|
|
|
*/
|
2022-11-17 10:37:30 -05:00
|
|
|
FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondary = false);
|
2018-08-31 14:16:16 +08:00
|
|
|
|
2020-06-10 13:44:21 +03:00
|
|
|
/**
|
|
|
|
* Convenience method for transforming a frame layout when using Cardboard VR
|
|
|
|
* @param layout frame layout to transform
|
|
|
|
* @return layout transformed with the user cardboard settings
|
|
|
|
*/
|
2023-04-09 10:59:25 +05:30
|
|
|
FramebufferLayout GetCardboardSettings(const FramebufferLayout& layout);
|
2020-06-10 13:44:21 +03:00
|
|
|
|
2020-01-21 18:44:04 -03:00
|
|
|
std::pair<unsigned, unsigned> GetMinimumSizeFromLayout(Settings::LayoutOption layout,
|
|
|
|
bool upright_screen);
|
|
|
|
|
2017-05-27 18:06:59 -07:00
|
|
|
} // namespace Layout
|