GS/Window: Add Automatic 4:3/3:2 mode, keep 4:3 separate

This commit is contained in:
refractionpcsx2 2022-04-11 14:00:18 +01:00
parent 06e6d12e2f
commit e2044eba66
12 changed files with 69 additions and 25 deletions

View File

@ -89,7 +89,7 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsDialog* dialog, QWidget*
// Game Display Settings
//////////////////////////////////////////////////////////////////////////
SettingWidgetBinder::BindWidgetToEnumSetting(
sif, m_ui.aspectRatio, "EmuCore/GS", "AspectRatio", Pcsx2Config::GSOptions::AspectRatioNames, AspectRatioType::R4_3);
sif, m_ui.aspectRatio, "EmuCore/GS", "AspectRatio", Pcsx2Config::GSOptions::AspectRatioNames, AspectRatioType::RAuto4_3_3_2);
SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_ui.fmvAspectRatio, "EmuCore/GS", "FMVAspectRatioSwitch",
Pcsx2Config::GSOptions::FMVAspectRatioSwitchNames, FMVAspectRatioSwitchType::Off);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.interlacing, "EmuCore/GS", "deinterlace", DEFAULT_INTERLACE_MODE);

View File

@ -94,7 +94,12 @@
</item>
<item>
<property name="text">
<string>Standard (4:3/3:2 Progressive)</string>
<string>Auto Standard (4:3/3:2 Progressive)</string>
</property>
</item>
<item>
<property name="text">
<string>Standard (4:3)</string>
</property>
</item>
<item>
@ -117,6 +122,11 @@
<property name="text">
<string>Off (Default)</string>
</property>
</item>
<item>
<property name="text">
<string>Auto Standard (4:3/3:2 Progressive)</string>
</property>
</item>
<item>
<property name="text">

View File

