Skip to content

Commit

Permalink
GS: Add a 10:7 pixel ration option
Browse files Browse the repository at this point in the history
  • Loading branch information
crashGG authored and F0bes committed Sep 25, 2024
1 parent 13e0546 commit 6c3cf12
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 1 deletion.
10 changes: 10 additions & 0 deletions pcsx2-qt/Settings/GraphicsSettingsWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@
<string>Widescreen (16:9)</string>
</property>
</item>
<item>
<property name="text">
<string>Native (10:7)</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
Expand Down Expand Up @@ -135,6 +140,11 @@
<string>Widescreen (16:9)</string>
</property>
</item>
<item>
<property name="text">
<string>Native (10:7)</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
Expand Down
2 changes: 2 additions & 0 deletions pcsx2/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ enum class AspectRatioType : u8
RAuto4_3_3_2,
R4_3,
R16_9,
R10_7,
MaxCount
};

Expand All @@ -205,6 +206,7 @@ enum class FMVAspectRatioSwitchType : u8
RAuto4_3_3_2,
R4_3,
R16_9,
R10_7,
MaxCount
};

Expand Down
3 changes: 3 additions & 0 deletions pcsx2/Counters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,9 @@ static __fi void DoFMVSwitch()
case FMVAspectRatioSwitchType::R16_9:
EmuConfig.CurrentAspectRatio = new_fmv_state ? AspectRatioType::R16_9 : EmuConfig.GS.AspectRatio;
break;
case FMVAspectRatioSwitchType::R10_7:
EmuConfig.CurrentAspectRatio = new_fmv_state ? AspectRatioType::R10_7 : EmuConfig.GS.AspectRatio;
break;
default:
break;
}
Expand Down
8 changes: 7 additions & 1 deletion pcsx2/GS/Renderers/Common/GSRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ float GSRenderer::GetModXYOffset()

static float GetCurrentAspectRatioFloat(bool is_progressive)
{
static constexpr std::array<float, static_cast<size_t>(AspectRatioType::MaxCount) + 1> ars = {{4.0f / 3.0f, 4.0f / 3.0f, 4.0f / 3.0f, 16.0f / 9.0f, 3.0f / 2.0f}};
static constexpr std::array<float, static_cast<size_t>(AspectRatioType::MaxCount) + 1> ars = {{4.0f / 3.0f, 4.0f / 3.0f, 4.0f / 3.0f, 16.0f / 9.0f, 10.0f / 7.0f, 3.0f / 2.0f}};
return ars[static_cast<u32>(GSConfig.AspectRatio) + (3u * (is_progressive && GSConfig.AspectRatio == AspectRatioType::RAuto4_3_3_2))];
}

Expand All @@ -300,7 +300,13 @@ static GSVector4 CalculateDrawDstRect(s32 window_width, s32 window_height, const
targetAr = 4.0f / 3.0f;
}
else if (EmuConfig.CurrentAspectRatio == AspectRatioType::R16_9)
{
targetAr = 16.0f / 9.0f;
}
else if (EmuConfig.CurrentAspectRatio == AspectRatioType::R10_7)
{
targetAr = 10.0f / 7.0f;
}

const float crop_adjust = (static_cast<float>(src_rect.width()) / static_cast<float>(src_size.x)) /
(static_cast<float>(src_rect.height()) / static_cast<float>(src_size.y));
Expand Down
2 changes: 2 additions & 0 deletions pcsx2/Pcsx2Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,13 +553,15 @@ const char* Pcsx2Config::GSOptions::AspectRatioNames[] = {
"Auto 4:3/3:2",
"4:3",
"16:9",
"10:7",
nullptr};

const char* Pcsx2Config::GSOptions::FMVAspectRatioSwitchNames[] = {
"Off",
"Auto 4:3/3:2",
"4:3",
"16:9",
"10:7",
nullptr};

const char* Pcsx2Config::GSOptions::BlendingLevelNames[] = {
Expand Down
3 changes: 3 additions & 0 deletions pcsx2/VMManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,9 @@ void VMManager::RequestDisplaySize(float scale /*= 0.0f*/)
case AspectRatioType::R16_9:
x_scale = (16.0f / 9.0f) / (static_cast<float>(iwidth) / static_cast<float>(iheight));
break;
case AspectRatioType::R10_7:
x_scale = (10.0f / 7.0f) / (static_cast<float>(iwidth) / static_cast<float>(iheight));
break;
case AspectRatioType::Stretch:
default:
x_scale = 1.0f;
Expand Down

0 comments on commit 6c3cf12

Please sign in to comment.