mirror of https://github.com/PCSX2/pcsx2.git
Automatic aspect ratio switch during FMV playback
Updated to bypass ini setting for automatic aspect ratio switch.
This commit is contained in:
parent
df70b8bb0e
commit
6defe6e07d
|
@ -25,6 +25,7 @@
|
||||||
#include "Gif.h"
|
#include "Gif.h"
|
||||||
#include "Vif_Dma.h"
|
#include "Vif_Dma.h"
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include "AppConfig.h"
|
||||||
|
|
||||||
#include "Utilities/MemsetFast.inl"
|
#include "Utilities/MemsetFast.inl"
|
||||||
|
|
||||||
|
@ -50,8 +51,8 @@ int coded_block_pattern = 0;
|
||||||
u8 indx4[16*16/2];
|
u8 indx4[16*16/2];
|
||||||
|
|
||||||
uint eecount_on_last_vdec = 0;
|
uint eecount_on_last_vdec = 0;
|
||||||
bool FMVstarted = 0;
|
bool FMVstarted = false;
|
||||||
bool EnableFMV = 0;
|
bool EnableFMV = false;
|
||||||
|
|
||||||
void tIPU_cmd::clear()
|
void tIPU_cmd::clear()
|
||||||
{
|
{
|
||||||
|
@ -400,12 +401,12 @@ static __ri void ipuBDEC(tIPU_CMD_BDEC bdec)
|
||||||
|
|
||||||
static __fi bool ipuVDEC(u32 val)
|
static __fi bool ipuVDEC(u32 val)
|
||||||
{
|
{
|
||||||
if (EmuConfig.Gamefixes.FMVinSoftwareHack) {
|
if (EmuConfig.Gamefixes.FMVinSoftwareHack || g_Conf->GSWindow.IsToggleAspectRatioSwitch) {
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
if (count++ > 5) {
|
if (count++ > 5) {
|
||||||
if (FMVstarted == 0) {
|
if (!FMVstarted) {
|
||||||
EnableFMV = 1;
|
EnableFMV = true;
|
||||||
FMVstarted = 1;
|
FMVstarted = true;
|
||||||
}
|
}
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -845,7 +845,8 @@ AppConfig::GSWindowOptions::GSWindowOptions()
|
||||||
IsMaximized = false;
|
IsMaximized = false;
|
||||||
IsFullscreen = false;
|
IsFullscreen = false;
|
||||||
|
|
||||||
IsToggleFullscreenOnDoubleClick = true;
|
IsToggleFullscreenOnDoubleClick = true;
|
||||||
|
IsToggleAspectRatioSwitch = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppConfig::GSWindowOptions::SanityCheck()
|
void AppConfig::GSWindowOptions::SanityCheck()
|
||||||
|
@ -882,7 +883,8 @@ void AppConfig::GSWindowOptions::LoadSave( IniInterface& ini )
|
||||||
IniEntry( IsMaximized );
|
IniEntry( IsMaximized );
|
||||||
IniEntry( IsFullscreen );
|
IniEntry( IsFullscreen );
|
||||||
|
|
||||||
IniEntry( IsToggleFullscreenOnDoubleClick );
|
IniEntry( IsToggleFullscreenOnDoubleClick );
|
||||||
|
IniEntry( IsToggleAspectRatioSwitch );
|
||||||
|
|
||||||
static const wxChar* AspectRatioNames[] =
|
static const wxChar* AspectRatioNames[] =
|
||||||
{
|
{
|
||||||
|
|
|
@ -220,6 +220,7 @@ public:
|
||||||
bool IsFullscreen;
|
bool IsFullscreen;
|
||||||
|
|
||||||
bool IsToggleFullscreenOnDoubleClick;
|
bool IsToggleFullscreenOnDoubleClick;
|
||||||
|
bool IsToggleAspectRatioSwitch;
|
||||||
|
|
||||||
GSWindowOptions();
|
GSWindowOptions();
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,9 @@ DEFINE_EVENT_TYPE( pxEvt_ThreadTaskTimeout_SysExec );
|
||||||
|
|
||||||
std::unique_ptr<AppConfig> g_Conf;
|
std::unique_ptr<AppConfig> g_Conf;
|
||||||
|
|
||||||
|
AspectRatioType iniAR;
|
||||||
|
bool switchAR;
|
||||||
|
|
||||||
static bool HandlePluginError( BaseException& ex )
|
static bool HandlePluginError( BaseException& ex )
|
||||||
{
|
{
|
||||||
if (!pxDialogExists(L"Dialog:" + Dialogs::ComponentsConfigDialog::GetNameStatic()))
|
if (!pxDialogExists(L"Dialog:" + Dialogs::ComponentsConfigDialog::GetNameStatic()))
|
||||||
|
@ -529,11 +532,25 @@ extern bool FMVstarted;
|
||||||
extern bool renderswitch;
|
extern bool renderswitch;
|
||||||
extern bool EnableFMV;
|
extern bool EnableFMV;
|
||||||
|
|
||||||
void DoFmvSwitch()
|
void DoFmvSwitch(bool on)
|
||||||
{
|
{
|
||||||
ScopedCoreThreadPause paused_core( new SysExecEvent_SaveSinglePlugin(PluginId_GS) );
|
if (g_Conf->GSWindow.IsToggleAspectRatioSwitch) {
|
||||||
renderswitch = !renderswitch;
|
if (on) {
|
||||||
paused_core.AllowResume();
|
switchAR = true;
|
||||||
|
iniAR = g_Conf->GSWindow.AspectRatio;
|
||||||
|
} else {
|
||||||
|
switchAR = false;
|
||||||
|
}
|
||||||
|
if (GSFrame* gsFrame = wxGetApp().GetGsFramePtr())
|
||||||
|
if (GSPanel* viewport = gsFrame->GetViewport())
|
||||||
|
viewport->DoResize();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EmuConfig.Gamefixes.FMVinSoftwareHack) {
|
||||||
|
ScopedCoreThreadPause paused_core(new SysExecEvent_SaveSinglePlugin(PluginId_GS));
|
||||||
|
renderswitch = !renderswitch;
|
||||||
|
paused_core.AllowResume();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2App::LogicalVsync()
|
void Pcsx2App::LogicalVsync()
|
||||||
|
@ -546,19 +563,19 @@ void Pcsx2App::LogicalVsync()
|
||||||
|
|
||||||
FpsManager.DoFrame();
|
FpsManager.DoFrame();
|
||||||
|
|
||||||
if (EmuConfig.Gamefixes.FMVinSoftwareHack) {
|
if (EmuConfig.Gamefixes.FMVinSoftwareHack || g_Conf->GSWindow.IsToggleAspectRatioSwitch) {
|
||||||
if (EnableFMV == 1) {
|
if (EnableFMV) {
|
||||||
Console.Warning("FMV on");
|
DevCon.Warning("FMV on");
|
||||||
DoFmvSwitch();
|
DoFmvSwitch(true);
|
||||||
EnableFMV = 0;
|
EnableFMV = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FMVstarted){
|
if (FMVstarted) {
|
||||||
int diff = cpuRegs.cycle - eecount_on_last_vdec;
|
int diff = cpuRegs.cycle - eecount_on_last_vdec;
|
||||||
if (diff > 60000000 ) {
|
if (diff > 60000000 ) {
|
||||||
Console.Warning("FMV off");
|
DevCon.Warning("FMV off");
|
||||||
DoFmvSwitch();
|
DoFmvSwitch(false);
|
||||||
FMVstarted = 0;
|
FMVstarted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,11 +155,22 @@ void GSPanel::DoResize()
|
||||||
|
|
||||||
double clientAr = (double)client.GetWidth()/(double)client.GetHeight();
|
double clientAr = (double)client.GetWidth()/(double)client.GetHeight();
|
||||||
|
|
||||||
|
extern AspectRatioType iniAR;
|
||||||
|
extern bool switchAR;
|
||||||
double targetAr = clientAr;
|
double targetAr = clientAr;
|
||||||
if( g_Conf->GSWindow.AspectRatio == AspectRatio_4_3 )
|
|
||||||
targetAr = 4.0/3.0;
|
if (g_Conf->GSWindow.AspectRatio != iniAR) {
|
||||||
else if( g_Conf->GSWindow.AspectRatio == AspectRatio_16_9 )
|
switchAR = false;
|
||||||
targetAr = 16.0/9.0;
|
}
|
||||||
|
|
||||||
|
if (!switchAR) {
|
||||||
|
if (g_Conf->GSWindow.AspectRatio == AspectRatio_4_3)
|
||||||
|
targetAr = 4.0 / 3.0;
|
||||||
|
else if (g_Conf->GSWindow.AspectRatio == AspectRatio_16_9)
|
||||||
|
targetAr = 16.0 / 9.0;
|
||||||
|
} else {
|
||||||
|
targetAr = 4.0 / 3.0;
|
||||||
|
}
|
||||||
|
|
||||||
double arr = targetAr / clientAr;
|
double arr = targetAr / clientAr;
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
// renderswitch - tells GSdx to go into dx9 sw if "renderswitch" is set.
|
// renderswitch - tells GSdx to go into dx9 sw if "renderswitch" is set.
|
||||||
bool renderswitch = false;
|
bool renderswitch = false;
|
||||||
|
|
||||||
|
extern bool switchAR;
|
||||||
|
|
||||||
static int g_Pcsx2Recording = 0; // true 1 if recording video and sound
|
static int g_Pcsx2Recording = 0; // true 1 if recording video and sound
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,6 +177,8 @@ namespace Implementations
|
||||||
{
|
{
|
||||||
AspectRatioType& art = g_Conf->GSWindow.AspectRatio;
|
AspectRatioType& art = g_Conf->GSWindow.AspectRatio;
|
||||||
wxString arts(L"Not modified");
|
wxString arts(L"Not modified");
|
||||||
|
if (art == AspectRatio_Stretch && switchAR) //avoids a double 4:3 when coming from FMV aspect ratio switch
|
||||||
|
art = AspectRatio_4_3;
|
||||||
switch( art )
|
switch( art )
|
||||||
{
|
{
|
||||||
case AspectRatio_Stretch: art = AspectRatio_4_3; arts = L"AspectRatio_4_3"; break;
|
case AspectRatio_Stretch: art = AspectRatio_4_3; arts = L"AspectRatio_4_3"; break;
|
||||||
|
|
|
@ -286,6 +286,7 @@ namespace Panels
|
||||||
|
|
||||||
pxCheckBox* m_check_HideMouse;
|
pxCheckBox* m_check_HideMouse;
|
||||||
pxCheckBox* m_check_DclickFullscreen;
|
pxCheckBox* m_check_DclickFullscreen;
|
||||||
|
pxCheckBox* m_check_AspectRatioSwitch;
|
||||||
|
|
||||||
wxTextCtrl* m_text_WindowWidth;
|
wxTextCtrl* m_text_WindowWidth;
|
||||||
wxTextCtrl* m_text_WindowHeight;
|
wxTextCtrl* m_text_WindowHeight;
|
||||||
|
|
|
@ -49,6 +49,7 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent )
|
||||||
m_check_Fullscreen = new pxCheckBox( this, _("Default to fullscreen mode on open") );
|
m_check_Fullscreen = new pxCheckBox( this, _("Default to fullscreen mode on open") );
|
||||||
m_check_VsyncEnable = new pxCheckBox( this, _("Wait for Vsync on refresh") );
|
m_check_VsyncEnable = new pxCheckBox( this, _("Wait for Vsync on refresh") );
|
||||||
m_check_DclickFullscreen = new pxCheckBox( this, _("Double-click toggles fullscreen mode") );
|
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_check_ExclusiveFS = new pxCheckBox( this, _("Use exclusive fullscreen mode (if available)") );
|
||||||
|
|
||||||
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"
|
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"
|
||||||
|
@ -99,6 +100,7 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent )
|
||||||
|
|
||||||
*this += m_check_Fullscreen;
|
*this += m_check_Fullscreen;
|
||||||
*this += m_check_DclickFullscreen;
|
*this += m_check_DclickFullscreen;
|
||||||
|
*this += m_check_AspectRatioSwitch;
|
||||||
|
|
||||||
//*this += m_check_ExclusiveFS;
|
//*this += m_check_ExclusiveFS;
|
||||||
*this += new wxStaticLine( this ) | StdExpand();
|
*this += new wxStaticLine( this ) | StdExpand();
|
||||||
|
@ -131,7 +133,8 @@ void Panels::GSWindowSettingsPanel::ApplyConfigToGui( AppConfig& configToApply,
|
||||||
m_combo_AspectRatio ->SetSelection( (int)conf.AspectRatio );
|
m_combo_AspectRatio ->SetSelection( (int)conf.AspectRatio );
|
||||||
m_text_Zoom ->ChangeValue( conf.Zoom.ToString() );
|
m_text_Zoom ->ChangeValue( conf.Zoom.ToString() );
|
||||||
|
|
||||||
m_check_DclickFullscreen ->SetValue ( conf.IsToggleFullscreenOnDoubleClick );
|
m_check_DclickFullscreen ->SetValue( conf.IsToggleFullscreenOnDoubleClick );
|
||||||
|
m_check_AspectRatioSwitch->SetValue( conf.IsToggleAspectRatioSwitch );
|
||||||
|
|
||||||
m_text_WindowWidth ->ChangeValue( wxsFormat( L"%d", conf.WindowSize.GetWidth() ) );
|
m_text_WindowWidth ->ChangeValue( wxsFormat( L"%d", conf.WindowSize.GetWidth() ) );
|
||||||
m_text_WindowHeight ->ChangeValue( wxsFormat( L"%d", conf.WindowSize.GetHeight() ) );
|
m_text_WindowHeight ->ChangeValue( wxsFormat( L"%d", conf.WindowSize.GetHeight() ) );
|
||||||
|
@ -157,6 +160,7 @@ void Panels::GSWindowSettingsPanel::Apply()
|
||||||
gsconf.VsyncEnable = m_check_VsyncEnable->GetValue();
|
gsconf.VsyncEnable = m_check_VsyncEnable->GetValue();
|
||||||
|
|
||||||
appconf.IsToggleFullscreenOnDoubleClick = m_check_DclickFullscreen->GetValue();
|
appconf.IsToggleFullscreenOnDoubleClick = m_check_DclickFullscreen->GetValue();
|
||||||
|
appconf.IsToggleAspectRatioSwitch = m_check_AspectRatioSwitch->GetValue();
|
||||||
|
|
||||||
long xr, yr = 1;
|
long xr, yr = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue