GPU: Add option to force 4:3 for 24-bit content (e.g. FMVs)

This commit is contained in:
Connor McLaughlin 2020-09-26 15:11:45 +10:00
parent cdc9f5c548
commit d73271ec0a
13 changed files with 37 additions and 11 deletions

View file

@ -29,7 +29,6 @@ bool GPU::Initialize(HostDisplay* host_display)
m_host_display = host_display; m_host_display = host_display;
m_force_progressive_scan = g_settings.gpu_disable_interlacing; m_force_progressive_scan = g_settings.gpu_disable_interlacing;
m_force_ntsc_timings = g_settings.gpu_force_ntsc_timings; m_force_ntsc_timings = g_settings.gpu_force_ntsc_timings;
m_crtc_state.display_aspect_ratio = Settings::GetDisplayAspectRatioValue(g_settings.display_aspect_ratio);
m_crtc_tick_event = TimingEvents::CreateTimingEvent( m_crtc_tick_event = TimingEvents::CreateTimingEvent(
"GPU CRTC Tick", 1, 1, std::bind(&GPU::CRTCTickEvent, this, std::placeholders::_1), true); "GPU CRTC Tick", 1, 1, std::bind(&GPU::CRTCTickEvent, this, std::placeholders::_1), true);
m_command_tick_event = TimingEvents::CreateTimingEvent( m_command_tick_event = TimingEvents::CreateTimingEvent(
@ -54,8 +53,6 @@ void GPU::UpdateSettings()
UpdateCRTCConfig(); UpdateCRTCConfig();
} }
m_crtc_state.display_aspect_ratio = Settings::GetDisplayAspectRatioValue(g_settings.display_aspect_ratio);
// Crop mode calls this, so recalculate the display area // Crop mode calls this, so recalculate the display area
UpdateCRTCDisplayParameters(); UpdateCRTCDisplayParameters();
} }
@ -442,6 +439,14 @@ float GPU::ComputeVerticalFrequency() const
static_cast<double>(ticks_per_frame)); static_cast<double>(ticks_per_frame));
} }
float GPU::GetDisplayAspectRatio() const
{
if (g_settings.display_force_4_3_for_24bit && m_GPUSTAT.display_area_color_depth_24)
return 4.0f / 3.0f;
else
return Settings::GetDisplayAspectRatioValue(g_settings.display_aspect_ratio);
}
void GPU::UpdateCRTCConfig() void GPU::UpdateCRTCConfig()
{ {
static constexpr std::array<u16, 8> dot_clock_dividers = {{10, 8, 5, 4, 7, 7, 7, 7}}; static constexpr std::array<u16, 8> dot_clock_dividers = {{10, 8, 5, 4, 7, 7, 7, 7}};

View file

@ -375,6 +375,7 @@ protected:
// Sets dots per scanline // Sets dots per scanline
float ComputeHorizontalFrequency() const; float ComputeHorizontalFrequency() const;
float ComputeVerticalFrequency() const; float ComputeVerticalFrequency() const;
float GetDisplayAspectRatio() const;
void UpdateCRTCConfig(); void UpdateCRTCConfig();
void UpdateCRTCDisplayParameters(); void UpdateCRTCDisplayParameters();
@ -700,7 +701,6 @@ protected:
TickCount current_tick_in_scanline; TickCount current_tick_in_scanline;
u32 current_scanline; u32 current_scanline;
float display_aspect_ratio;
bool in_hblank; bool in_hblank;
bool in_vblank; bool in_vblank;

View file

@ -705,7 +705,7 @@ void GPU_HW_D3D11::UpdateDisplay()
m_host_display->SetDisplayParameters(m_crtc_state.display_width, m_crtc_state.display_height, m_host_display->SetDisplayParameters(m_crtc_state.display_width, m_crtc_state.display_height,
m_crtc_state.display_origin_left, m_crtc_state.display_origin_top, m_crtc_state.display_origin_left, m_crtc_state.display_origin_top,
m_crtc_state.display_vram_width, m_crtc_state.display_vram_height, m_crtc_state.display_vram_width, m_crtc_state.display_vram_height,
m_crtc_state.display_aspect_ratio); GetDisplayAspectRatio());
} }
} }

