mirror of https://github.com/PCSX2/pcsx2.git
Presets: better semantics on arguments.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4246 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
cadafe706e
commit
45f08e7630
|
@ -775,10 +775,10 @@ bool AppConfig::IsOkApplyPreset(int n)
|
|||
Pcsx2Config default_Pcsx2Config;
|
||||
|
||||
|
||||
// NOTE: Because the system currently only supports passing of an entire AppConfig to the GUI panels to apply,
|
||||
// the GUI panels should be aware of the settings which the presets control, such that when presets are used:
|
||||
// 1. The panels should prevent manual modifications (by graying out) of settings which the presets control.
|
||||
// 2. The panels should not apply values which the presets don't control.
|
||||
// NOTE: Because the system currently only supports passing of an entire AppConfig to the GUI panels/menus to apply/reflect,
|
||||
// the GUI entities should be aware of the settings which the presets control, such that when presets are used:
|
||||
// 1. The panels/entities should prevent manual modifications (by graying out) of settings which the presets control.
|
||||
// 2. The panels should not apply values which the presets don't control if the value is initiated by a preset.
|
||||
// Currently controlled by the presets:
|
||||
// - AppConfig: Framerate, EnableSpeedHacks, EnableGameFixes.
|
||||
// - EmuOptions: Cpu, Gamefixes, SpeedHacks, EnablePatches, GS (except FrameLimitEnable).
|
||||
|
@ -786,6 +786,9 @@ bool AppConfig::IsOkApplyPreset(int n)
|
|||
// This essentially currently covers all the options on all the panels except for framelimiter which isn't
|
||||
// controlled by the presets, and almost the entire GSWindow panel which also isn't controlled by presets
|
||||
// (however, vsync IS controlled by the presets).
|
||||
//
|
||||
// So, if changing the scope of the presets (making them affect more or less values), the relevant GUI entities
|
||||
// shoulld me modified to support it.
|
||||
|
||||
|
||||
//Force some settings as a (current) base for all presets.
|
||||
|
|
|
@ -305,7 +305,12 @@ public:
|
|||
|
||||
static int GetMaxPresetIndex();
|
||||
static bool isOkGetPresetTextAndColor(int n, wxString& label, wxColor& c);
|
||||
|
||||
bool IsOkApplyPreset(int n);
|
||||
//flags to allow manual application of settings to GUI entities. Used by the presets system.
|
||||
static const int APPLY_FLAG_MANUALLY_PROPAGATE = 0x01;
|
||||
static const int APPLY_FLAG_FROM_PRESET = 0x02;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -218,7 +218,8 @@ public:
|
|||
BaseApplicableConfigPanel_SpecificConfig( wxWindow* parent, wxOrientation orient=wxVERTICAL );
|
||||
BaseApplicableConfigPanel_SpecificConfig( wxWindow* parent, wxOrientation orient, const wxString& staticLabel );
|
||||
|
||||
virtual void ApplyConfigToGui(AppConfig& configToApply, bool manuallyPropagate=false)=0;
|
||||
//possible flags are: AppConfig: APPLY_FLAG_MANUALLY_PROPAGATE and APPLY_FLAG_IS_FROM_PRESET
|
||||
virtual void ApplyConfigToGui(AppConfig& configToApply, int flags=0)=0;
|
||||
};
|
||||
|
||||
class ApplicableWizardPage : public wxWizardPageSimple, public IApplyState
|
||||
|
|
|
@ -257,8 +257,8 @@ void Dialogs::BaseConfigurationDialog::OnApply_Click( wxCommandEvent& evt )
|
|||
{
|
||||
ScopedOkButtonDisabler disabler(this);
|
||||
|
||||
//if current instance also holds settings that need application. Apply it.
|
||||
//Currently only used by SysConfigDialog, which applies the preset.
|
||||
//if current instance also holds settings that need application, Apply them.
|
||||
//Currently only used by SysConfigDialog, which applies the preset and derivatives (menu system).
|
||||
//Needs to come before actual panels Apply since they enable/disable themselves upon Preset state,
|
||||
// so the preset needs to be applied first.
|
||||
Apply();
|
||||
|
|
|
@ -83,6 +83,7 @@ void Dialogs::SysConfigDialog::UpdateGuiForPreset ( int presetIndex, bool preset
|
|||
preset.IsOkApplyPreset( presetIndex ); //apply a preset to a copy of g_Conf.
|
||||
preset.EnablePresets = presetsEnabled; //override IsOkApplyPreset (which always applies/enabled) to actual required state
|
||||
|
||||
//update the config panels of SysConfigDialog to reflect the preset.
|
||||
size_t pages = m_labels.GetCount();
|
||||
for( size_t i=0; i<pages; ++i )
|
||||
{
|
||||
|
@ -94,7 +95,7 @@ void Dialogs::SysConfigDialog::UpdateGuiForPreset ( int presetIndex, bool preset
|
|||
if ( ((BaseApplicableConfigPanel*)(m_listbook->GetPage(i)))->IsSpecificConfig() )
|
||||
{
|
||||
((BaseApplicableConfigPanel_SpecificConfig*)(m_listbook->GetPage(i)))
|
||||
->ApplyConfigToGui( preset, true );
|
||||
->ApplyConfigToGui( preset, AppConfig::APPLY_FLAG_FROM_PRESET | AppConfig::APPLY_FLAG_MANUALLY_PROPAGATE );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,6 +183,9 @@ void Dialogs::SysConfigDialog::Preset_Scroll(wxScrollEvent &event)
|
|||
event.Skip();
|
||||
}
|
||||
|
||||
//Write the values SysConfigDialog holds (preset index and enabled) to g_Conf.
|
||||
//Make the main menu system write the presets values it holds to g_Conf (preset may have affected the gui without changing g_Conf)
|
||||
//The panels will write themselves to g_Conf on apply (AFTER this function) and will also trigger a global OnSettingsApplied.
|
||||
void Dialogs::SysConfigDialog::Apply()
|
||||
{
|
||||
//Console.WriteLn("Applying preset to to g_Conf: Preset index: %d, EnablePresets: %s", (int)m_slider_presets->GetValue(), m_check_presets->IsChecked()?"true":"false");
|
||||
|
|
|
@ -152,7 +152,7 @@ namespace Panels
|
|||
virtual ~AdvancedOptionsFPU() throw() { }
|
||||
void Apply();
|
||||
void AppStatusEvent_OnSettingsApplied();
|
||||
void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false );
|
||||
void ApplyConfigToGui( AppConfig& configToApply, int flags=0 );
|
||||
};
|
||||
|
||||
class AdvancedOptionsVU : public BaseAdvancedCpuOptions
|
||||
|
@ -162,7 +162,7 @@ namespace Panels
|
|||
virtual ~AdvancedOptionsVU() throw() { }
|
||||
void Apply();
|
||||
void AppStatusEvent_OnSettingsApplied();
|
||||
void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false );
|
||||
void ApplyConfigToGui( AppConfig& configToApply, int flags=0 );
|
||||
|
||||
};
|
||||
|
||||
|
@ -182,7 +182,7 @@ namespace Panels
|
|||
|
||||
void Apply();
|
||||
void AppStatusEvent_OnSettingsApplied();
|
||||
void ApplyConfigToGui(AppConfig& configToApply, bool manuallyPropagate=false);
|
||||
void ApplyConfigToGui(AppConfig& configToApply, int flags=0);
|
||||
|
||||
protected:
|
||||
void OnRestoreDefaults( wxCommandEvent& evt );
|
||||
|
@ -201,7 +201,7 @@ namespace Panels
|
|||
|
||||
void Apply();
|
||||
void AppStatusEvent_OnSettingsApplied();
|
||||
void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false );
|
||||
void ApplyConfigToGui( AppConfig& configToApply, int flags=0 );
|
||||
|
||||
protected:
|
||||
void OnRestoreDefaults( wxCommandEvent& evt );
|
||||
|
@ -226,7 +226,7 @@ namespace Panels
|
|||
|
||||
void Apply();
|
||||
void AppStatusEvent_OnSettingsApplied();
|
||||
void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false );
|
||||
void ApplyConfigToGui( AppConfig& configToApply, int flags=0 );
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
@ -253,7 +253,7 @@ namespace Panels
|
|||
|
||||
void Apply();
|
||||
void AppStatusEvent_OnSettingsApplied();
|
||||
void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false );
|
||||
void ApplyConfigToGui( AppConfig& configToApply, int flags=0 );
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
@ -280,7 +280,7 @@ namespace Panels
|
|||
virtual ~GSWindowSettingsPanel() throw() {}
|
||||
void Apply();
|
||||
void AppStatusEvent_OnSettingsApplied();
|
||||
void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false );
|
||||
void ApplyConfigToGui( AppConfig& configToApply, int flags=0 );
|
||||
};
|
||||
|
||||
class VideoPanel : public BaseApplicableConfigPanel_SpecificConfig
|
||||
|
@ -296,7 +296,7 @@ namespace Panels
|
|||
virtual ~VideoPanel() throw() {}
|
||||
void Apply();
|
||||
void AppStatusEvent_OnSettingsApplied();
|
||||
void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false );
|
||||
void ApplyConfigToGui( AppConfig& configToApply, int flags=0 );
|
||||
|
||||
protected:
|
||||
void OnOpenWindowSettings( wxCommandEvent& evt );
|
||||
|
@ -331,7 +331,7 @@ namespace Panels
|
|||
void Apply();
|
||||
void EnableStuff( AppConfig* configToUse=NULL );
|
||||
void AppStatusEvent_OnSettingsApplied();
|
||||
void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false );
|
||||
void ApplyConfigToGui( AppConfig& configToApply, int flags=0 );
|
||||
|
||||
protected:
|
||||
const wxChar* GetEEcycleSliderMsg( int val );
|
||||
|
@ -362,7 +362,7 @@ namespace Panels
|
|||
void OnEnable_Toggled( wxCommandEvent& evt );
|
||||
void Apply();
|
||||
void AppStatusEvent_OnSettingsApplied();
|
||||
void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false );
|
||||
void ApplyConfigToGui( AppConfig& configToApply, int flags=0 );
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
|
|
@ -240,7 +240,7 @@ void Panels::CpuPanelEE::AppStatusEvent_OnSettingsApplied()
|
|||
ApplyConfigToGui( *g_Conf );
|
||||
}
|
||||
|
||||
void Panels::CpuPanelEE::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate ){
|
||||
void Panels::CpuPanelEE::ApplyConfigToGui( AppConfig& configToApply, int flags ){
|
||||
m_panel_RecEE->Enable( x86caps.hasStreamingSIMD2Extensions );
|
||||
|
||||
// IOP rec should work fine on any CPU. :D
|
||||
|
@ -255,7 +255,7 @@ void Panels::CpuPanelEE::ApplyConfigToGui( AppConfig& configToApply, bool manual
|
|||
|
||||
this->Enable(!configToApply.EnablePresets);
|
||||
|
||||
if( manuallyPropagate )
|
||||
if( flags & AppConfig::APPLY_FLAG_MANUALLY_PROPAGATE )
|
||||
{
|
||||
m_advancedOptsFpu->ApplyConfigToGui( configToApply, true );
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ void Panels::CpuPanelVU::AppStatusEvent_OnSettingsApplied()
|
|||
ApplyConfigToGui( *g_Conf );
|
||||
}
|
||||
|
||||
void Panels::CpuPanelVU::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate )
|
||||
void Panels::CpuPanelVU::ApplyConfigToGui( AppConfig& configToApply, int flags )
|
||||
{
|
||||
m_panel_VU0->Enable( x86caps.hasStreamingSIMD2Extensions );
|
||||
m_panel_VU1->Enable( x86caps.hasStreamingSIMD2Extensions );
|
||||
|
@ -314,7 +314,7 @@ void Panels::CpuPanelVU::ApplyConfigToGui( AppConfig& configToApply, bool manual
|
|||
m_panel_VU0->Enable(!configToApply.EnablePresets);
|
||||
m_panel_VU1->Enable(!configToApply.EnablePresets);
|
||||
|
||||
if ( manuallyPropagate )
|
||||
if ( flags & AppConfig::APPLY_FLAG_MANUALLY_PROPAGATE )
|
||||
{
|
||||
m_advancedOptsVu->ApplyConfigToGui( configToApply, true );
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ void Panels::AdvancedOptionsFPU::AppStatusEvent_OnSettingsApplied()
|
|||
ApplyConfigToGui( *g_Conf );
|
||||
}
|
||||
|
||||
void Panels::AdvancedOptionsFPU::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate )
|
||||
void Panels::AdvancedOptionsFPU::ApplyConfigToGui( AppConfig& configToApply, int flags )
|
||||
{
|
||||
const Pcsx2Config::CpuOptions& cpuOps( configToApply.EmuOptions.Cpu );
|
||||
const Pcsx2Config::RecompilerOptions& recOps( cpuOps.Recompiler );
|
||||
|
@ -401,7 +401,7 @@ void Panels::AdvancedOptionsVU::AppStatusEvent_OnSettingsApplied()
|
|||
ApplyConfigToGui( *g_Conf );
|
||||
}
|
||||
|
||||
void Panels::AdvancedOptionsVU::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate )
|
||||
void Panels::AdvancedOptionsVU::ApplyConfigToGui( AppConfig& configToApply, int flags )
|
||||
{
|
||||
const Pcsx2Config::CpuOptions& cpuOps( configToApply.EmuOptions.Cpu );
|
||||
const Pcsx2Config::RecompilerOptions& recOps( cpuOps.Recompiler );
|
||||
|
|
|
@ -116,11 +116,11 @@ void Panels::GSWindowSettingsPanel::AppStatusEvent_OnSettingsApplied()
|
|||
ApplyConfigToGui( *g_Conf );
|
||||
}
|
||||
|
||||
void Panels::GSWindowSettingsPanel::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate )
|
||||
void Panels::GSWindowSettingsPanel::ApplyConfigToGui( AppConfig& configToApply, int flags )
|
||||
{
|
||||
const AppConfig::GSWindowOptions& conf( configToApply.GSWindow );
|
||||
|
||||
if( !manuallyPropagate ) //Presets don't control these: only change if config doesn't come from preset.
|
||||
if( !(flags & AppConfig::APPLY_FLAG_FROM_PRESET) ) //Presets don't control these: only change if config doesn't come from preset.
|
||||
{
|
||||
m_check_CloseGS ->SetValue( conf.CloseOnEsc );
|
||||
m_check_Fullscreen ->SetValue( conf.DefaultToFullscreen );
|
||||
|
|
|
@ -145,7 +145,7 @@ void Panels::GameFixesPanel::AppStatusEvent_OnSettingsApplied()
|
|||
ApplyConfigToGui( *g_Conf );
|
||||
}
|
||||
|
||||
void Panels::GameFixesPanel::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate )
|
||||
void Panels::GameFixesPanel::ApplyConfigToGui( AppConfig& configToApply, int flags )
|
||||
{
|
||||
const Pcsx2Config::GamefixOptions& opts( configToApply.EmuOptions.Gamefixes );
|
||||
for (GamefixId i=GamefixId_FIRST; i < pxEnumEnd; ++i)
|
||||
|
|
|
@ -297,7 +297,7 @@ void Panels::SpeedHacksPanel::AppStatusEvent_OnSettingsApplied()
|
|||
ApplyConfigToGui( *g_Conf );
|
||||
}
|
||||
|
||||
void Panels::SpeedHacksPanel::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate )
|
||||
void Panels::SpeedHacksPanel::ApplyConfigToGui( AppConfig& configToApply, int flags )
|
||||
{
|
||||
const bool enabled = configToApply.EnableSpeedHacks;
|
||||
Pcsx2Config::SpeedhackOptions& opts=configToApply.EmuOptions.Speedhacks;
|
||||
|
|
|
@ -116,13 +116,13 @@ void Panels::FramelimiterPanel::AppStatusEvent_OnSettingsApplied()
|
|||
ApplyConfigToGui( *g_Conf );
|
||||
}
|
||||
|
||||
void Panels::FramelimiterPanel::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate )
|
||||
void Panels::FramelimiterPanel::ApplyConfigToGui( AppConfig& configToApply, int flags )
|
||||
{
|
||||
const AppConfig::GSWindowOptions& appwin( configToApply.GSWindow );
|
||||
const AppConfig::FramerateOptions& appfps( configToApply.Framerate );
|
||||
const Pcsx2Config::GSOptions& gsconf( configToApply.EmuOptions.GS );
|
||||
|
||||
if( !manuallyPropagate ) //Presets don't control this: only change if config doesn't come from preset.
|
||||
if( ! (flags & AppConfig::APPLY_FLAG_FROM_PRESET) ) //Presets don't control this: only change if config doesn't come from preset.
|
||||
m_check_LimiterDisable->SetValue( !gsconf.FrameLimitEnable );
|
||||
|
||||
m_spin_NominalPct ->SetValue( appfps.NominalScalar.Raw );
|
||||
|
@ -252,7 +252,7 @@ void Panels::FrameSkipPanel::AppStatusEvent_OnSettingsApplied()
|
|||
ApplyConfigToGui( *g_Conf );
|
||||
}
|
||||
|
||||
void Panels::FrameSkipPanel::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate )
|
||||
void Panels::FrameSkipPanel::ApplyConfigToGui( AppConfig& configToApply, int flags )
|
||||
{
|
||||
const AppConfig::FramerateOptions& appfps( configToApply.Framerate );
|
||||
const Pcsx2Config::GSOptions& gsconf( configToApply.EmuOptions.GS );
|
||||
|
@ -373,7 +373,7 @@ void Panels::VideoPanel::AppStatusEvent_OnSettingsApplied()
|
|||
ApplyConfigToGui(*g_Conf);
|
||||
}
|
||||
|
||||
void Panels::VideoPanel::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate ){
|
||||
void Panels::VideoPanel::ApplyConfigToGui( AppConfig& configToApply, int flags ){
|
||||
|
||||
m_check_SynchronousGS->SetValue( configToApply.EmuOptions.GS.SynchronousMTGS );
|
||||
m_check_DisableOutput->SetValue( configToApply.EmuOptions.GS.DisableOutput );
|
||||
|
@ -381,7 +381,7 @@ void Panels::VideoPanel::ApplyConfigToGui( AppConfig& configToApply, bool manual
|
|||
m_check_SynchronousGS->Enable(!configToApply.EnablePresets);
|
||||
m_check_DisableOutput->Enable(!configToApply.EnablePresets);
|
||||
|
||||
if( manuallyPropagate )
|
||||
if( flags & AppConfig::APPLY_FLAG_MANUALLY_PROPAGATE )
|
||||
{
|
||||
m_span->ApplyConfigToGui( configToApply, true );
|
||||
m_fpan->ApplyConfigToGui( configToApply, true );
|
||||
|
|
Loading…
Reference in New Issue