@ -73,6 +73,7 @@ enum class VsyncMode
enum class AspectRatioType : u8
{
Stretch,
RAuto4_3_3_2,
R4_3,
R16_9,
MaxCount
@ -81,6 +82,7 @@ enum class AspectRatioType : u8
enum class FMVAspectRatioSwitchType : u8
{
Off,
RAuto4_3_3_2,
R4_3,
R16_9,
MaxCount
@ -495,7 +497,7 @@ struct Pcsx2Config
double FramerateNTSC{59.94};
double FrameratePAL{50.00};
AspectRatioType AspectRatio{AspectRatioType::R4_3};
AspectRatioType AspectRatio{AspectRatioType::RAuto4_3_3_2};
FMVAspectRatioSwitchType FMVAspectRatioSwitch{FMVAspectRatioSwitchType::Off};
GSInterlaceMode InterlaceMode{GSInterlaceMode::Automatic};
@ -983,7 +985,7 @@ struct Pcsx2Config
std::string CurrentBlockdump;
std::string CurrentIRX;
std::string CurrentGameArgs;
AspectRatioType CurrentAspectRatio = AspectRatioType::R4_3;
AspectRatioType CurrentAspectRatio = AspectRatioType::RAuto4_3_3_2;
LimiterModeType LimiterMode = LimiterModeType::Nominal;
Pcsx2Config();

View File

@ -464,6 +464,9 @@ static __fi void DoFMVSwitch()
{
case FMVAspectRatioSwitchType::Off:
break;
case FMVAspectRatioSwitchType::RAuto4_3_3_2:
EmuConfig.CurrentAspectRatio = new_fmv_state ? AspectRatioType::RAuto4_3_3_2 : EmuConfig.GS.AspectRatio;
break;
case FMVAspectRatioSwitchType::R4_3:
EmuConfig.CurrentAspectRatio = new_fmv_state ? AspectRatioType::R4_3 : EmuConfig.GS.AspectRatio;
break;

View File

@ -671,6 +671,13 @@ void GSsetFrameSkip(int frameskip)
s_gs->SetFrameSkip(frameskip);
}
GSVideoMode GSgetDisplayMode()
{
GSRenderer* gs = s_gs.get();
return gs->GetVideoMode();
}
void GSgetInternalResolution(int* width, int* height)
{
GSRenderer* gs = s_gs.get();

View File

@ -81,6 +81,7 @@ void GSendRecording();
void GSsetGameCRC(u32 crc, int options);
void GSsetFrameSkip(int frameskip);
GSVideoMode GSgetDisplayMode();
void GSgetInternalResolution(int* width, int* height);
void GSgetStats(std::string& info);
void GSgetTitleStats(std::string& info);

View File

@ -367,7 +367,7 @@ bool GSRenderer::Merge(int field)
}
if (tex[0] || tex[1])
{
if (tex[0] == tex[1] && !slbg && (src[0] == src[1] & dst[0] == dst[1]).alltrue() && !feedback_merge)
if ((tex[0] == tex[1]) && (src[0] == src[1]).alltrue() && (dst[0] == dst[1]).alltrue() && !feedback_merge && !slbg)
{
// the two outputs are identical, skip drawing one of them (the one that is alpha blended)
@ -424,8 +424,8 @@ GSVector2i GSRenderer::GetInternalResolution()
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, 16.0f / 9.0f, 3.0f / 2.0f} };
return ars[static_cast<u32>(GSConfig.AspectRatio) + (3u * 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} };
return ars[static_cast<u32>(GSConfig.AspectRatio) + (3u * (is_progressive && GSConfig.AspectRatio == AspectRatioType::RAuto4_3_3_2))];
}
static GSVector4 CalculateDrawRect(s32 window_width, s32 window_height, s32 texture_width, s32 texture_height, HostDisplay::Alignment alignment, bool flip_y, bool is_progressive)
@ -435,13 +435,17 @@ static GSVector4 CalculateDrawRect(s32 window_width, s32 window_height, s32 text
const float clientAr = f_width / f_height;
float targetAr = clientAr;
if (EmuConfig.CurrentAspectRatio == AspectRatioType::R4_3)
if (EmuConfig.CurrentAspectRatio == AspectRatioType::RAuto4_3_3_2)
{
if (is_progressive)
targetAr = 3.0f / 2.0f;
else
targetAr = 4.0f / 3.0f;
}
else if (EmuConfig.CurrentAspectRatio == AspectRatioType::R4_3)
{
targetAr = 4.0f / 3.0f;
}
else if (EmuConfig.CurrentAspectRatio == AspectRatioType::R16_9)
targetAr = 16.0f / 9.0f;

View File

@ -263,13 +263,15 @@ void Pcsx2Config::CpuOptions::LoadSave(SettingsWrapper& wrap)
const char* Pcsx2Config::GSOptions::AspectRatioNames[] = {
"Stretch",
"4:3/3:2 (Progressive)",
"Auto 4:3/3:2",
"4:3",
"16:9",
nullptr};
const char* Pcsx2Config::GSOptions::FMVAspectRatioSwitchNames[] = {
"Off",
"4:3/3:2 (Progressive)",
"Auto 4:3/3:2",
"4:3",
"16:9",
nullptr};

View File

@ -270,16 +270,22 @@ void VMManager::RequestDisplaySize(float scale /*= 0.0f*/)
float x_scale;
switch (GSConfig.AspectRatio)
{
case AspectRatioType::R4_3:
x_scale = (4.0f / 3.0f) / (static_cast<float>(iwidth) / static_cast<float>(iheight));
break;
case AspectRatioType::R16_9:
x_scale = (16.0f / 9.0f) / (static_cast<float>(iwidth) / static_cast<float>(iheight));
break;
case AspectRatioType::Stretch:
default:
x_scale = 1.0f;
break;
case AspectRatioType::RAuto4_3_3_2:
if (GSgetDisplayMode() == GSVideoMode::SDTV_480P)
x_scale = (3.0f / 2.0f) / (static_cast<float>(iwidth) / static_cast<float>(iheight));
else
x_scale = (4.0f / 3.0f) / (static_cast<float>(iwidth) / static_cast<float>(iheight));
break;
case AspectRatioType::R4_3:
x_scale = (4.0f / 3.0f) / (static_cast<float>(iwidth) / static_cast<float>(iheight));
break;
case AspectRatioType::R16_9:
x_scale = (16.0f / 9.0f) / (static_cast<float>(iwidth) / static_cast<float>(iheight));
break;
case AspectRatioType::Stretch:
default:
x_scale = 1.0f;
break;
}
float width = static_cast<float>(iwidth) * x_scale;

View File

@ -874,7 +874,8 @@ void AppConfig::GSWindowOptions::LoadSave(IniInterface& ini)
static const wxChar* AspectRatioNames[] =
{
L"Stretch",
L"4:3/3:2 (Progressive)",
L"Auto 4:3/3:2 (Progressive)",
L"4:3",
L"16:9",
// WARNING: array must be NULL terminated to compute it size
NULL};
@ -886,7 +887,8 @@ void AppConfig::GSWindowOptions::LoadSave(IniInterface& ini)
static const wxChar* FMVAspectRatioSwitchNames[] =
{
L"Off",
L"4:3/3:2 (Progressive)",
L"Auto 4:3/3:2 (Progressive)",
L"4:3",
L"16:9",
// WARNING: array must be NULL terminated to compute it size
NULL};

View File

@ -172,6 +172,10 @@ namespace Implementations
switch (art)
{
case AspectRatioType::Stretch:
art = AspectRatioType::RAuto4_3_3_2;
arts = "Auto 4:3/3:2";
break;
case AspectRatioType::RAuto4_3_3_2:
art = AspectRatioType::R4_3;
arts = "4:3";
break;

View File

@ -32,13 +32,15 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel(wxWindow* parent)
const wxString aspect_ratio_labels[] =
{
_("Fit to Window/Screen"),
_("Standard (4:3/3:2 Progressive)"),
_("Auto Standard (4:3/3:2 Progressive)"),
_("Standard (4:3)"),
_("Widescreen (16:9)")};
const wxString fmv_aspect_ratio_switch_labels[] =
{
_("Off (Default)"),
_("Standard (4:3/3:2 Progressive)"),
_("Auto Standard (4:3/3:2 Progressive)"),
_("Standard (4:3)"),
_("Widescreen (16:9)")};
// Warning must match the order of the VsyncMode Enum
@ -74,7 +76,8 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel(wxWindow* parent)
m_check_DclickFullscreen = new pxCheckBox(this, _("Double-click toggles fullscreen mode"));
m_combo_FMVAspectRatioSwitch->SetToolTip(pxEt(L"Off: Disables temporary aspect ratio switch. (It will use the above setting from Aspect Ratio instead of FMV Aspect Ratio Override.)\n\n"
L"4:3: Temporarily switch to a 4:3 aspect ratio while an FMV plays to correctly display an 4:3 FMV. Will use 3:2 is the resolution is 480P\n\n"
L"Auto 4:3/3:2: Temporarily switch to a 4:3 aspect ratio while an FMV plays to correctly display a 4:3 FMV. Will use 3:2 is the resolution is 480P\n\n"
L"4:3: Temporarily switch to a 4:3 aspect ratio while an FMV plays to correctly display a 4:3 FMV. \n\n"
L"16:9: Temporarily switch to a 16:9 aspect ratio while an FMV plays to correctly display a widescreen 16:9 FMV."));
m_text_Zoom->SetToolTip(pxEt(L"Zoom = 100: Fit the entire image to the window without any cropping.\n"