HostDisplay: Add 5:4 and 3:2 aspect ratios

This commit is contained in:
Connor McLaughlin 2020-12-01 01:58:46 +10:00
parent bccecdbf18
commit 98f70e9b51
5 changed files with 29 additions and 4 deletions

View file

@ -94,6 +94,8 @@
<item>19:9</item>
<item>21:9</item>
<item>8:7</item>
<item>5:4</item>
<item>3:2</item>
<item>2:1 (VRAM 1:1)</item>
<item>1:1</item>
<item>PAR 1:1</item>
@ -105,6 +107,8 @@
<item>19:9</item>
<item>21:9</item>
<item>8:7</item>
<item>5:4</item>
<item>3:2</item>
<item>2:1 (VRAM 1:1)</item>
<item>1:1</item>
<item>PAR 1:1</item>

View file

@ -639,6 +639,14 @@ static void RTPS(const s16 V[3], u8 shift, bool lm, bool last)
Sx = ((((s64(result) * s64(REGS.IR1)) * s64(7)) / s64(6)) + s64(REGS.OFX));
break;
case DisplayAspectRatio::R5_4:
Sx = ((((s64(result) * s64(REGS.IR1)) * s64(16)) / s64(15)) + s64(REGS.OFX));
break;
case DisplayAspectRatio::R3_2:
Sx = ((((s64(result) * s64(REGS.IR1)) * s64(8)) / s64(9)) + s64(REGS.OFX));
break;
case DisplayAspectRatio::R2_1:
Sx = ((((s64(result) * s64(REGS.IR1)) * s64(2)) / s64(3)) + s64(REGS.OFX));
break;
@ -723,6 +731,14 @@ static void RTPS(const s16 V[3], u8 shift, bool lm, bool last)
precise_x = (precise_x * 7.0f) / 6.0f;
break;
case DisplayAspectRatio::R5_4:
precise_x = (precise_x * 16.0f) / 15.0f;
break;
case DisplayAspectRatio::R3_2:
precise_x = (precise_x * 8.0f) / 9.0f;
break;
case DisplayAspectRatio::R2_1:
precise_x = (precise_x * 2.0f) / 3.0f;
break;

View file

@ -616,10 +616,11 @@ const char* Settings::GetDisplayCropModeDisplayName(DisplayCropMode crop_mode)
return s_display_crop_mode_display_names[static_cast<int>(crop_mode)];
}
static std::array<const char*, 9> s_display_aspect_ratio_names = {
{"4:3", "16:9", "16:10", "19:9", "21:9", "8:7", "2:1 (VRAM 1:1)", "1:1", "PAR 1:1"}};
static constexpr std::array<float, 9> s_display_aspect_ratio_values = {
{4.0f / 3.0f, 16.0f / 9.0f, 16.0f / 10.0f, 19.0f / 9.0f, 21.0f / 9.0f, 8.0f / 7.0f, 2.0f / 1.0f, 1.0f, -1.0f}};
static std::array<const char*, 11> s_display_aspect_ratio_names = {
{"4:3", "16:9", "16:10", "19:9", "21:9", "8:7", "5:4", "3:2", "2:1 (VRAM 1:1)", "1:1", "PAR 1:1"}};
static constexpr std::array<float, 11> s_display_aspect_ratio_values = {
{4.0f / 3.0f, 16.0f / 9.0f, 16.0f / 10.0f, 19.0f / 9.0f, 21.0f / 9.0f, 8.0f / 7.0f, 5.0f / 4.0f, 3.0f / 2.0f,
2.0f / 1.0f, 1.0f, -1.0f}};
std::optional<DisplayAspectRatio> Settings::ParseDisplayAspectRatio(const char* str)
{

View file

@ -91,6 +91,8 @@ enum class DisplayAspectRatio : u8
R19_9,
R21_9,
R8_7,
R5_4,
R3_2,
R2_1,
R1_1,
PAR1_1,

View file

@ -710,6 +710,8 @@ static std::array<retro_core_option_definition, 46> s_option_definitions = {{
{"19:9", "19:9"},
{"21:9", "21:9"},
{"8:7", "8:7"},
{"5:4", "5:4"},
{"3:2", "3:2"},
{"2:1 (VRAM 1:1)", "2:1 (VRAM 1:1)"},
{"1:1", "1:1"},
{"PAR 1:1", "PAR 1:1"}},