From ffa3744b3b423d756e6897b349980d7fba872d20 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Thu, 14 Jan 2021 00:45:46 +1000 Subject: [PATCH] Settings: Add 20:9 display aspect ratio --- android/app/src/main/res/values-it/arrays.xml | 1 + android/app/src/main/res/values-nl/arrays.xml | 1 + android/app/src/main/res/values-pt-rBR/arrays.xml | 1 + android/app/src/main/res/values/arrays.xml | 2 ++ src/core/gte.cpp | 8 ++++++++ src/core/settings.cpp | 12 ++++++------ src/core/types.h | 1 + src/frontend-common/game_list.h | 2 +- 8 files changed, 21 insertions(+), 7 deletions(-) diff --git a/android/app/src/main/res/values-it/arrays.xml b/android/app/src/main/res/values-it/arrays.xml index 417d93627..43b7563f1 100644 --- a/android/app/src/main/res/values-it/arrays.xml +++ b/android/app/src/main/res/values-it/arrays.xml @@ -49,6 +49,7 @@ 16:9 16:10 19:9 + 20:9 21:9 32:9 8:7 diff --git a/android/app/src/main/res/values-nl/arrays.xml b/android/app/src/main/res/values-nl/arrays.xml index 9b7f2af00..be650c233 100644 --- a/android/app/src/main/res/values-nl/arrays.xml +++ b/android/app/src/main/res/values-nl/arrays.xml @@ -49,6 +49,7 @@ 16:9 16:10 19:9 + 20:9 21:9 32:9 8:7 diff --git a/android/app/src/main/res/values-pt-rBR/arrays.xml b/android/app/src/main/res/values-pt-rBR/arrays.xml index ef02a535e..59c146e9e 100644 --- a/android/app/src/main/res/values-pt-rBR/arrays.xml +++ b/android/app/src/main/res/values-pt-rBR/arrays.xml @@ -49,6 +49,7 @@ 16:9 16:10 19:9 + 20:9 21:9 32:9 8:7 diff --git a/android/app/src/main/res/values/arrays.xml b/android/app/src/main/res/values/arrays.xml index 4da2b1ae1..ebb828185 100644 --- a/android/app/src/main/res/values/arrays.xml +++ b/android/app/src/main/res/values/arrays.xml @@ -93,6 +93,7 @@ 16:9 16:10 19:9 + 20:9 21:9 32:9 8:7 @@ -108,6 +109,7 @@ 16:9 16:10 19:9 + 20:9 21:9 32:9 8:7 diff --git a/src/core/gte.cpp b/src/core/gte.cpp index 16224789b..c12c418b7 100644 --- a/src/core/gte.cpp +++ b/src/core/gte.cpp @@ -631,6 +631,10 @@ static void RTPS(const s16 V[3], u8 shift, bool lm, bool last) Sx = ((((s64(result) * s64(REGS.IR1)) * s64(12)) / s64(19)) + s64(REGS.OFX)); break; + case DisplayAspectRatio::R20_9: + Sx = ((((s64(result) * s64(REGS.IR1)) * s64(3)) / s64(5)) + s64(REGS.OFX)); + break; + case DisplayAspectRatio::R21_9: Sx = ((((s64(result) * s64(REGS.IR1)) * s64(9)) / s64(16)) + s64(REGS.OFX)); break; @@ -728,6 +732,10 @@ static void RTPS(const s16 V[3], u8 shift, bool lm, bool last) precise_x = (precise_x * 12.0f) / 19.0f; break; + case DisplayAspectRatio::R20_9: + precise_x = (precise_x * 3.0f) / 5.0f; + break; + case DisplayAspectRatio::R21_9: precise_x = (precise_x * 9.0f) / 16.0f; break; diff --git a/src/core/settings.cpp b/src/core/settings.cpp index bcfd02b2e..1d08b8ed7 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -697,12 +697,12 @@ const char* Settings::GetDisplayCropModeDisplayName(DisplayCropMode crop_mode) return s_display_crop_mode_display_names[static_cast(crop_mode)]; } -static std::array s_display_aspect_ratio_names = { - {TRANSLATABLE("DisplayAspectRatio", "Auto (Game Native)"), "4:3", "16:9", "16:10", "19:9", "21:9", "32:9", "8:7", - "5:4", "3:2", "2:1 (VRAM 1:1)", "1:1", "PAR 1:1"}}; -static constexpr std::array s_display_aspect_ratio_values = { - {-1.0f, 4.0f / 3.0f, 16.0f / 9.0f, 16.0f / 10.0f, 19.0f / 9.0f, 64.0f / 27.0f, 32.0f / 9.0f, 8.0f / 7.0f, 5.0f / 4.0f, - 3.0f / 2.0f, 2.0f / 1.0f, 1.0f, -1.0f}}; +static std::array s_display_aspect_ratio_names = { + {TRANSLATABLE("DisplayAspectRatio", "Auto (Game Native)"), "4:3", "16:9", "16:10", "19:9", "20:9", "21:9", "32:9", + "8:7", "5:4", "3:2", "2:1 (VRAM 1:1)", "1:1", "PAR 1:1"}}; +static constexpr std::array s_display_aspect_ratio_values = { + {-1.0f, 4.0f / 3.0f, 16.0f / 9.0f, 16.0f / 10.0f, 19.0f / 9.0f, 20.0f / 9.0f, 64.0f / 27.0f, 32.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 Settings::ParseDisplayAspectRatio(const char* str) { diff --git a/src/core/types.h b/src/core/types.h index 0a0112756..e17fbe8cd 100644 --- a/src/core/types.h +++ b/src/core/types.h @@ -98,6 +98,7 @@ enum class DisplayAspectRatio : u8 R16_9, R16_10, R19_9, + R20_9, R21_9, R32_9, R8_7, diff --git a/src/frontend-common/game_list.h b/src/frontend-common/game_list.h index 2122c5c7f..9bc7aa929 100644 --- a/src/frontend-common/game_list.h +++ b/src/frontend-common/game_list.h @@ -108,7 +108,7 @@ private: enum : u32 { GAME_LIST_CACHE_SIGNATURE = 0x45434C47, - GAME_LIST_CACHE_VERSION = 20 + GAME_LIST_CACHE_VERSION = 21 }; using DatabaseMap = std::unordered_map;