Settings: Add 8:7 display aspect ratio

Requested by users for some 256-width 240p titles (effectively 1:1 PAR
at 256x224 when overscan cropping is turned on).
This commit is contained in:
Albert Liu 2020-07-12 15:23:02 -07:00
parent 5b5c7f200d
commit 9e316e4502
3 changed files with 6 additions and 3 deletions

View File

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

View File

@ -71,6 +71,7 @@ enum class DisplayAspectRatio : u8
{ {
R4_3, R4_3,
R16_9, R16_9,
R8_7,
R2_1, R2_1,
R1_1, R1_1,
Count Count

View File

@ -1225,7 +1225,7 @@ void SDLHostInterface::DrawSettingsWindow()
ImGui::SameLine(indent); ImGui::SameLine(indent);
int display_aspect_ratio = static_cast<int>(m_settings_copy.display_aspect_ratio); int display_aspect_ratio = static_cast<int>(m_settings_copy.display_aspect_ratio);
if (ImGui::Combo( if (ImGui::Combo(
"##display_pixel_aspect_ratio", &display_aspect_ratio, "##display_aspect_ratio", &display_aspect_ratio,
[](void*, int index, const char** out_text) { [](void*, int index, const char** out_text) {
*out_text = Settings::GetDisplayAspectRatioName(static_cast<DisplayAspectRatio>(index)); *out_text = Settings::GetDisplayAspectRatioName(static_cast<DisplayAspectRatio>(index));
return true; return true;