View file

@ -695,7 +695,7 @@ void GPU_HW_OpenGL::UpdateDisplay()
m_host_display->SetDisplayParameters(m_crtc_state.display_width, m_crtc_state.display_height, m_host_display->SetDisplayParameters(m_crtc_state.display_width, m_crtc_state.display_height,
m_crtc_state.display_origin_left, m_crtc_state.display_origin_top, m_crtc_state.display_origin_left, m_crtc_state.display_origin_top,
m_crtc_state.display_vram_width, m_crtc_state.display_vram_height, m_crtc_state.display_vram_width, m_crtc_state.display_vram_height,
m_crtc_state.display_aspect_ratio); GetDisplayAspectRatio());
} }
} }

View file

@ -1031,7 +1031,7 @@ void GPU_HW_Vulkan::UpdateDisplay()
m_host_display->SetDisplayParameters(m_crtc_state.display_width, m_crtc_state.display_height, m_host_display->SetDisplayParameters(m_crtc_state.display_width, m_crtc_state.display_height,
m_crtc_state.display_origin_left, m_crtc_state.display_origin_top, m_crtc_state.display_origin_left, m_crtc_state.display_origin_top,
m_crtc_state.display_vram_width, m_crtc_state.display_vram_height, m_crtc_state.display_vram_width, m_crtc_state.display_vram_height,
m_crtc_state.display_aspect_ratio); GetDisplayAspectRatio());
} }
} }

View file

