mirror of
https://git.citron-emu.org/citron/emulator
synced 2025-12-21 03:23:34 +00:00
This commit introduces support for a 32:9 aspect ratio throughout Citron.
Key changes include:
- **Enum Updates**: Added `R32_9` to `Settings::AspectRatio` and `Layout::AspectRatio` enums, ensuring consistent integer mapping for casting between them.
- **Core Logic**:
- Modified `UISettings::CalculateWidth` to correctly compute width for the 32:9 ratio.
- Updated `Layout::EmulationAspectRatio` to handle the new `R32_9` case and return the appropriate float value (9.0f / 32.0f).
- **Android Integration**:
- Updated `EmulationFragment.kt` and `EmulationActivity.kt` (for Picture-in-Picture) to recognize and apply the 32:9 aspect ratio (mapping setting value `4` to `Rational(32, 9)`).
- **UI Configuration**:
- Added "Force 32:9" to the aspect ratio selection in the graphics settings UI via `shared_translation.cpp`. This string is translatable.
This enhancement allows users to utilize ultra-widescreen 32:9 displays for a more immersive experience.
Signed-off-by: Zephyron <zephyron@citron-emu.org>
67 lines
1.8 KiB
C++
67 lines
1.8 KiB
C++
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include "common/common_types.h"
|
|
#include "common/math_util.h"
|
|
|
|
namespace Layout {
|
|
|
|
namespace MinimumSize {
|
|
constexpr u32 Width = 640;
|
|
constexpr u32 Height = 360;
|
|
} // namespace MinimumSize
|
|
|
|
namespace ScreenUndocked {
|
|
constexpr u32 Width = 1280;
|
|
constexpr u32 Height = 720;
|
|
} // namespace ScreenUndocked
|
|
|
|
namespace ScreenDocked {
|
|
constexpr u32 Width = 1920;
|
|
constexpr u32 Height = 1080;
|
|
} // namespace ScreenDocked
|
|
|
|
enum class AspectRatio {
|
|
Default,
|
|
R4_3,
|
|
R21_9,
|
|
R16_10,
|
|
R32_9,
|
|
StretchToWindow,
|
|
};
|
|
|
|
/// Describes the layout of the window framebuffer
|
|
struct FramebufferLayout {
|
|
u32 width{ScreenUndocked::Width};
|
|
u32 height{ScreenUndocked::Height};
|
|
Common::Rectangle<u32> screen;
|
|
bool is_srgb{};
|
|
};
|
|
|
|
/**
|
|
* Factory method for constructing a default 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
|
|
*/
|
|
FramebufferLayout DefaultFrameLayout(u32 width, u32 height);
|
|
|
|
/**
|
|
* Convenience method to get frame layout by resolution scale
|
|
* @param res_scale resolution scale factor
|
|
*/
|
|
FramebufferLayout FrameLayoutFromResolutionScale(f32 res_scale);
|
|
|
|
/**
|
|
* Convenience method to determine emulation aspect ratio
|
|
* @param aspect Represents the index of aspect ratio stored in Settings::values.aspect_ratio
|
|
* @param window_aspect_ratio Current window aspect ratio
|
|
* @return Emulation render window aspect ratio
|
|
*/
|
|
float EmulationAspectRatio(AspectRatio aspect, float window_aspect_ratio);
|
|
|
|
} // namespace Layout
|