From fd7a862226ea642e3b6179f88d5cc2926b0ee9b8 Mon Sep 17 00:00:00 2001 From: FlatOutPS2 Date: Tue, 23 Oct 2018 20:58:28 +0200 Subject: [PATCH] PCSX2: "FMV Aspect Ratio Switch/Override" feature. Change "Switch to 4:3 aspect ratio when an FMV plays" to "FMV Aspect Ratio Override" drop down menu. The option temporarily changes the Aspect Ratio to either 16:9 or 4:3 depending on the option that is selected, and depending on the Window Aspect ratio that is selected. Original commit: https://github.com/PCSX2/pcsx2/pull/1918/commits/8d471e1f1683af1d23a274a165ee1865633f9e82 Co author: lightningterror. --- pcsx2/IPU/IPU.cpp | 2 +- pcsx2/gui/AppConfig.cpp | 15 +++++++-- pcsx2/gui/AppConfig.h | 10 +++++- pcsx2/gui/AppMain.cpp | 4 +-- pcsx2/gui/FrameForGS.cpp | 6 ++++ pcsx2/gui/Panels/ConfigurationPanels.h | 2 +- pcsx2/gui/Panels/GSWindowPanel.cpp | 46 +++++++++++++++++--------- 7 files changed, 62 insertions(+), 23 deletions(-) diff --git a/pcsx2/IPU/IPU.cpp b/pcsx2/IPU/IPU.cpp index 709f571dcc..6fefaee3ae 100644 --- a/pcsx2/IPU/IPU.cpp +++ b/pcsx2/IPU/IPU.cpp @@ -409,7 +409,7 @@ static __ri void ipuBDEC(tIPU_CMD_BDEC bdec) static __fi bool ipuVDEC(u32 val) { - if (EmuConfig.Gamefixes.FMVinSoftwareHack || g_Conf->GSWindow.IsToggleAspectRatioSwitch) { + if (EmuConfig.Gamefixes.FMVinSoftwareHack || g_Conf->GSWindow.FMVAspectRatioSwitch != FMV_AspectRatio_Switch_Off) { static int count = 0; if (count++ > 5) { if (!FMVstarted) { diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index a4e058b55e..6b46872545 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -817,6 +817,7 @@ AppConfig::GSWindowOptions::GSWindowOptions() DisableScreenSaver = true; AspectRatio = AspectRatio_4_3; + FMVAspectRatioSwitch = FMV_AspectRatio_Switch_Off; Zoom = 100; StretchY = 100; OffsetX = 0; @@ -829,7 +830,6 @@ AppConfig::GSWindowOptions::GSWindowOptions() EnableVsyncWindowFlag = false; IsToggleFullscreenOnDoubleClick = true; - IsToggleAspectRatioSwitch = false; } void AppConfig::GSWindowOptions::SanityCheck() @@ -868,7 +868,6 @@ void AppConfig::GSWindowOptions::LoadSave( IniInterface& ini ) IniEntry( EnableVsyncWindowFlag ); IniEntry( IsToggleFullscreenOnDoubleClick ); - IniEntry( IsToggleAspectRatioSwitch ); static const wxChar* AspectRatioNames[] = { @@ -880,6 +879,18 @@ void AppConfig::GSWindowOptions::LoadSave( IniInterface& ini ) }; ini.EnumEntry( L"AspectRatio", AspectRatio, AspectRatioNames, AspectRatio ); + + static const wxChar* FMVAspectRatioSwitchNames[] = + { + // FIXME: fmv_aspect_ratio_switch_labels[] is inverted + L"Off", // Standard (4:3) + L"4:3", // Widescreen (16:9) + L"16:9", // Off + // WARNING: array must be NULL terminated to compute it size + NULL + }; + ini.EnumEntry(L"FMVAspectRatioSwitch", FMVAspectRatioSwitch, FMVAspectRatioSwitchNames, FMVAspectRatioSwitch); + IniEntry( Zoom ); if( ini.IsLoading() ) SanityCheck(); diff --git a/pcsx2/gui/AppConfig.h b/pcsx2/gui/AppConfig.h index 5b741a822e..40a9d60315 100644 --- a/pcsx2/gui/AppConfig.h +++ b/pcsx2/gui/AppConfig.h @@ -96,6 +96,14 @@ enum AspectRatioType AspectRatio_MaxCount }; +enum FMVAspectRatioSwitchType +{ + FMV_AspectRatio_Switch_4_3, + FMV_AspectRatio_Switch_16_9, + FMV_AspectRatio_Switch_Off, + FMV_AspectRatio_Switch_MaxCount +}; + enum MemoryCardType { MemoryCard_None, @@ -205,6 +213,7 @@ public: bool DisableScreenSaver; AspectRatioType AspectRatio; + FMVAspectRatioSwitchType FMVAspectRatioSwitch; Fixed100 Zoom; Fixed100 StretchY; Fixed100 OffsetX; @@ -218,7 +227,6 @@ public: bool EnableVsyncWindowFlag; bool IsToggleFullscreenOnDoubleClick; - bool IsToggleAspectRatioSwitch; GSWindowOptions(); diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index 8055f40823..44c61fe397 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -517,7 +517,7 @@ extern bool EnableFMV; void DoFmvSwitch(bool on) { - if (g_Conf->GSWindow.IsToggleAspectRatioSwitch) { + if (g_Conf->GSWindow.FMVAspectRatioSwitch != FMV_AspectRatio_Switch_Off) { if (on) { switchAR = true; iniAR = g_Conf->GSWindow.AspectRatio; @@ -546,7 +546,7 @@ void Pcsx2App::LogicalVsync() FpsManager.DoFrame(); - if (EmuConfig.Gamefixes.FMVinSoftwareHack || g_Conf->GSWindow.IsToggleAspectRatioSwitch) { + if (EmuConfig.Gamefixes.FMVinSoftwareHack || g_Conf->GSWindow.FMVAspectRatioSwitch != FMV_AspectRatio_Switch_Off) { if (EnableFMV) { DevCon.Warning("FMV on"); DoFmvSwitch(true); diff --git a/pcsx2/gui/FrameForGS.cpp b/pcsx2/gui/FrameForGS.cpp index 01ac2a6fbf..9f6704c22c 100644 --- a/pcsx2/gui/FrameForGS.cpp +++ b/pcsx2/gui/FrameForGS.cpp @@ -172,6 +172,12 @@ void GSPanel::DoResize() targetAr = 4.0 / 3.0; else if (g_Conf->GSWindow.AspectRatio == AspectRatio_16_9) targetAr = 16.0 / 9.0; + } else if (switchAR) { + if (g_Conf->GSWindow.FMVAspectRatioSwitch == FMV_AspectRatio_Switch_4_3 && g_Conf->GSWindow.AspectRatio != AspectRatio_4_3) { + targetAr = 4.0 / 3.0; + } else if (g_Conf->GSWindow.FMVAspectRatioSwitch == FMV_AspectRatio_Switch_16_9 && g_Conf->GSWindow.AspectRatio != AspectRatio_16_9) { + targetAr = 16.0 / 9.0; + } } else { targetAr = 4.0 / 3.0; } diff --git a/pcsx2/gui/Panels/ConfigurationPanels.h b/pcsx2/gui/Panels/ConfigurationPanels.h index dc3278f8dd..5db6198bba 100644 --- a/pcsx2/gui/Panels/ConfigurationPanels.h +++ b/pcsx2/gui/Panels/ConfigurationPanels.h @@ -267,6 +267,7 @@ namespace Panels { protected: wxComboBox* m_combo_AspectRatio; + wxComboBox* m_combo_FMVAspectRatioSwitch; wxComboBox* m_combo_vsync; wxTextCtrl* m_text_Zoom; @@ -287,7 +288,6 @@ namespace Panels pxCheckBox* m_check_HideMouse; pxCheckBox* m_check_DclickFullscreen; - pxCheckBox* m_check_AspectRatioSwitch; wxTextCtrl* m_text_WindowWidth; wxTextCtrl* m_text_WindowHeight; diff --git a/pcsx2/gui/Panels/GSWindowPanel.cpp b/pcsx2/gui/Panels/GSWindowPanel.cpp index 5685a214bf..85e2eb3d83 100644 --- a/pcsx2/gui/Panels/GSWindowPanel.cpp +++ b/pcsx2/gui/Panels/GSWindowPanel.cpp @@ -32,6 +32,13 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent ) _("Widescreen (16:9)") }; + const wxString fmv_aspect_ratio_switch_labels[] = + { + _("Standard (4:3)"), + _("Widescreen (16:9)"), + _("Off (Default)") + }; + // Warning must match the order of the VsyncMode Enum const wxString vsync_label[] = { @@ -45,6 +52,9 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent ) m_combo_AspectRatio = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, ArraySize(aspect_ratio_labels), aspect_ratio_labels, wxCB_READONLY ); + m_combo_FMVAspectRatioSwitch = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, + ArraySize(fmv_aspect_ratio_switch_labels), fmv_aspect_ratio_switch_labels, wxCB_READONLY); + m_combo_vsync = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, ArraySize(vsync_label), vsync_label, wxCB_READONLY ); @@ -59,9 +69,12 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent ) m_check_CloseGS = new pxCheckBox( this, _("Hide window when paused") ); m_check_Fullscreen = new pxCheckBox( this, _("Default to fullscreen mode on open") ); m_check_DclickFullscreen = new pxCheckBox( this, _("Double-click toggles fullscreen mode") ); - m_check_AspectRatioSwitch = new pxCheckBox(this, _("Switch to 4:3 aspect ratio when an FMV plays")); //m_check_ExclusiveFS = new pxCheckBox( this, _("Use exclusive fullscreen mode (if available)") ); + m_combo_FMVAspectRatioSwitch->SetToolTip( pxEt( L"4:3: Temporarily switch to a 4:3 aspect ratio while an FMV plays to correctly display an 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.\n\n" + L"Off: Disables temporary aspect ratio switch.") ); + m_text_Zoom->SetToolTip( pxEt( L"Zoom = 100: Fit the entire image to the window without any cropping.\nAbove/Below 100: Zoom In/Out\n0: Automatic-Zoom-In untill the black-bars are gone (Aspect ratio is kept, some of the image goes out of screen).\n NOTE: Some games draw their own black-bars, which will not be removed with '0'.\n\nKeyboard: CTRL + NUMPAD-PLUS: Zoom-In, CTRL + NUMPAD-MINUS: Zoom-Out, CTRL + NUMPAD-*: Toggle 100/0" ) ); @@ -86,41 +99,42 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent ) wxBoxSizer& s_customsize( *new wxBoxSizer( wxHORIZONTAL ) ); s_customsize += m_text_WindowWidth; - s_customsize += Label( L"x" ) | StdExpand(); + s_customsize += Label( L"x" ) | StdExpand(); s_customsize += m_text_WindowHeight; wxFlexGridSizer& s_AspectRatio( *new wxFlexGridSizer( 2, StdPadding, StdPadding ) ); //s_AspectRatio.AddGrowableCol( 0 ); s_AspectRatio.AddGrowableCol( 1 ); - s_AspectRatio += Label(_("Aspect Ratio:")) | pxMiddle; - s_AspectRatio += m_combo_AspectRatio | pxAlignRight; - s_AspectRatio += Label(_("Custom Window Size:")) | pxMiddle; - s_AspectRatio += s_customsize | pxAlignRight; + s_AspectRatio += Label(_("Aspect Ratio:")) | pxMiddle; + s_AspectRatio += m_combo_AspectRatio | pxAlignRight; + s_AspectRatio += Label(_("FMV Aspect Ratio Override:")) | pxMiddle; + s_AspectRatio += m_combo_FMVAspectRatioSwitch | pxAlignRight; + s_AspectRatio += Label(_("Custom Window Size:")) | pxMiddle; + s_AspectRatio += s_customsize | pxAlignRight; - s_AspectRatio += Label(_("Zoom:")) | pxMiddle; - s_AspectRatio += m_text_Zoom | pxAlignRight; + s_AspectRatio += Label(_("Zoom:")) | pxMiddle; + s_AspectRatio += m_text_Zoom | pxAlignRight; wxFlexGridSizer& s_vsync( *new wxFlexGridSizer( 2, StdPadding, StdPadding ) ); s_vsync.AddGrowableCol( 1 ); s_vsync += Label(_("Wait for Vsync on refresh:")) | pxMiddle; - s_vsync += m_combo_vsync | pxAlignRight; + s_vsync += m_combo_vsync | pxAlignRight; - *this += s_AspectRatio | StdExpand(); + *this += s_AspectRatio | StdExpand(); *this += m_check_SizeLock; *this += m_check_HideMouse; *this += m_check_CloseGS; - *this += new wxStaticLine( this ) | StdExpand(); + *this += new wxStaticLine( this ) | StdExpand(); *this += m_check_Fullscreen; *this += m_check_DclickFullscreen; - *this += m_check_AspectRatioSwitch; //*this += m_check_ExclusiveFS; - *this += new wxStaticLine( this ) | StdExpand(); + *this += new wxStaticLine( this ) | StdExpand(); - *this += s_vsync | StdExpand(); + *this += s_vsync | StdExpand(); wxBoxSizer* centerSizer = new wxBoxSizer( wxVERTICAL ); *centerSizer += GetSizer() | pxCenter; @@ -146,10 +160,10 @@ void Panels::GSWindowSettingsPanel::ApplyConfigToGui( AppConfig& configToApply, m_check_SizeLock ->SetValue( conf.DisableResizeBorders ); m_combo_AspectRatio ->SetSelection( (int)conf.AspectRatio ); + m_combo_FMVAspectRatioSwitch->SetSelection( enum_cast( conf.FMVAspectRatioSwitch ) ); m_text_Zoom ->ChangeValue( conf.Zoom.ToString() ); m_check_DclickFullscreen ->SetValue( conf.IsToggleFullscreenOnDoubleClick ); - m_check_AspectRatioSwitch->SetValue( conf.IsToggleAspectRatioSwitch ); m_text_WindowWidth ->ChangeValue( wxsFormat( L"%d", conf.WindowSize.GetWidth() ) ); m_text_WindowHeight ->ChangeValue( wxsFormat( L"%d", conf.WindowSize.GetHeight() ) ); @@ -170,12 +184,12 @@ void Panels::GSWindowSettingsPanel::Apply() appconf.DisableResizeBorders = m_check_SizeLock ->GetValue(); appconf.AspectRatio = (AspectRatioType)m_combo_AspectRatio->GetSelection(); + appconf.FMVAspectRatioSwitch = (FMVAspectRatioSwitchType)m_combo_FMVAspectRatioSwitch->GetSelection(); appconf.Zoom = Fixed100::FromString( m_text_Zoom->GetValue() ); gsconf.VsyncEnable = static_cast(m_combo_vsync->GetSelection()); appconf.IsToggleFullscreenOnDoubleClick = m_check_DclickFullscreen->GetValue(); - appconf.IsToggleAspectRatioSwitch = m_check_AspectRatioSwitch->GetValue(); long xr, yr = 1;