@ -198,7 +198,7 @@ void GPU_SW::UpdateDisplay()
m_host_display->SetDisplayParameters(m_crtc_state.display_width, m_crtc_state.display_height, m_host_display->SetDisplayParameters(m_crtc_state.display_width, m_crtc_state.display_height,
m_crtc_state.display_origin_left, m_crtc_state.display_origin_top, m_crtc_state.display_origin_left, m_crtc_state.display_origin_top,
m_crtc_state.display_vram_width, m_crtc_state.display_vram_height, m_crtc_state.display_vram_width, m_crtc_state.display_vram_height,
m_crtc_state.display_aspect_ratio); GetDisplayAspectRatio());
} }
else else
{ {

View file

@ -436,10 +436,11 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
si.SetBoolValue("GPU", "PGXPCPU", false); si.SetBoolValue("GPU", "PGXPCPU", false);
si.SetStringValue("Display", "CropMode", Settings::GetDisplayCropModeName(Settings::DEFAULT_DISPLAY_CROP_MODE)); si.SetStringValue("Display", "CropMode", Settings::GetDisplayCropModeName(Settings::DEFAULT_DISPLAY_CROP_MODE));
si.SetIntValue("Display", "OverscanActiveStartOffset", 0); si.SetIntValue("Display", "ActiveStartOffset", 0);
si.SetIntValue("Display", "OverscanActiveEndOffset", 0); si.SetIntValue("Display", "ActiveEndOffset", 0);
si.SetStringValue("Display", "AspectRatio", si.SetStringValue("Display", "AspectRatio",
Settings::GetDisplayAspectRatioName(Settings::DEFAULT_DISPLAY_ASPECT_RATIO)); Settings::GetDisplayAspectRatioName(Settings::DEFAULT_DISPLAY_ASPECT_RATIO));
si.SetBoolValue("Display", "Force4_3For24Bit", false);
si.SetBoolValue("Display", "LinearFiltering", true); si.SetBoolValue("Display", "LinearFiltering", true);
si.SetBoolValue("Display", "IntegerScaling", false); si.SetBoolValue("Display", "IntegerScaling", false);
si.SetBoolValue("Display", "PostProcessing", false); si.SetBoolValue("Display", "PostProcessing", false);

View file

@ -126,6 +126,7 @@ void Settings::Load(SettingsInterface& si)
ParseDisplayAspectRatio( ParseDisplayAspectRatio(
si.GetStringValue("Display", "AspectRatio", GetDisplayAspectRatioName(DEFAULT_DISPLAY_ASPECT_RATIO)).c_str()) si.GetStringValue("Display", "AspectRatio", GetDisplayAspectRatioName(DEFAULT_DISPLAY_ASPECT_RATIO)).c_str())
.value_or(DEFAULT_DISPLAY_ASPECT_RATIO); .value_or(DEFAULT_DISPLAY_ASPECT_RATIO);
display_force_4_3_for_24bit = si.GetBoolValue("Display", "Force4_3For24Bit", false);
display_active_start_offset = static_cast<s16>(si.GetIntValue("Display", "ActiveStartOffset", 0)); display_active_start_offset = static_cast<s16>(si.GetIntValue("Display", "ActiveStartOffset", 0));
display_active_end_offset = static_cast<s16>(si.GetIntValue("Display", "ActiveEndOffset", 0)); display_active_end_offset = static_cast<s16>(si.GetIntValue("Display", "ActiveEndOffset", 0));
display_linear_filtering = si.GetBoolValue("Display", "LinearFiltering", true); display_linear_filtering = si.GetBoolValue("Display", "LinearFiltering", true);
@ -239,6 +240,7 @@ void Settings::Save(SettingsInterface& si) const
si.SetStringValue("Display", "CropMode", GetDisplayCropModeName(display_crop_mode)); si.SetStringValue("Display", "CropMode", GetDisplayCropModeName(display_crop_mode));
si.SetIntValue("Display", "ActiveStartOffset", display_active_start_offset); si.SetIntValue("Display", "ActiveStartOffset", display_active_start_offset);
si.SetIntValue("Display", "ActiveEndOffset", display_active_end_offset); si.SetIntValue("Display", "ActiveEndOffset", display_active_end_offset);
si.SetBoolValue("Display", "Force4_3For24Bit", display_force_4_3_for_24bit);
si.SetStringValue("Display", "AspectRatio", GetDisplayAspectRatioName(display_aspect_ratio)); si.SetStringValue("Display", "AspectRatio", GetDisplayAspectRatioName(display_aspect_ratio));
si.SetBoolValue("Display", "LinearFiltering", display_linear_filtering); si.SetBoolValue("Display", "LinearFiltering", display_linear_filtering);
si.SetBoolValue("Display", "IntegerScaling", display_integer_scaling); si.SetBoolValue("Display", "IntegerScaling", display_integer_scaling);

View file

@ -104,6 +104,7 @@ struct Settings
s16 display_active_start_offset = 0; s16 display_active_start_offset = 0;
s16 display_active_end_offset = 0; s16 display_active_end_offset = 0;
DisplayAspectRatio display_aspect_ratio = DisplayAspectRatio::R4_3; DisplayAspectRatio display_aspect_ratio = DisplayAspectRatio::R4_3;
bool display_force_4_3_for_24bit = false;
bool display_linear_filtering = true; bool display_linear_filtering = true;
bool display_integer_scaling = false; bool display_integer_scaling = false;
bool display_post_processing = false; bool display_post_processing = false;

View file

@ -445,7 +445,7 @@ void LibretroHostInterface::OnSystemDestroyed()
m_using_hardware_renderer = false; m_using_hardware_renderer = false;
} }
static std::array<retro_core_option_definition, 32> s_option_definitions = {{ static std::array<retro_core_option_definition, 33> s_option_definitions = {{
{"duckstation_Console.Region", {"duckstation_Console.Region",
"Console Region", "Console Region",
"Determines which region/hardware to emulate. Auto-Detect will use the region of the disc inserted.", "Determines which region/hardware to emulate. Auto-Detect will use the region of the disc inserted.",
@ -547,6 +547,11 @@ static std::array<retro_core_option_definition, 32> s_option_definitions = {{
"others will break.", "others will break.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"duckstation_Display.Force4_3For24Bit",
"Force 4:3 For 24-Bit Display",
"Switches back to 4:3 display aspect ratio when displaying 24-bit content, usually FMVs.",
{{"true", "Enabled"}, {"false", "Disabled"}},
"false"},
{"duckstation_GPU.TextureFilter", {"duckstation_GPU.TextureFilter",
"Texture Filtering", "Texture Filtering",
"Smooths out the blockyness of magnified textures on 3D object by using bilinear filtering. Will have a " "Smooths out the blockyness of magnified textures on 3D object by using bilinear filtering. Will have a "

View file

@ -17,6 +17,7 @@ EnhancementSettingsWidget::EnhancementSettingsWidget(QtHostInterface* host_inter
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.scaledDithering, "GPU", "ScaledDithering"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.scaledDithering, "GPU", "ScaledDithering");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.disableInterlacing, "GPU", "DisableInterlacing"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.disableInterlacing, "GPU", "DisableInterlacing");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.forceNTSCTimings, "GPU", "ForceNTSCTimings"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.forceNTSCTimings, "GPU", "ForceNTSCTimings");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.force43For24Bit, "Display", "Force4_3For24Bit");
SettingWidgetBinder::BindWidgetToEnumSetting( SettingWidgetBinder::BindWidgetToEnumSetting(
m_host_interface, m_ui.textureFiltering, "GPU", "TextureFilter", &Settings::ParseTextureFilterName, m_host_interface, m_ui.textureFiltering, "GPU", "TextureFilter", &Settings::ParseTextureFilterName,
&Settings::GetTextureFilterDisplayName, Settings::DEFAULT_GPU_TEXTURE_FILTER); &Settings::GetTextureFilterDisplayName, Settings::DEFAULT_GPU_TEXTURE_FILTER);
@ -63,6 +64,9 @@ EnhancementSettingsWidget::EnhancementSettingsWidget(QtHostInterface* host_inter
"have a speed tied to the framerate, this will result in the game running " "have a speed tied to the framerate, this will result in the game running "
"approximately 17% faster. <br>For variable " "approximately 17% faster. <br>For variable "
"frame rate games, it may not affect the speed.")); "frame rate games, it may not affect the speed."));
dialog->registerWidgetHelp(
m_ui.force43For24Bit, tr("Force 4:3 For 24-bit Display"), tr("Unchecked"),
tr("Switches back to 4:3 display aspect ratio when displaying 24-bit content, usually FMVs."));
dialog->registerWidgetHelp( dialog->registerWidgetHelp(
m_ui.textureFiltering, tr("Texture Filtering"), tr("Unchecked"), m_ui.textureFiltering, tr("Texture Filtering"), tr("Unchecked"),
tr("Smooths out the blockyness of magnified textures on 3D object by using bilinear filtering. <br>Will have a " tr("Smooths out the blockyness of magnified textures on 3D object by using bilinear filtering. <br>Will have a "

View file

@ -96,6 +96,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="force43For24Bit">
<property name="text">
<string>Force 4:3 For 24-Bit Display (disable widescreen for FMVs)</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View file

@ -1432,6 +1432,7 @@ void SDLHostInterface::DrawSettingsWindow()
settings_changed |= ImGui::Checkbox("Disable Interlacing", &m_settings_copy.gpu_disable_interlacing); settings_changed |= ImGui::Checkbox("Disable Interlacing", &m_settings_copy.gpu_disable_interlacing);
settings_changed |= ImGui::Checkbox("Force NTSC Timings", &m_settings_copy.gpu_force_ntsc_timings); settings_changed |= ImGui::Checkbox("Force NTSC Timings", &m_settings_copy.gpu_force_ntsc_timings);
settings_changed |= ImGui::Checkbox("Widescreen Hack", &m_settings_copy.gpu_widescreen_hack); settings_changed |= ImGui::Checkbox("Widescreen Hack", &m_settings_copy.gpu_widescreen_hack);
settings_changed |= ImGui::Checkbox("Force 4:3 For 24-Bit Display", &m_settings_copy.display_force_4_3_for_24bit);
settings_changed |= ImGui::Checkbox("PGXP Enabled", &m_settings_copy.gpu_pgxp_enable); settings_changed |= ImGui::Checkbox("PGXP Enabled", &m_settings_copy.gpu_pgxp_enable);
settings_changed |= ImGui::Checkbox("PGXP Culling", &m_settings_copy.gpu_pgxp_culling); settings_changed |= ImGui::Checkbox("PGXP Culling", &m_settings_copy.gpu_pgxp_culling);