diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index 7d5eb74def..da04a74ae0 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -729,6 +729,20 @@ int AppConfig::GeMaxPresetIndex() return 5; } +bool AppConfig::isOkGetPresetTextAndColor(int n, wxString& label, wxColor& c){ + switch(n){ + case 0: label=pxE("!Panel:", L"1 - Safest"); c=wxColor(L"Forest GREEN"); break; + case 1: label=pxE("!Panel:", L"2 - Safe (faster)"); c=wxColor(L"Dark Green"); break; + case 2: label=pxE("!Panel:", L"3 - Balanced"); c=wxColor(L"Blue");break; + case 3: label=pxE("!Panel:", L"4 - Aggressive"); c=wxColor(L"Purple"); break; + case 4: label=pxE("!Panel:", L"5 - Aggressive plus"); c=wxColor(L"Orange"); break; + case 5: label=pxE("!Panel:", L"6 - Mostly Harmful"); c=wxColor(L"Red");break; + default: return false; + } + return true; +} + + bool AppConfig::IsOkApplyPreset(int n) { if (n < 0 || n > GeMaxPresetIndex() ) @@ -757,6 +771,7 @@ bool AppConfig::IsOkApplyPreset(int n) //Also, as with the exclusions list, the gui needs to know what sections are affected by presets // such that it can disable them from manual tweaking when a preset is used. This includes most panels BTW. EnableSpeedHacks =false; + EmuOptions.Speedhacks.bitset=0; //Turn off individual hacks to make it visually clear they're not used EnableGameFixes =false; EmuOptions.EnablePatches =true; @@ -766,7 +781,7 @@ bool AppConfig::IsOkApplyPreset(int n) //Actual application of current preset. //The presets themselves probably need some voodoo tuning to be reasonably useful. - bool vuUsed=false, eeUsed=false, hacksUsed=false;//used to prevent application of specific lower preset values on fallthrough. + bool vuUsed=false, eeUsed=false;//used to prevent application of specific lower preset values on fallthrough. switch (n){ //currently implemented such that any preset also applies all lower presets, with few exceptions. case 5 : //Set VU cycle steal to 2 clicks (maximum-1) @@ -775,29 +790,29 @@ bool AppConfig::IsOkApplyPreset(int n) case 4 : //set EE cyclerate to 2 clicks (maximum) eeUsed?0:(eeUsed=true, EmuOptions.Speedhacks.EECycleRate = 2); - case 3 : //Set VU cycle steal to 1 click, enable (m)vuBlockHack, set clamp mode to 'none' for both EE/VU + case 3 : //Set VU cycle steal to 1 click, enable (m)vuBlockHack, set VU clamp mode to 'none' vuUsed?0:(vuUsed=true, EmuOptions.Speedhacks.VUCycleSteal = 1); EmuOptions.Speedhacks.vuBlockHack=true; - EmuOptions.Cpu.Recompiler.fpuOverflow= - EmuOptions.Cpu.Recompiler.fpuExtraOverflow= - EmuOptions.Cpu.Recompiler.fpuFullMode= - EmuOptions.Cpu.Recompiler.vuOverflow= - EmuOptions.Cpu.Recompiler.vuExtraOverflow= - EmuOptions.Cpu.Recompiler.vuSignOverflow=false; //Clamp mode to 'none' for both EE and VU + //EmuOptions.Cpu.Recompiler.fpuOverflow= + //EmuOptions.Cpu.Recompiler.fpuExtraOverflow= + //EmuOptions.Cpu.Recompiler.fpuFullMode= //EE clamp mode to 'None' : Better default for presets + EmuOptions.Cpu.Recompiler.vuOverflow= + EmuOptions.Cpu.Recompiler.vuExtraOverflow= + EmuOptions.Cpu.Recompiler.vuSignOverflow=false; //VU Clamp mode to 'none' //best balanced hacks combo? case 2 : //enable EE timing hack, set EE cyclerate to 1 click, enable mvu flag hack eeUsed?0:(eeUsed=true, EmuOptions.Speedhacks.EECycleRate = 1); - EnableGameFixes=true; - EmuOptions.Gamefixes.EETimingHack=true; - hacksUsed?0:(hacksUsed=true, EmuOptions.Speedhacks.vuFlagHack=true); + EnableGameFixes = true; + EmuOptions.Gamefixes.EETimingHack = true; + EmuOptions.Speedhacks.vuFlagHack = true; case 1 : //Apply recommended speed hacks (which are individually "ckecked" by default) without mvu flag hack. EnableSpeedHacks = true; - hacksUsed?0:(hacksUsed=true, EmuOptions.Speedhacks.vuFlagHack=false); + EmuOptions.Speedhacks.IntcStat = true; + EmuOptions.Speedhacks.WaitLoop = true; - case 0 : //default application config. + untick all individual speed hacks to make it visually clear none is used. - hacksUsed?0:(hacksUsed=true, EmuOptions.Speedhacks.bitset=0); + case 0 : //default application config. + all individual speed hacks unticked to make it visually clear none is used. break; diff --git a/pcsx2/gui/AppConfig.h b/pcsx2/gui/AppConfig.h index 405001523f..893a48bf2b 100644 --- a/pcsx2/gui/AppConfig.h +++ b/pcsx2/gui/AppConfig.h @@ -276,8 +276,9 @@ public: void LoadSaveRootItems( IniInterface& ini ); void LoadSaveMemcards( IniInterface& ini ); - static int GeMaxPresetIndex(); - bool IsOkApplyPreset(int n); + static int GeMaxPresetIndex(); + static bool isOkGetPresetTextAndColor(int n, wxString& label, wxColor& c); + bool IsOkApplyPreset(int n); }; diff --git a/pcsx2/gui/ApplyState.h b/pcsx2/gui/ApplyState.h index 6c44c4612e..e8925cd917 100644 --- a/pcsx2/gui/ApplyState.h +++ b/pcsx2/gui/ApplyState.h @@ -201,6 +201,22 @@ protected: virtual void OnSettingsApplied( wxCommandEvent& evt ); }; +class BaseApplicableConfigPanel_SpecificConfig : public BaseApplicableConfigPanel +{ + //This class only differs from BaseApplicableConfigPanel by systematically allowing the gui to be updated + //from a specific config (used by the presets system to trash not g_Conf in case the user pressed "Cancel"). + //Every panel that the Presets affect should be derived from this and not from BaseApplicableConfigPanel. + // + //Multiple inheritance would have been better (also for cases of non BaseApplicableConfigPanel which are effected by presets), + //but multiple inheritance sucks. So, subclass. + //NOTE: because ApplyConfigToGui is called manually and not via an event, it must consider manuallyPropagate and call sub panels. +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; +}; + class ApplicableWizardPage : public wxWizardPageSimple, public IApplyState { DECLARE_DYNAMIC_CLASS_NO_COPY(ApplicableWizardPage) diff --git a/pcsx2/gui/Dialogs/BaseConfigurationDialog.cpp b/pcsx2/gui/Dialogs/BaseConfigurationDialog.cpp index 8377d0d9b0..30263c0f1e 100644 --- a/pcsx2/gui/Dialogs/BaseConfigurationDialog.cpp +++ b/pcsx2/gui/Dialogs/BaseConfigurationDialog.cpp @@ -200,6 +200,7 @@ public: } // Use this to prevent the Apply buton from being re-enabled. + //avih: Does this work?? As far as I know Apply is always enabled... void DetachApply() { m_apply = NULL; @@ -222,6 +223,8 @@ void Dialogs::BaseConfigurationDialog::OnOk_Click( wxCommandEvent& evt ) { ScopedOkButtonDisabler disabler(this); + Apply(); + if( m_ApplyState.ApplyAll() ) { if( wxWindow* apply = FindWindow( wxID_APPLY ) ) apply->Disable(); @@ -236,7 +239,13 @@ void Dialogs::BaseConfigurationDialog::OnApply_Click( wxCommandEvent& evt ) { ScopedOkButtonDisabler disabler(this); - if( m_ApplyState.ApplyAll() ) + //if current instance also holds settings that need application. Apply it. + //Currently only used by SysConfigDialog, which applies the preset. + //Needs to come before actual panels Apply since they enable/disable themselves upon Preset state, + // so the preset needs to be applied first. + Apply(); + + if( m_ApplyState.ApplyAll() ) disabler.DetachApply(); if( m_listbook ) GetConfSettingsTabName() = m_labels[m_listbook->GetSelection()]; diff --git a/pcsx2/gui/Dialogs/ConfigurationDialog.h b/pcsx2/gui/Dialogs/ConfigurationDialog.h index 28fc217f9c..c20c11799e 100644 --- a/pcsx2/gui/Dialogs/ConfigurationDialog.h +++ b/pcsx2/gui/Dialogs/ConfigurationDialog.h @@ -72,6 +72,8 @@ namespace Dialogs void OnSomethingChanged( wxCommandEvent& evt ); virtual wxString& GetConfSettingsTabName() const=0; + + virtual void Apply() {}; }; // -------------------------------------------------------------------------------------- @@ -84,6 +86,7 @@ namespace Dialogs SysConfigDialog(wxWindow* parent=NULL); static wxString GetNameStatic() { return L"CoreSettings"; } wxString GetDialogName() const { return GetNameStatic(); } + void Apply(); protected: virtual wxString& GetConfSettingsTabName() const { return g_Conf->SysSettingsTabName; } @@ -94,7 +97,7 @@ namespace Dialogs void AddPresetsControl(); void Preset_Scroll(wxScrollEvent &event); void Presets_Toggled(wxCommandEvent &event); - + void UpdateGuiForPreset ( int presetIndex, bool presetsEnabled ); }; // -------------------------------------------------------------------------------------- diff --git a/pcsx2/gui/Dialogs/SysConfigDialog.cpp b/pcsx2/gui/Dialogs/SysConfigDialog.cpp index b00d18ebd1..65cde4deb7 100644 --- a/pcsx2/gui/Dialogs/SysConfigDialog.cpp +++ b/pcsx2/gui/Dialogs/SysConfigDialog.cpp @@ -65,19 +65,44 @@ static void CheckPluginsOverrides() pxIssueConfirmation( dialog, MsgButtons().OK(), L"Dialog.ComponentsConfig.Overrides" ); } -bool isOkGetPresetTextAndColor(int n, wxString& label, wxColor& c){ - switch(n){ - case 0: label=pxE("!Panel:", L"1 - Safest"); c=wxColor(L"Forest GREEN"); break; - case 1: label=pxE("!Panel:", L"2 - Safe (faster)"); c=wxColor(L"Dark Green"); break; - case 2: label=pxE("!Panel:", L"3 - Balanced"); c=wxColor(L"Blue");break; - case 3: label=pxE("!Panel:", L"4 - Aggressive"); c=wxColor(L"Purple"); break; - case 4: label=pxE("!Panel:", L"5 - Aggressive plus"); c=wxColor(L"Orange"); break; - case 5: label=pxE("!Panel:", L"6 - Mostly Harmful"); c=wxColor(L"Red");break; - default: return false; - } - return true; -} +//Current behavior when unchecking 'Presets' is to keep the GUI settings at the last preset (even if not applied). +// +//Alternative GUI behavior is that when 'Preset' is unchecked, +// the GUI settings return to the last applied settings. +// This allows the user to keep tweaking his "personal' settings and toggling 'Presets' for comparison, +// or start tweaking from a specific preset by clicking Apply before unchecking 'Presets' +// However, I think it's more confusing. Uncomment the next line to use the alternative behavior. +//#define PRESETS_USE_APPLIED_CONFIG_ON_UNCHECK +void Dialogs::SysConfigDialog::UpdateGuiForPreset ( int presetIndex, bool presetsEnabled ) +{ + AppConfig preset = *g_Conf; + preset.IsOkApplyPreset(presetIndex); + preset.EnablePresets=presetsEnabled;//override IsOkApplyPreset to actual required state + if( m_listbook ){ + //Console.WriteLn("Applying config to Gui: preset #%d, presets enabled: %s", presetIndex, presetsEnabled?"true":"false"); + size_t pages = m_labels.GetCount(); + for( size_t i=0; iEnablePresets; + if( !presetsEnabled ) + g_Conf->EnablePresets = false; // unly used when PRESETS_USE_APPLIED_CONFIG_WHEN_UNCHECKED is NOT defined + + ( + (BaseApplicableConfigPanel_SpecificConfig*)(m_listbook->GetPage(i)) + +#ifdef PRESETS_USE_APPLIED_CONFIG_ON_UNCHECK + )->ApplyConfigToGui( presetsEnabled?preset:*g_Conf, true ); + //Console.WriteLn("SysConfigDialog::UpdateGuiForPreset: Using object: %s", presetsEnabled?"preset":"*g_Conf"); +#else + )->ApplyConfigToGui( preset, true ); + //Console.WriteLn("SysConfigDialog::UpdateGuiForPreset: Using object: %s", "preset"); +#endif + g_Conf->EnablePresets = origPresetsEnabled; + } + + } + +} void Dialogs::SysConfigDialog::AddPresetsControl() { @@ -102,13 +127,20 @@ void Dialogs::SysConfigDialog::AddPresetsControl() pxE( "!Notice:Tooltip", L"The Presets apply speed hacks, some recompiler options and some game fixes known to boost speed.\n" L"Known important game fixes ('Patches') will be applied automatically.\n\n" +//This creates nested macros = not working. Un/comment manually if needed. +//#ifdef PRESETS_USE_APPLIED_CONFIG_ON_UNCHECK +// L"--> Uncheck to modify settings manually." +// L"If you want to manually modify with a preset as a base, apply this preset, then uncheck." +//#else L"--> Uncheck to modify settings manually (with current preset as base)" +//#endif ) ); - m_check_presets->SetValue(g_Conf->EnablePresets); + m_check_presets->SetValue(!!g_Conf->EnablePresets); + //Console.WriteLn("--> SysConfigDialog::AddPresetsControl: EnablePresets: %s", g_Conf->EnablePresets?"true":"false"); wxString l; wxColor c(wxColour( L"Red" )); - isOkGetPresetTextAndColor(g_Conf->PresetIndex, l, c); + AppConfig::isOkGetPresetTextAndColor(g_Conf->PresetIndex, l, c); m_msg_preset = new pxStaticText(this, l, wxALIGN_LEFT); m_msg_preset->Enable(g_Conf->EnablePresets); m_msg_preset->SetForegroundColour( c ); @@ -130,37 +162,38 @@ void Dialogs::SysConfigDialog::AddPresetsControl() Connect( m_check_presets->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( Dialogs::SysConfigDialog::Presets_Toggled ) ); } + + void Dialogs::SysConfigDialog::Presets_Toggled(wxCommandEvent &event) { - g_Conf->EnablePresets = m_check_presets->IsChecked(); - m_slider_presets->Enable(g_Conf->EnablePresets); - m_msg_preset->Enable(g_Conf->EnablePresets); + m_slider_presets->Enable( m_check_presets->IsChecked() ); + m_msg_preset->Enable( m_check_presets->IsChecked() ); + UpdateGuiForPreset( m_slider_presets->GetValue(), m_check_presets->IsChecked() ); - if (g_Conf->EnablePresets) - g_Conf->IsOkApplyPreset(g_Conf->PresetIndex); - - sApp.DispatchEvent( AppStatus_SettingsApplied ); - event.Skip(); + event.Skip(); } void Dialogs::SysConfigDialog::Preset_Scroll(wxScrollEvent &event) { - if (m_slider_presets->GetValue() == g_Conf->PresetIndex) - return; - wxString pl; wxColor c; - isOkGetPresetTextAndColor(m_slider_presets->GetValue(), pl, c); + AppConfig::isOkGetPresetTextAndColor(m_slider_presets->GetValue(), pl, c); m_msg_preset->SetLabel(pl); m_msg_preset->SetForegroundColour( c ); - g_Conf->IsOkApplyPreset(m_slider_presets->GetValue()); - - sApp.DispatchEvent( AppStatus_SettingsApplied ); + UpdateGuiForPreset( m_slider_presets->GetValue(), m_check_presets->IsChecked() ); event.Skip(); } +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"); + g_Conf->EnablePresets = m_check_presets->IsChecked(); + g_Conf->PresetIndex = m_slider_presets->GetValue(); +} + + Dialogs::SysConfigDialog::SysConfigDialog(wxWindow* parent) : BaseConfigurationDialog( parent, AddAppName(_("Emulation Settings - %s")), 580 ) { @@ -172,7 +205,7 @@ Dialogs::SysConfigDialog::SysConfigDialog(wxWindow* parent) AddPage ( pxL("EE/IOP"), cfgid.Cpu ); AddPage ( pxL("VUs"), cfgid.Cpu ); AddPage ( pxL("GS"), cfgid.Cpu ); - AddPage ( pxL("GS Window"), cfgid.Video ); + AddPage ( pxL("GS Window"), cfgid.Video ); AddPage ( pxL("Speedhacks"), cfgid.Speedhacks ); AddPage ( pxL("Game Fixes"), cfgid.Gamefixes ); diff --git a/pcsx2/gui/Panels/BaseApplicableConfigPanel.cpp b/pcsx2/gui/Panels/BaseApplicableConfigPanel.cpp index bdbd4aad1f..07ed2395f0 100644 --- a/pcsx2/gui/Panels/BaseApplicableConfigPanel.cpp +++ b/pcsx2/gui/Panels/BaseApplicableConfigPanel.cpp @@ -197,3 +197,14 @@ void BaseApplicableConfigPanel::OnSettingsApplied( wxCommandEvent& evt ) } void BaseApplicableConfigPanel::AppStatusEvent_OnSettingsApplied() {} + +BaseApplicableConfigPanel_SpecificConfig::BaseApplicableConfigPanel_SpecificConfig(wxWindow* parent, wxOrientation orient) +: BaseApplicableConfigPanel( parent, orient) +{ +} + +BaseApplicableConfigPanel_SpecificConfig::BaseApplicableConfigPanel_SpecificConfig(wxWindow* parent, wxOrientation orient, const wxString& staticLabel ) +: BaseApplicableConfigPanel( parent, orient, staticLabel) +{ +} + diff --git a/pcsx2/gui/Panels/ConfigurationPanels.h b/pcsx2/gui/Panels/ConfigurationPanels.h index 8bd9d28b56..f085fcc636 100644 --- a/pcsx2/gui/Panels/ConfigurationPanels.h +++ b/pcsx2/gui/Panels/ConfigurationPanels.h @@ -115,47 +115,15 @@ namespace Panels }; // -------------------------------------------------------------------------------------- - // CpuPanelEE / CpuPanelVU + // CpuPanelEE / CpuPanelVU : Sub Panels // -------------------------------------------------------------------------------------- - class CpuPanelEE : public BaseApplicableConfigPanel - { - protected: - pxRadioPanel* m_panel_RecEE; - pxRadioPanel* m_panel_RecIOP; - - public: - CpuPanelEE( wxWindow* parent ); - virtual ~CpuPanelEE() throw() {} - - void Apply(); - void AppStatusEvent_OnSettingsApplied(); - - protected: - void OnRestoreDefaults( wxCommandEvent& evt ); - }; - - class CpuPanelVU : public BaseApplicableConfigPanel - { - protected: - pxRadioPanel* m_panel_VU0; - pxRadioPanel* m_panel_VU1; - - public: - CpuPanelVU( wxWindow* parent ); - virtual ~CpuPanelVU() throw() {} - - void Apply(); - void AppStatusEvent_OnSettingsApplied(); - - protected: - void OnRestoreDefaults( wxCommandEvent& evt ); - }; // -------------------------------------------------------------------------------------- // BaseAdvancedCpuOptions // -------------------------------------------------------------------------------------- - class BaseAdvancedCpuOptions : public BaseApplicableConfigPanel + class BaseAdvancedCpuOptions : public BaseApplicableConfigPanel_SpecificConfig { + protected: pxRadioPanel* m_RoundModePanel; pxRadioPanel* m_ClampModePanel; @@ -184,6 +152,7 @@ namespace Panels virtual ~AdvancedOptionsFPU() throw() { } void Apply(); void AppStatusEvent_OnSettingsApplied(); + void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false ); }; class AdvancedOptionsVU : public BaseAdvancedCpuOptions @@ -193,12 +162,55 @@ namespace Panels virtual ~AdvancedOptionsVU() throw() { } void Apply(); void AppStatusEvent_OnSettingsApplied(); + void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false ); + + }; + + // -------------------------------------------------------------------------------------- + // CpuPanelEE / CpuPanelVU : Actual Panels + // -------------------------------------------------------------------------------------- + class CpuPanelEE : public BaseApplicableConfigPanel_SpecificConfig + { + protected: + pxRadioPanel* m_panel_RecEE; + pxRadioPanel* m_panel_RecIOP; + AdvancedOptionsFPU* m_advancedOptsFpu; + + public: + CpuPanelEE( wxWindow* parent ); + virtual ~CpuPanelEE() throw() {} + + void Apply(); + void AppStatusEvent_OnSettingsApplied(); + void ApplyConfigToGui(AppConfig& configToApply, bool manuallyPropagate=false); + + protected: + void OnRestoreDefaults( wxCommandEvent& evt ); + }; + + class CpuPanelVU : public BaseApplicableConfigPanel_SpecificConfig + { + protected: + pxRadioPanel* m_panel_VU0; + pxRadioPanel* m_panel_VU1; + Panels::AdvancedOptionsVU* m_advancedOptsVu; + + public: + CpuPanelVU( wxWindow* parent ); + virtual ~CpuPanelVU() throw() {} + + void Apply(); + void AppStatusEvent_OnSettingsApplied(); + void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false ); + + protected: + void OnRestoreDefaults( wxCommandEvent& evt ); }; // -------------------------------------------------------------------------------------- // FrameSkipPanel // -------------------------------------------------------------------------------------- - class FrameSkipPanel : public BaseApplicableConfigPanel + class FrameSkipPanel : public BaseApplicableConfigPanel_SpecificConfig { protected: wxSpinCtrl* m_spin_FramesToSkip; @@ -214,12 +226,13 @@ namespace Panels void Apply(); void AppStatusEvent_OnSettingsApplied(); + void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false ); }; // -------------------------------------------------------------------------------------- // FramelimiterPanel // -------------------------------------------------------------------------------------- - class FramelimiterPanel : public BaseApplicableConfigPanel + class FramelimiterPanel : public BaseApplicableConfigPanel_SpecificConfig { protected: pxCheckBox* m_check_LimiterDisable; @@ -240,12 +253,13 @@ namespace Panels void Apply(); void AppStatusEvent_OnSettingsApplied(); + void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false ); }; // -------------------------------------------------------------------------------------- // GSWindowSettingsPanel // -------------------------------------------------------------------------------------- - class GSWindowSettingsPanel : public BaseApplicableConfigPanel + class GSWindowSettingsPanel : public BaseApplicableConfigPanel_SpecificConfig { protected: wxComboBox* m_combo_AspectRatio; @@ -265,19 +279,23 @@ namespace Panels virtual ~GSWindowSettingsPanel() throw() {} void Apply(); void AppStatusEvent_OnSettingsApplied(); + void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false ); }; - class VideoPanel : public BaseApplicableConfigPanel + class VideoPanel : public BaseApplicableConfigPanel_SpecificConfig { protected: - pxCheckBox* m_check_SynchronousGS; - pxCheckBox* m_check_DisableOutput; + pxCheckBox* m_check_SynchronousGS; + pxCheckBox* m_check_DisableOutput; + FrameSkipPanel* m_span; + FramelimiterPanel* m_fpan; public: VideoPanel( wxWindow* parent ); virtual ~VideoPanel() throw() {} void Apply(); void AppStatusEvent_OnSettingsApplied(); + void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false ); protected: void OnOpenWindowSettings( wxCommandEvent& evt ); @@ -286,7 +304,7 @@ namespace Panels // -------------------------------------------------------------------------------------- // SpeedHacksPanel // -------------------------------------------------------------------------------------- - class SpeedHacksPanel : public BaseApplicableConfigPanel + class SpeedHacksPanel : public BaseApplicableConfigPanel_SpecificConfig { protected: wxFlexGridSizer* s_table; @@ -310,9 +328,9 @@ namespace Panels virtual ~SpeedHacksPanel() throw() {} SpeedHacksPanel( wxWindow* parent ); void Apply(); - void EnableStuff(); + void EnableStuff( AppConfig* configToUse=NULL ); void AppStatusEvent_OnSettingsApplied(); - void AppStatusEvent_OnSettingsApplied( const Pcsx2Config::SpeedhackOptions& opt ); + void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false ); protected: const wxChar* GetEEcycleSliderMsg( int val ); @@ -330,7 +348,7 @@ namespace Panels // -------------------------------------------------------------------------------------- // GameFixesPanel // -------------------------------------------------------------------------------------- - class GameFixesPanel : public BaseApplicableConfigPanel + class GameFixesPanel : public BaseApplicableConfigPanel_SpecificConfig { protected: pxCheckBox* m_checkbox[GamefixId_COUNT]; @@ -339,10 +357,11 @@ namespace Panels public: GameFixesPanel( wxWindow* parent ); virtual ~GameFixesPanel() throw() { } - void EnableStuff(); + void EnableStuff( AppConfig* configToUse=NULL ); void OnEnable_Toggled( wxCommandEvent& evt ); void Apply(); void AppStatusEvent_OnSettingsApplied(); + void ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate=false ); }; // -------------------------------------------------------------------------------------- diff --git a/pcsx2/gui/Panels/CpuPanel.cpp b/pcsx2/gui/Panels/CpuPanel.cpp index 811b6e2d1b..8fb8ab7f19 100644 --- a/pcsx2/gui/Panels/CpuPanel.cpp +++ b/pcsx2/gui/Panels/CpuPanel.cpp @@ -19,7 +19,7 @@ using namespace pxSizerFlags; Panels::BaseAdvancedCpuOptions::BaseAdvancedCpuOptions( wxWindow* parent ) - : BaseApplicableConfigPanel( parent ) + : BaseApplicableConfigPanel_SpecificConfig( parent ) { wxStaticBoxSizer* s_round( new wxStaticBoxSizer( wxVERTICAL, this, _("Round Mode") ) ); wxStaticBoxSizer* s_clamp( new wxStaticBoxSizer( wxVERTICAL, this, _("Clamping Mode") ) ); @@ -123,7 +123,7 @@ Panels::AdvancedOptionsVU::AdvancedOptionsVU( wxWindow* parent ) } Panels::CpuPanelEE::CpuPanelEE( wxWindow* parent ) - : BaseApplicableConfigPanel( parent ) + : BaseApplicableConfigPanel_SpecificConfig( parent ) { const RadioPanelItem tbl_CpuTypes_EE[] = { @@ -171,16 +171,16 @@ Panels::CpuPanelEE::CpuPanelEE( wxWindow* parent ) *this += &s_recs | StdExpand(); *this += new wxStaticLine( this ) | pxExpand.Border(wxALL, 18); - *this += new AdvancedOptionsFPU( this ) | StdExpand(); + *this += (m_advancedOptsFpu = new AdvancedOptionsFPU( this )) | StdExpand(); *this += 12; - *this += new wxButton( this, wxID_DEFAULT, _("Restore Defaults")) | StdButton(); + *this += new wxButton( this, wxID_DEFAULT, _("Restore Defaults")) | StdButton(); Connect( wxID_DEFAULT, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CpuPanelEE::OnRestoreDefaults ) ); } Panels::CpuPanelVU::CpuPanelVU( wxWindow* parent ) - : BaseApplicableConfigPanel( parent ) + : BaseApplicableConfigPanel_SpecificConfig( parent ) { const RadioPanelItem tbl_CpuTypes_VU[] = { @@ -220,7 +220,7 @@ Panels::CpuPanelVU::CpuPanelVU( wxWindow* parent ) *this += &s_recs | StdExpand(); *this += new wxStaticLine( this ) | pxExpand.Border(wxALL, 18); - *this += new AdvancedOptionsVU( this ) | StdExpand(); + *this += ( m_advancedOptsVu=new AdvancedOptionsVU( this )) | StdExpand(); *this += 12; *this += new wxButton( this, wxID_DEFAULT, _("Restore Defaults") ) | StdButton(); @@ -237,19 +237,28 @@ void Panels::CpuPanelEE::Apply() void Panels::CpuPanelEE::AppStatusEvent_OnSettingsApplied() { + ApplyConfigToGui( *g_Conf ); +} + +void Panels::CpuPanelEE::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate ){ m_panel_RecEE->Enable( x86caps.hasStreamingSIMD2Extensions ); // IOP rec should work fine on any CPU. :D //m_panel_RecIOP->Enable( x86caps.hasStreamingSIMD2Extensions ); - const Pcsx2Config::RecompilerOptions& recOps( g_Conf->EmuOptions.Cpu.Recompiler ); + const Pcsx2Config::RecompilerOptions& recOps( configToApply.EmuOptions.Cpu.Recompiler ); m_panel_RecEE->SetSelection( (int)recOps.EnableEE ); m_panel_RecIOP->SetSelection( (int)recOps.EnableIOP ); - m_panel_RecEE->Enable(!g_Conf->EnablePresets); - m_panel_RecIOP->Enable(!g_Conf->EnablePresets); + m_panel_RecEE->Enable(!configToApply.EnablePresets); + m_panel_RecIOP->Enable(!configToApply.EnablePresets); - this->Enable(!g_Conf->EnablePresets); + this->Enable(!configToApply.EnablePresets); + + if( manuallyPropagate ) + { + m_advancedOptsFpu->ApplyConfigToGui( configToApply, true ); + } } void Panels::CpuPanelEE::OnRestoreDefaults(wxCommandEvent &evt) @@ -275,6 +284,11 @@ void Panels::CpuPanelVU::Apply() } void Panels::CpuPanelVU::AppStatusEvent_OnSettingsApplied() +{ + ApplyConfigToGui( *g_Conf ); +} + +void Panels::CpuPanelVU::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate ) { m_panel_VU0->Enable( x86caps.hasStreamingSIMD2Extensions ); m_panel_VU1->Enable( x86caps.hasStreamingSIMD2Extensions ); @@ -285,7 +299,7 @@ void Panels::CpuPanelVU::AppStatusEvent_OnSettingsApplied() m_panel_VU1->EnableItem( 1, x86caps.hasStreamingSIMD2Extensions ); m_panel_VU1->EnableItem( 2, x86caps.hasStreamingSIMD2Extensions ); - Pcsx2Config::RecompilerOptions& recOps( g_Conf->EmuOptions.Cpu.Recompiler ); + Pcsx2Config::RecompilerOptions& recOps( configToApply.EmuOptions.Cpu.Recompiler ); if( recOps.UseMicroVU0 ) m_panel_VU0->SetSelection( recOps.EnableVU0 ? 1 : 0 ); else @@ -296,11 +310,17 @@ void Panels::CpuPanelVU::AppStatusEvent_OnSettingsApplied() else m_panel_VU1->SetSelection( recOps.EnableVU1 ? 2 : 0 ); - this->Enable(!g_Conf->EnablePresets); - m_panel_VU0->Enable(!g_Conf->EnablePresets); - m_panel_VU1->Enable(!g_Conf->EnablePresets); + this->Enable(!configToApply.EnablePresets); + m_panel_VU0->Enable(!configToApply.EnablePresets); + m_panel_VU1->Enable(!configToApply.EnablePresets); + + if ( manuallyPropagate ) + { + m_advancedOptsVu->ApplyConfigToGui( configToApply, true ); + } } + void Panels::CpuPanelVU::OnRestoreDefaults(wxCommandEvent &evt) { m_panel_VU0->SetSelection( m_panel_VU0->GetButton(1)->IsEnabled() ? 1 : 0 ); @@ -338,7 +358,12 @@ void Panels::AdvancedOptionsFPU::Apply() void Panels::AdvancedOptionsFPU::AppStatusEvent_OnSettingsApplied() { - const Pcsx2Config::CpuOptions& cpuOps( g_Conf->EmuOptions.Cpu ); + ApplyConfigToGui( *g_Conf ); +} + +void Panels::AdvancedOptionsFPU::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate ) +{ + const Pcsx2Config::CpuOptions& cpuOps( configToApply.EmuOptions.Cpu ); const Pcsx2Config::RecompilerOptions& recOps( cpuOps.Recompiler ); m_Option_FTZ->SetValue( cpuOps.sseMXCSR.FlushToZero ); @@ -351,7 +376,7 @@ void Panels::AdvancedOptionsFPU::AppStatusEvent_OnSettingsApplied() else if( recOps.fpuOverflow ) m_ClampModePanel->SetSelection( 1 ); else m_ClampModePanel->SetSelection( 0 ); - this->Enable(!g_Conf->EnablePresets); + this->Enable(!configToApply.EnablePresets); } void Panels::AdvancedOptionsVU::Apply() @@ -373,7 +398,12 @@ void Panels::AdvancedOptionsVU::Apply() void Panels::AdvancedOptionsVU::AppStatusEvent_OnSettingsApplied() { - const Pcsx2Config::CpuOptions& cpuOps( g_Conf->EmuOptions.Cpu ); + ApplyConfigToGui( *g_Conf ); +} + +void Panels::AdvancedOptionsVU::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate ) +{ + const Pcsx2Config::CpuOptions& cpuOps( configToApply.EmuOptions.Cpu ); const Pcsx2Config::RecompilerOptions& recOps( cpuOps.Recompiler ); m_Option_FTZ->SetValue( cpuOps.sseVUMXCSR.FlushToZero ); @@ -386,6 +416,5 @@ void Panels::AdvancedOptionsVU::AppStatusEvent_OnSettingsApplied() else if( recOps.vuOverflow ) m_ClampModePanel->SetSelection( 1 ); else m_ClampModePanel->SetSelection( 0 ); - this->Enable(!g_Conf->EnablePresets); + this->Enable(!configToApply.EnablePresets); } - diff --git a/pcsx2/gui/Panels/GSWindowPanel.cpp b/pcsx2/gui/Panels/GSWindowPanel.cpp index 3d3c3962ef..92a39971cc 100644 --- a/pcsx2/gui/Panels/GSWindowPanel.cpp +++ b/pcsx2/gui/Panels/GSWindowPanel.cpp @@ -23,7 +23,7 @@ using namespace pxSizerFlags; // -------------------------------------------------------------------------------------- Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent ) - : BaseApplicableConfigPanel( parent ) + : BaseApplicableConfigPanel_SpecificConfig( parent ) { const wxString aspect_ratio_labels[] = { @@ -110,7 +110,12 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent ) void Panels::GSWindowSettingsPanel::AppStatusEvent_OnSettingsApplied() { - const AppConfig::GSWindowOptions& conf( g_Conf->GSWindow ); + ApplyConfigToGui( *g_Conf ); +} + +void Panels::GSWindowSettingsPanel::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate ) +{ + const AppConfig::GSWindowOptions& conf( configToApply.GSWindow ); m_check_CloseGS ->SetValue( conf.CloseOnEsc ); m_check_Fullscreen ->SetValue( conf.DefaultToFullscreen ); @@ -119,12 +124,12 @@ void Panels::GSWindowSettingsPanel::AppStatusEvent_OnSettingsApplied() m_combo_AspectRatio ->SetSelection( (int)conf.AspectRatio ); - m_check_VsyncEnable ->SetValue( g_Conf->EmuOptions.GS.VsyncEnable ); + m_check_VsyncEnable ->SetValue( configToApply.EmuOptions.GS.VsyncEnable ); m_text_WindowWidth ->SetValue( wxsFormat( L"%d", conf.WindowSize.GetWidth() ) ); m_text_WindowHeight ->SetValue( wxsFormat( L"%d", conf.WindowSize.GetHeight() ) ); - m_check_VsyncEnable->Enable(!g_Conf->EnablePresets); + m_check_VsyncEnable->Enable(!configToApply.EnablePresets); } void Panels::GSWindowSettingsPanel::Apply() diff --git a/pcsx2/gui/Panels/GameFixesPanel.cpp b/pcsx2/gui/Panels/GameFixesPanel.cpp index ab5ef757bb..2625d954fd 100644 --- a/pcsx2/gui/Panels/GameFixesPanel.cpp +++ b/pcsx2/gui/Panels/GameFixesPanel.cpp @@ -20,7 +20,7 @@ using namespace pxSizerFlags; Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) - : BaseApplicableConfigPanel( parent ) + : BaseApplicableConfigPanel_SpecificConfig( parent ) { wxStaticBoxSizer& groupSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("Gamefixes") ); @@ -124,26 +124,35 @@ void Panels::GameFixesPanel::Apply() wxGetApp().Overrides.ApplyCustomGamefixes = false; } -void Panels::GameFixesPanel::EnableStuff() +void Panels::GameFixesPanel::EnableStuff( AppConfig* configToUse ) { + if( !configToUse ) configToUse = g_Conf; for (GamefixId i=GamefixId_FIRST; i < pxEnumEnd; ++i) - m_checkbox[i]->Enable(m_check_Enable->GetValue() && !g_Conf->EnablePresets); + m_checkbox[i]->Enable(m_check_Enable->GetValue() && !configToUse->EnablePresets); } void Panels::GameFixesPanel::OnEnable_Toggled( wxCommandEvent& evt ) { - EnableStuff(); + AppConfig tmp=*g_Conf; + tmp.EnablePresets=false; //if clicked, button was enabled, so not using a preset --> let EnableStuff work + + EnableStuff( &tmp ); evt.Skip(); } void Panels::GameFixesPanel::AppStatusEvent_OnSettingsApplied() { - const Pcsx2Config::GamefixOptions& opts( g_Conf->EmuOptions.Gamefixes ); + ApplyConfigToGui( *g_Conf ); +} + +void Panels::GameFixesPanel::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate ) +{ + const Pcsx2Config::GamefixOptions& opts( configToApply.EmuOptions.Gamefixes ); for (GamefixId i=GamefixId_FIRST; i < pxEnumEnd; ++i) m_checkbox[i]->SetValue( opts.Get((GamefixId)i) );//apply the use/don't-use fix values - m_check_Enable->SetValue( g_Conf->EnableGameFixes );//main gamefixes checkbox - EnableStuff();// enable/disable the all the fixes controls according to the main one + m_check_Enable->SetValue( configToApply.EnableGameFixes );//main gamefixes checkbox + EnableStuff( &configToApply );// enable/disable the all the fixes controls according to the main one - this->Enable(!g_Conf->EnablePresets); + this->Enable(!configToApply.EnablePresets); } diff --git a/pcsx2/gui/Panels/SpeedhacksPanel.cpp b/pcsx2/gui/Panels/SpeedhacksPanel.cpp index 321658c6f8..4388b67932 100644 --- a/pcsx2/gui/Panels/SpeedhacksPanel.cpp +++ b/pcsx2/gui/Panels/SpeedhacksPanel.cpp @@ -89,7 +89,7 @@ void Panels::SpeedHacksPanel::SetVUcycleSliderMsg() } Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent ) - : BaseApplicableConfigPanel( parent ) + : BaseApplicableConfigPanel_SpecificConfig( parent ) { const wxSizerFlags sliderFlags( wxSizerFlags().Border( wxLEFT | wxRIGHT, 8 ).Expand() ); @@ -274,8 +274,11 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent ) Connect( wxID_DEFAULT, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SpeedHacksPanel::Defaults_Click ) ); } -void Panels::SpeedHacksPanel::EnableStuff() +void Panels::SpeedHacksPanel::EnableStuff( AppConfig* configToUse ) { + //Console.WriteLn("SpeedHacksPanel::EnableStuff: Using %s", configToUse?"Object":"NULL"); + if( !configToUse ) configToUse = g_Conf; + //Console.WriteLn("SpeedHacksPanel::EnableStuff: EnabledPresets: %s", configToUse->EnablePresets?"true":"false"); wxSizerItemList& items( s_table->GetChildren() ); wxSizerItemList::iterator it = items.begin(); @@ -283,19 +286,21 @@ void Panels::SpeedHacksPanel::EnableStuff() while( it != end ) { - (*it)->GetWindow()->Enable( m_check_Enable->GetValue() && !g_Conf->EnablePresets); + (*it)->GetWindow()->Enable( m_check_Enable->GetValue() && !configToUse->EnablePresets); ++it; } } void Panels::SpeedHacksPanel::AppStatusEvent_OnSettingsApplied() { - AppStatusEvent_OnSettingsApplied( g_Conf->EmuOptions.Speedhacks ); + //Console.WriteLn("SpeedHacksPanel::AppStatusEvent_OnSettingsApplied()"); + ApplyConfigToGui( *g_Conf ); } -void Panels::SpeedHacksPanel::AppStatusEvent_OnSettingsApplied( const Pcsx2Config::SpeedhackOptions& opts ) +void Panels::SpeedHacksPanel::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate ) { - const bool enabled = g_Conf->EnableSpeedHacks; + const bool enabled = configToApply.EnableSpeedHacks; + Pcsx2Config::SpeedhackOptions& opts=configToApply.EmuOptions.Speedhacks; m_check_Enable ->SetValue( !!enabled ); @@ -312,13 +317,17 @@ void Panels::SpeedHacksPanel::AppStatusEvent_OnSettingsApplied( const Pcsx2Confi m_check_waitloop ->SetValue(opts.WaitLoop); m_check_fastCDVD ->SetValue(opts.fastCDVD); - EnableStuff(); + EnableStuff( &configToApply ); // Layout necessary to ensure changed slider text gets re-aligned properly Layout(); - this->Enable(!g_Conf->EnablePresets); + + //Console.WriteLn("SpeedHacksPanel::ApplyConfigToGui: EnabledPresets: %s", configToApply.EnablePresets?"true":"false"); + + this->Enable(!configToApply.EnablePresets); } + void Panels::SpeedHacksPanel::Apply() { g_Conf->EnableSpeedHacks = m_check_Enable->GetValue(); @@ -342,13 +351,18 @@ void Panels::SpeedHacksPanel::Apply() void Panels::SpeedHacksPanel::OnEnable_Toggled( wxCommandEvent& evt ) { - EnableStuff(); + AppConfig tmp=*g_Conf; + tmp.EnablePresets=false; //if clicked, button was enabled, so not using a preset --> let EnableStuff work + + EnableStuff( &tmp ); evt.Skip(); } void Panels::SpeedHacksPanel::Defaults_Click( wxCommandEvent& evt ) { - AppStatusEvent_OnSettingsApplied( Pcsx2Config::SpeedhackOptions() ); + AppConfig currentConfigWithHacksReset = *g_Conf; + currentConfigWithHacksReset.EmuOptions.Speedhacks = Pcsx2Config::SpeedhackOptions(); + ApplyConfigToGui( currentConfigWithHacksReset ); evt.Skip(); } diff --git a/pcsx2/gui/Panels/VideoPanel.cpp b/pcsx2/gui/Panels/VideoPanel.cpp index 4930b048c7..1bb7b08513 100644 --- a/pcsx2/gui/Panels/VideoPanel.cpp +++ b/pcsx2/gui/Panels/VideoPanel.cpp @@ -27,7 +27,7 @@ using namespace pxSizerFlags; // -------------------------------------------------------------------------------------- Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent ) - : BaseApplicableConfigPanel( parent ) + : BaseApplicableConfigPanel_SpecificConfig( parent ) { SetMinWidth( 280 ); @@ -113,9 +113,14 @@ Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent ) void Panels::FramelimiterPanel::AppStatusEvent_OnSettingsApplied() { - const AppConfig::GSWindowOptions& appwin( g_Conf->GSWindow ); - const AppConfig::FramerateOptions& appfps( g_Conf->Framerate ); - const Pcsx2Config::GSOptions& gsconf( g_Conf->EmuOptions.GS ); + ApplyConfigToGui( *g_Conf ); +} + +void Panels::FramelimiterPanel::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate ) +{ + const AppConfig::GSWindowOptions& appwin( configToApply.GSWindow ); + const AppConfig::FramerateOptions& appfps( configToApply.Framerate ); + const Pcsx2Config::GSOptions& gsconf( configToApply.EmuOptions.GS ); m_check_LimiterDisable->SetValue( !gsconf.FrameLimitEnable ); @@ -126,11 +131,11 @@ void Panels::FramelimiterPanel::AppStatusEvent_OnSettingsApplied() m_text_BaseNtsc ->SetValue( gsconf.FramerateNTSC.ToString() ); m_text_BasePal ->SetValue( gsconf.FrameratePAL.ToString() ); - m_spin_NominalPct->Enable(!g_Conf->EnablePresets); - m_spin_TurboPct->Enable(!g_Conf->EnablePresets); - m_spin_SlomoPct->Enable(!g_Conf->EnablePresets); - m_text_BaseNtsc->Enable(!g_Conf->EnablePresets); - m_text_BasePal->Enable(!g_Conf->EnablePresets); + m_spin_NominalPct ->Enable(!configToApply.EnablePresets); + m_spin_TurboPct ->Enable(!configToApply.EnablePresets); + m_spin_SlomoPct ->Enable(!configToApply.EnablePresets); + m_text_BaseNtsc ->Enable(!configToApply.EnablePresets); + m_text_BasePal ->Enable(!configToApply.EnablePresets); } void Panels::FramelimiterPanel::Apply() @@ -166,7 +171,7 @@ void Panels::FramelimiterPanel::Apply() // -------------------------------------------------------------------------------------- Panels::FrameSkipPanel::FrameSkipPanel( wxWindow* parent ) - : BaseApplicableConfigPanel( parent ) + : BaseApplicableConfigPanel_SpecificConfig( parent ) { SetMinWidth( 280 ); /*m_check_EnableSkipOnTurbo = new pxCheckBox( this, _("Use Frameskip for Turbo") ); @@ -243,8 +248,13 @@ Panels::FrameSkipPanel::FrameSkipPanel( wxWindow* parent ) void Panels::FrameSkipPanel::AppStatusEvent_OnSettingsApplied() { - const AppConfig::FramerateOptions& appfps( g_Conf->Framerate ); - const Pcsx2Config::GSOptions& gsconf( g_Conf->EmuOptions.GS ); + ApplyConfigToGui( *g_Conf ); +} + +void Panels::FrameSkipPanel::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate ) +{ + const AppConfig::FramerateOptions& appfps( configToApply.Framerate ); + const Pcsx2Config::GSOptions& gsconf( configToApply.EmuOptions.GS ); //m_check_EnableSkip ->SetValue( !appfps.SkipOnLimit ); //m_check_EnableSkipOnTurbo ->SetValue( !appfps.SkipOnTurbo ); @@ -254,9 +264,10 @@ void Panels::FrameSkipPanel::AppStatusEvent_OnSettingsApplied() m_spin_FramesToDraw ->SetValue( gsconf.FramesToDraw ); m_spin_FramesToSkip ->SetValue( gsconf.FramesToSkip ); - this->Enable(!g_Conf->EnablePresets); + this->Enable(!configToApply.EnablePresets); } + void Panels::FrameSkipPanel::Apply() { AppConfig::FramerateOptions& appfps( g_Conf->Framerate ); @@ -291,7 +302,7 @@ void Panels::FrameSkipPanel::Apply() // -------------------------------------------------------------------------------------- Panels::VideoPanel::VideoPanel( wxWindow* parent ) : - BaseApplicableConfigPanel( parent ) + BaseApplicableConfigPanel_SpecificConfig( parent ) { wxPanelWithHelpers* left = new wxPanelWithHelpers( this, wxVERTICAL ); wxPanelWithHelpers* right = new wxPanelWithHelpers( this, wxVERTICAL ); @@ -317,22 +328,22 @@ Panels::VideoPanel::VideoPanel( wxWindow* parent ) : //GSWindowSettingsPanel* winpan = new GSWindowSettingsPanel( left ); //winpan->AddFrame(_("Display/Window")); - FrameSkipPanel* span = new FrameSkipPanel( right ); - span->AddFrame(_("Frame Skipping")); + m_span = new FrameSkipPanel( right ); + m_span->AddFrame(_("Frame Skipping")); - FramelimiterPanel* fpan = new FramelimiterPanel( left ); - fpan->AddFrame(_("Framelimiter")); + m_fpan = new FramelimiterPanel( left ); + m_fpan->AddFrame(_("Framelimiter")); wxFlexGridSizer* s_table = new wxFlexGridSizer( 2 ); s_table->AddGrowableCol( 0, 1 ); s_table->AddGrowableCol( 1, 1 ); - *right += span | pxExpand; + *right += m_span | pxExpand; *right += 5; *right += m_check_SynchronousGS; *right += m_check_DisableOutput; - *left += fpan | pxExpand; + *left += m_fpan | pxExpand; *left += 5; *s_table += left | StdExpand(); @@ -358,9 +369,21 @@ void Panels::VideoPanel::Apply() void Panels::VideoPanel::AppStatusEvent_OnSettingsApplied() { - m_check_SynchronousGS->SetValue( g_Conf->EmuOptions.GS.SynchronousMTGS ); - m_check_DisableOutput->SetValue( g_Conf->EmuOptions.GS.DisableOutput ); - - m_check_SynchronousGS->Enable(!g_Conf->EnablePresets); - m_check_DisableOutput->Enable(!g_Conf->EnablePresets); + ApplyConfigToGui(*g_Conf); } + +void Panels::VideoPanel::ApplyConfigToGui( AppConfig& configToApply, bool manuallyPropagate ){ + + m_check_SynchronousGS->SetValue( configToApply.EmuOptions.GS.SynchronousMTGS ); + m_check_DisableOutput->SetValue( configToApply.EmuOptions.GS.DisableOutput ); + + m_check_SynchronousGS->Enable(!configToApply.EnablePresets); + m_check_DisableOutput->Enable(!configToApply.EnablePresets); + + if( manuallyPropagate ) + { + m_span->ApplyConfigToGui( configToApply, true ); + m_fpan->ApplyConfigToGui( configToApply, true ); + } +} +