diff --git a/common/include/PS2Edefs.h b/common/include/PS2Edefs.h index 8fa72bfb94..5d02a7016a 100644 --- a/common/include/PS2Edefs.h +++ b/common/include/PS2Edefs.h @@ -528,6 +528,7 @@ typedef void (CALLBACK* _GSsetGameCRC)(int, int); typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip); typedef void (CALLBACK* _GSsetFrameLimit)(int limit); typedef void (CALLBACK* _GSsetVsync)(int enabled); +typedef void (CALLBACK* _GSsetExclusive)(int isExclusive); typedef int (CALLBACK* _GSsetupRecording)(int, void*); typedef void (CALLBACK* _GSreset)(); typedef void (CALLBACK* _GSwriteCSR)(u32 value); diff --git a/pcsx2/PluginManager.cpp b/pcsx2/PluginManager.cpp index bad0f47b59..78e5ba979c 100644 --- a/pcsx2/PluginManager.cpp +++ b/pcsx2/PluginManager.cpp @@ -143,20 +143,21 @@ _GSmakeSnapshot GSmakeSnapshot; _GSmakeSnapshot2 GSmakeSnapshot2; _GSirqCallback GSirqCallback; _GSprintf GSprintf; -_GSsetBaseMem GSsetBaseMem; +_GSsetBaseMem GSsetBaseMem; _GSsetGameCRC GSsetGameCRC; -_GSsetFrameSkip GSsetFrameSkip; +_GSsetFrameSkip GSsetFrameSkip; _GSsetVsync GSsetVsync; +_GSsetExclusive GSsetExclusive; _GSsetupRecording GSsetupRecording; -_GSreset GSreset; -_GSwriteCSR GSwriteCSR; +_GSreset GSreset; +_GSwriteCSR GSwriteCSR; static void CALLBACK GS_makeSnapshot(const char *path) {} static void CALLBACK GS_setGameCRC(u32 crc, int gameopts) {} static void CALLBACK GS_irqCallback(void (*callback)()) {} static void CALLBACK GS_setFrameSkip(int frameskip) {} static void CALLBACK GS_setVsync(int enabled) {} -static void CALLBACK GS_setFullscreen(int enabled) {} +static void CALLBACK GS_setExclusive(int isExcl) {} static void CALLBACK GS_changeSaveState( int, const char* filename ) {} static void CALLBACK GS_printf(int timeout, char *fmt, ...) { @@ -287,6 +288,7 @@ static const LegacyApi_ReqMethod s_MethMessReq_GS[] = { "GSsetFrameSkip", (vMeth**)&GSsetFrameSkip, (vMeth*)GS_setFrameSkip }, { "GSsetVsync", (vMeth**)&GSsetVsync, (vMeth*)GS_setVsync }, + { "GSsetExclusive", (vMeth**)&GSsetExclusive, (vMeth*)GS_setExclusive }, { "GSchangeSaveState",(vMeth**)&GSchangeSaveState,(vMeth*)GS_changeSaveState }, { NULL } }; diff --git a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp index ef0b3fe7c4..22704c082b 100644 --- a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp +++ b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp @@ -123,7 +123,6 @@ FirstTimeWizard::FirstTimeWizard( wxWindow* parent ) Connect( wxEVT_WIZARD_PAGE_CHANGED, wxWizardEventHandler( FirstTimeWizard::OnPageChanged ) ); Connect( wxEVT_WIZARD_PAGE_CHANGING, wxWizardEventHandler( FirstTimeWizard::OnPageChanging ) ); - Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler(FirstTimeWizard::OnDoubleClicked) ); } diff --git a/pcsx2/gui/FrameForGS.cpp b/pcsx2/gui/FrameForGS.cpp index df2a97a22b..ad91449590 100644 --- a/pcsx2/gui/FrameForGS.cpp +++ b/pcsx2/gui/FrameForGS.cpp @@ -81,6 +81,11 @@ GSPanel::GSPanel( wxWindow* parent ) Connect(m_HideMouseTimer.GetId(), wxEVT_TIMER, wxTimerEventHandler(GSPanel::OnHideMouseTimeout) ); } +GSPanel::~GSPanel() throw() +{ + CoreThread.Suspend(); // Just in case...! +} + void GSPanel::DoShowMouse() { if( g_Conf->GSWindow.AlwaysHideMouse ) return; @@ -178,7 +183,8 @@ void __evt_fastcall GSPanel::OnSettingsApplied( void* obj, int& evt ) { if( obj == NULL ) return; GSPanel* panel = (GSPanel*)obj; - + + if( panel->IsBeingDeleted() ) return; panel->DoResize(); panel->DoShowMouse(); } @@ -208,7 +214,15 @@ GSFrame::GSFrame(wxWindow* parent, const wxString& title) GSFrame::~GSFrame() throw() { - CoreThread.Suspend(); // Just in case...! +} + +void __evt_fastcall GSFrame::OnSettingsApplied( void* obj, int& evt ) +{ + if( obj == NULL ) return; + GSFrame* frame = (GSFrame*)obj; + + if( frame->IsBeingDeleted() ) return; + ShowFullScreen( g_Conf->GSWindow.DefaultToFullscreen ); } wxWindow* GSFrame::GetViewport() @@ -225,20 +239,22 @@ void GSFrame::OnActivate( wxActivateEvent& evt ) void GSFrame::OnMove( wxMoveEvent& evt ) { // evt.GetPosition() returns the client area position, not the window frame position. - g_Conf->GSWindow.WindowPos = GetScreenPosition(); + if( !IsMaximized() && IsVisible() ) + g_Conf->GSWindow.WindowPos = GetScreenPosition(); // wxGTK note: X sends gratuitous amounts of OnMove messages for various crap actions // like selecting or deselecting a window, which muck up docking logic. We filter them // out using 'lastpos' here. :) - static wxPoint lastpos( wxDefaultCoord, wxDefaultCoord ); - if( lastpos == evt.GetPosition() ) return; - lastpos = evt.GetPosition(); + //static wxPoint lastpos( wxDefaultCoord, wxDefaultCoord ); + //if( lastpos == evt.GetPosition() ) return; + //lastpos = evt.GetPosition(); } void GSFrame::OnResize( wxSizeEvent& evt ) { - g_Conf->GSWindow.WindowSize = GetClientSize(); + if( !IsMaximized() && IsVisible() ) + g_Conf->GSWindow.WindowSize = GetClientSize(); if( GSPanel* gsPanel = (GSPanel*)FindWindowByName(L"GSPanel") ) { diff --git a/pcsx2/gui/GlobalCommands.cpp b/pcsx2/gui/GlobalCommands.cpp index b5b999be50..12149babea 100644 --- a/pcsx2/gui/GlobalCommands.cpp +++ b/pcsx2/gui/GlobalCommands.cpp @@ -217,12 +217,10 @@ namespace Implementations #endif } - static bool isFullscreen = false; - void FullscreenToggle() { - isFullscreen = !isFullscreen; - sGSFrame.ShowFullScreen( isFullscreen ); + g_Conf->GSWindow.DefaultToFullscreen = !g_Conf->GSWindow.DefaultToFullscreen; + sGSFrame.ShowFullScreen( g_Conf->GSWindow.DefaultToFullscreen ); } } diff --git a/pcsx2/gui/MainFrame.h b/pcsx2/gui/MainFrame.h index d22a7ffa44..fbf8a39093 100644 --- a/pcsx2/gui/MainFrame.h +++ b/pcsx2/gui/MainFrame.h @@ -34,7 +34,7 @@ protected: public: GSPanel( wxWindow* parent ); - virtual ~GSPanel() throw() { } + virtual ~GSPanel() throw(); void DoResize(); void DoShowMouse(); @@ -69,6 +69,8 @@ protected: void OnMove( wxMoveEvent& evt ); void OnResize( wxSizeEvent& evt ); void OnActivate( wxActivateEvent& evt ); + + void __evt_fastcall OnSettingsApplied( void* obj, int& evt ); }; struct PluginMenuAddition diff --git a/pcsx2/gui/Panels/BaseConfigPanel.h b/pcsx2/gui/Panels/BaseConfigPanel.h index 95669e22a8..fd0630a878 100644 --- a/pcsx2/gui/Panels/BaseConfigPanel.h +++ b/pcsx2/gui/Panels/BaseConfigPanel.h @@ -124,24 +124,13 @@ namespace Panels protected: int m_OwnerPage; wxBookCtrlBase* m_OwnerBook; + EventListenerBinding m_Listener_SettingsApplied; public: - virtual ~BaseApplicableConfigPanel() - { - g_ApplyState.PanelList.remove( this ); - } + virtual ~BaseApplicableConfigPanel() throw(); - BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient=wxVERTICAL ) - : wxPanelWithHelpers( parent, orient ) - { - Init(); - } - - BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient, const wxString& staticLabel ) - : wxPanelWithHelpers( parent, orient, staticLabel ) - { - Init(); - } + BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient=wxVERTICAL ); + BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient, const wxString& staticLabel ); int GetOwnerPage() const { return m_OwnerPage; } wxBookCtrlBase* GetOwnerBook() { return m_OwnerBook; } @@ -157,13 +146,15 @@ namespace Panels // of form contents fails, the function should throw Exception::CannotApplySettings. // If no exceptions are thrown, then the operation is assumed a success. :) virtual void Apply()=0; - + + // This method is bound to the ApplySettings event from the PCSX2 app manager. + // Note: This method *will* be called automatically after a successful Apply, but will not + // be called after a failed Apply (canceled due to error). + virtual void OnSettingsChanged()=0; + protected: - void Init() - { - m_OwnerPage = g_ApplyState.CurOwnerPage; - m_OwnerBook = g_ApplyState.ParentBook; - g_ApplyState.PanelList.push_back( this ); - } + static void __evt_fastcall OnSettingsApplied( void* obj, int& evt ); + + void Init(); }; } diff --git a/pcsx2/gui/Panels/BiosSelectorPanel.cpp b/pcsx2/gui/Panels/BiosSelectorPanel.cpp index 604725c702..b22e5c4e38 100644 --- a/pcsx2/gui/Panels/BiosSelectorPanel.cpp +++ b/pcsx2/gui/Panels/BiosSelectorPanel.cpp @@ -28,7 +28,6 @@ // ------------------------------------------------------------------------ Panels::BaseSelectorPanel::BaseSelectorPanel( wxWindow* parent ) : BaseApplicableConfigPanel( parent, wxVERTICAL ) - , m_ReloadSettingsBinding( wxGetApp().Source_SettingsApplied(), EventListener( this, OnAppliedSettings ) ) { Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler(PluginSelectorPanel::OnFolderChanged), NULL, this ); } @@ -63,12 +62,6 @@ void Panels::BaseSelectorPanel::OnFolderChanged( wxFileDirPickerEvent& evt ) OnShown(); } -void Panels::BaseSelectorPanel::OnAppliedSettings( void* me, int& ) -{ - if( me == NULL ) return; - ((BaseSelectorPanel*)me)->ReloadSettings(); -} - // ---------------------------------------------------------------------------- Panels::BiosSelectorPanel::BiosSelectorPanel( wxWindow* parent, int idealWidth ) : BaseSelectorPanel( parent ) @@ -114,11 +107,6 @@ bool Panels::BiosSelectorPanel::ValidateEnumerationStatus() return validated; } -void Panels::BiosSelectorPanel::ReloadSettings() -{ - m_FolderPicker.Reset(); -} - void Panels::BiosSelectorPanel::Apply() { int sel = m_ComboBox.GetSelection(); @@ -139,6 +127,10 @@ void Panels::BiosSelectorPanel::Apply() g_Conf->BaseFilenames.Bios = (*m_BiosList)[(int)m_ComboBox.GetClientData(sel)]; } +void Panels::BiosSelectorPanel::OnSettingsChanged() +{ +} + void Panels::BiosSelectorPanel::DoRefresh() { if( !m_BiosList ) return; diff --git a/pcsx2/gui/Panels/ConfigurationPanels.h b/pcsx2/gui/Panels/ConfigurationPanels.h index 124b8b0305..06bb9e8ecc 100644 --- a/pcsx2/gui/Panels/ConfigurationPanels.h +++ b/pcsx2/gui/Panels/ConfigurationPanels.h @@ -75,6 +75,7 @@ namespace Panels UsermodeSelectionPanel( wxWindow* parent, bool isFirstTime = true ); void Apply(); + void OnSettingsChanged(); }; ////////////////////////////////////////////////////////////////////////////////////////// @@ -90,6 +91,7 @@ namespace Panels LanguageSelectionPanel( wxWindow* parent ); void Apply(); + void OnSettingsChanged(); }; ////////////////////////////////////////////////////////////////////////////////////////// @@ -103,6 +105,7 @@ namespace Panels public: CpuPanelEE( wxWindow* parent ); void Apply(); + void OnSettingsChanged(); }; class CpuPanelVU : public BaseApplicableConfigPanel @@ -114,6 +117,7 @@ namespace Panels public: CpuPanelVU( wxWindow* parent ); void Apply(); + void OnSettingsChanged(); }; class BaseAdvancedCpuOptions : public BaseApplicableConfigPanel @@ -143,6 +147,7 @@ namespace Panels AdvancedOptionsFPU( wxWindow* parent ); virtual ~AdvancedOptionsFPU() throw() { } void Apply(); + void OnSettingsChanged(); }; class AdvancedOptionsVU : public BaseAdvancedCpuOptions @@ -151,6 +156,7 @@ namespace Panels AdvancedOptionsVU( wxWindow* parent ); virtual ~AdvancedOptionsVU() throw() { } void Apply(); + void OnSettingsChanged(); }; @@ -215,6 +221,7 @@ namespace Panels VideoPanel( wxWindow* parent ); virtual ~VideoPanel() throw() {} void Apply(); + void OnSettingsChanged(); }; ////////////////////////////////////////////////////////////////////////////////////////// @@ -268,6 +275,7 @@ namespace Panels public: GameFixesPanel( wxWindow* parent ); void Apply(); + void OnSettingsChanged(); }; ////////////////////////////////////////////////////////////////////////////////////////// @@ -287,6 +295,8 @@ namespace Panels virtual ~DirPickerPanel() { } void Apply(); + void OnSettingsChanged(); + void Reset(); wxDirName GetPath() const; @@ -331,9 +341,6 @@ namespace Panels // class BaseSelectorPanel: public BaseApplicableConfigPanel { - protected: - EventListenerBinding m_ReloadSettingsBinding; - public: virtual ~BaseSelectorPanel() throw(); BaseSelectorPanel( wxWindow* parent ); @@ -346,9 +353,6 @@ namespace Panels protected: virtual void DoRefresh()=0; virtual bool ValidateEnumerationStatus()=0; - virtual void ReloadSettings()=0; - - static void __evt_fastcall OnAppliedSettings( void* me, int& whatever ); }; ////////////////////////////////////////////////////////////////////////////////////////// @@ -366,10 +370,9 @@ namespace Panels protected: virtual void Apply(); + virtual void OnSettingsChanged(); virtual void DoRefresh(); virtual bool ValidateEnumerationStatus(); - - virtual void ReloadSettings(); }; ////////////////////////////////////////////////////////////////////////////////////////// @@ -391,11 +394,10 @@ namespace Panels wxString Name; // string to be pasted into the combo box wxString Version[NumPluginTypes]; - EnumeratedPluginInfo() : - PassedTest( 0 ) - , TypeMask( 0 ) - , Name() + EnumeratedPluginInfo() { + PassedTest = 0; + TypeMask = 0; } }; @@ -476,7 +478,7 @@ namespace Panels virtual void OnProgress( wxCommandEvent& evt ); virtual void OnEnumComplete( wxCommandEvent& evt ); - virtual void ReloadSettings(); + virtual void OnSettingsChanged(); virtual void DoRefresh(); virtual bool ValidateEnumerationStatus(); diff --git a/pcsx2/gui/Panels/CpuPanel.cpp b/pcsx2/gui/Panels/CpuPanel.cpp index 76b8e19f49..dcecdc4e29 100644 --- a/pcsx2/gui/Panels/CpuPanel.cpp +++ b/pcsx2/gui/Panels/CpuPanel.cpp @@ -106,20 +106,7 @@ Panels::AdvancedOptionsFPU::AdvancedOptionsFPU( wxWindow* parent ) m_RoundModePanel->Realize(); m_ClampModePanel->Realize(); - // ====== Assign Configured Values ====== - - Pcsx2Config::CpuOptions& cpuOps( g_Conf->EmuOptions.Cpu ); - Pcsx2Config::RecompilerOptions& recOps( cpuOps.Recompiler ); - - m_Option_FTZ->SetValue( cpuOps.sseMXCSR.FlushToZero ); - m_Option_DAZ->SetValue( cpuOps.sseMXCSR.DenormalsAreZero ); - - m_RoundModePanel->SetSelection( cpuOps.sseMXCSR.RoundingControl ); - - if( recOps.fpuFullMode ) m_ClampModePanel->SetSelection( 3 ); - else if( recOps.fpuExtraOverflow ) m_ClampModePanel->SetSelection( 2 ); - else if( recOps.fpuOverflow ) m_ClampModePanel->SetSelection( 1 ); - else m_ClampModePanel->SetSelection( 0 ); + OnSettingsChanged(); } @@ -134,20 +121,7 @@ Panels::AdvancedOptionsVU::AdvancedOptionsVU( wxWindow* parent ) m_RoundModePanel->Realize(); m_ClampModePanel->Realize(); - // ====== Assign Configured Values ====== - - Pcsx2Config::CpuOptions& cpuOps( g_Conf->EmuOptions.Cpu ); - Pcsx2Config::RecompilerOptions& recOps( cpuOps.Recompiler ); - - m_Option_FTZ->SetValue( cpuOps.sseVUMXCSR.FlushToZero ); - m_Option_DAZ->SetValue( cpuOps.sseVUMXCSR.DenormalsAreZero ); - - m_RoundModePanel->SetSelection( cpuOps.sseVUMXCSR.RoundingControl ); - - if( recOps.vuSignOverflow ) m_ClampModePanel->SetSelection( 3 ); - else if( recOps.vuExtraOverflow ) m_ClampModePanel->SetSelection( 2 ); - else if( recOps.vuOverflow ) m_ClampModePanel->SetSelection( 1 ); - else m_ClampModePanel->SetSelection( 0 ); + OnSettingsChanged(); } Panels::CpuPanelEE::CpuPanelEE( wxWindow* parent ) @@ -201,12 +175,7 @@ Panels::CpuPanelEE::CpuPanelEE( wxWindow* parent ) *this += new wxStaticLine( this ) | wxSF.Border(wxALL, 18).Expand(); *this += new AdvancedOptionsFPU( this ) | StdExpand(); - // ====== Apply Current Configuration ====== - - Pcsx2Config::RecompilerOptions& recOps( g_Conf->EmuOptions.Cpu.Recompiler ); - - m_panel_RecEE->SetSelection( (int)recOps.EnableEE ); - m_panel_RecIOP->SetSelection( (int)recOps.EnableIOP ); + OnSettingsChanged(); } Panels::CpuPanelVU::CpuPanelVU( wxWindow* parent ) @@ -252,18 +221,7 @@ Panels::CpuPanelVU::CpuPanelVU( wxWindow* parent ) *this += new wxStaticLine( this ) | wxSF.Border(wxALL, 18).Expand(); *this += new AdvancedOptionsVU( this ) | StdExpand(); - // ====== Apply Current Configuration ====== - - Pcsx2Config::RecompilerOptions& recOps( g_Conf->EmuOptions.Cpu.Recompiler ); - if( recOps.UseMicroVU0 ) - m_panel_VU0->SetSelection( recOps.EnableVU0 ? 1 : 0 ); - else - m_panel_VU0->SetSelection( recOps.EnableVU0 ? 2 : 0 ); - - if( recOps.UseMicroVU1 ) - m_panel_VU1->SetSelection( recOps.EnableVU1 ? 1 : 0 ); - else - m_panel_VU1->SetSelection( recOps.EnableVU1 ? 2 : 0 ); + OnSettingsChanged(); } void Panels::CpuPanelEE::Apply() @@ -273,6 +231,13 @@ void Panels::CpuPanelEE::Apply() recOps.EnableIOP = !!m_panel_RecIOP->GetSelection(); } +void Panels::CpuPanelEE::OnSettingsChanged() +{ + const Pcsx2Config::RecompilerOptions& recOps( g_Conf->EmuOptions.Cpu.Recompiler ); + m_panel_RecEE->SetSelection( (int)recOps.EnableEE ); + m_panel_RecIOP->SetSelection( (int)recOps.EnableIOP ); +} + void Panels::CpuPanelVU::Apply() { Pcsx2Config::RecompilerOptions& recOps( g_Conf->EmuOptions.Cpu.Recompiler ); @@ -283,6 +248,20 @@ void Panels::CpuPanelVU::Apply() recOps.UseMicroVU1 = m_panel_VU1->GetSelection() == 1; } +void Panels::CpuPanelVU::OnSettingsChanged() +{ + Pcsx2Config::RecompilerOptions& recOps( g_Conf->EmuOptions.Cpu.Recompiler ); + if( recOps.UseMicroVU0 ) + m_panel_VU0->SetSelection( recOps.EnableVU0 ? 1 : 0 ); + else + m_panel_VU0->SetSelection( recOps.EnableVU0 ? 2 : 0 ); + + if( recOps.UseMicroVU1 ) + m_panel_VU1->SetSelection( recOps.EnableVU1 ? 1 : 0 ); + else + m_panel_VU1->SetSelection( recOps.EnableVU1 ? 2 : 0 ); +} + void Panels::BaseAdvancedCpuOptions::ApplyRoundmode( SSE_MXCSR& mxcsr ) { mxcsr.RoundingControl = m_RoundModePanel->GetSelection(); @@ -307,6 +286,22 @@ void Panels::AdvancedOptionsFPU::Apply() cpuOps.ApplySanityCheck(); } +void Panels::AdvancedOptionsFPU::OnSettingsChanged() +{ + const Pcsx2Config::CpuOptions& cpuOps( g_Conf->EmuOptions.Cpu ); + const Pcsx2Config::RecompilerOptions& recOps( cpuOps.Recompiler ); + + m_Option_FTZ->SetValue( cpuOps.sseMXCSR.FlushToZero ); + m_Option_DAZ->SetValue( cpuOps.sseMXCSR.DenormalsAreZero ); + + m_RoundModePanel->SetSelection( cpuOps.sseMXCSR.RoundingControl ); + + if( recOps.fpuFullMode ) m_ClampModePanel->SetSelection( 3 ); + else if( recOps.fpuExtraOverflow ) m_ClampModePanel->SetSelection( 2 ); + else if( recOps.fpuOverflow ) m_ClampModePanel->SetSelection( 1 ); + else m_ClampModePanel->SetSelection( 0 ); +} + void Panels::AdvancedOptionsVU::Apply() { Pcsx2Config::CpuOptions& cpuOps( g_Conf->EmuOptions.Cpu ); @@ -323,3 +318,20 @@ void Panels::AdvancedOptionsVU::Apply() cpuOps.ApplySanityCheck(); } + +void Panels::AdvancedOptionsVU::OnSettingsChanged() +{ + const Pcsx2Config::CpuOptions& cpuOps( g_Conf->EmuOptions.Cpu ); + const Pcsx2Config::RecompilerOptions& recOps( cpuOps.Recompiler ); + + m_Option_FTZ->SetValue( cpuOps.sseVUMXCSR.FlushToZero ); + m_Option_DAZ->SetValue( cpuOps.sseVUMXCSR.DenormalsAreZero ); + + m_RoundModePanel->SetSelection( cpuOps.sseVUMXCSR.RoundingControl ); + + if( recOps.vuSignOverflow ) m_ClampModePanel->SetSelection( 3 ); + else if( recOps.vuExtraOverflow ) m_ClampModePanel->SetSelection( 2 ); + else if( recOps.vuOverflow ) m_ClampModePanel->SetSelection( 1 ); + else m_ClampModePanel->SetSelection( 0 ); +} + diff --git a/pcsx2/gui/Panels/DirPickerPanel.cpp b/pcsx2/gui/Panels/DirPickerPanel.cpp index 100e7f7793..2956dd5259 100644 --- a/pcsx2/gui/Panels/DirPickerPanel.cpp +++ b/pcsx2/gui/Panels/DirPickerPanel.cpp @@ -110,7 +110,7 @@ Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid // wx warns when paths don't exist, but this is typically normal when the wizard // creates its child controls. So let's ignore them. wxDoNotLogInThisScope please; - Reset(); // forces default settings based on g_Conf + OnSettingsChanged(); // forces default settings based on g_Conf } Panels::DirPickerPanel& Panels::DirPickerPanel::SetStaticDesc( const wxString& msg ) @@ -133,6 +133,11 @@ void Panels::DirPickerPanel::Reset() m_pickerCtrl->SetPath( GetNormalizedConfigFolder( m_FolderId ) ); } +void Panels::DirPickerPanel::OnSettingsChanged() +{ + Reset(); +} + void Panels::DirPickerPanel::Apply() { g_Conf->Folders.Set( m_FolderId, m_pickerCtrl->GetPath(), m_checkCtrl->GetValue() ); diff --git a/pcsx2/gui/Panels/GameFixesPanel.cpp b/pcsx2/gui/Panels/GameFixesPanel.cpp index 51d0fdaf86..e14c4694ce 100644 --- a/pcsx2/gui/Panels/GameFixesPanel.cpp +++ b/pcsx2/gui/Panels/GameFixesPanel.cpp @@ -63,12 +63,10 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) : } }; - const Pcsx2Config::GamefixOptions& opts( g_Conf->EmuOptions.Gamefixes ); for( int i=0; iSetToolTip( check_text[i].tooltip ); - m_checkbox[i]->SetValue( !!(opts.bitset & (1 << i)) ); } *this += groupSizer | wxSF.Centre(); @@ -78,6 +76,7 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) : L"will need to turn off fixes manually when changing games." )); + OnSettingsChanged(); } // I could still probably get rid of the for loop, but I think this is clearer. @@ -92,3 +91,10 @@ void Panels::GameFixesPanel::Apply() opts.bitset &= ~(1 << i); } } + +void Panels::GameFixesPanel::OnSettingsChanged() +{ + const Pcsx2Config::GamefixOptions& opts( g_Conf->EmuOptions.Gamefixes ); + for( int i=0; iSetValue( !!(opts.bitset & (1 << i)) ); +} diff --git a/pcsx2/gui/Panels/MiscPanelStuff.cpp b/pcsx2/gui/Panels/MiscPanelStuff.cpp index 7332f5eb93..aaabc6c846 100644 --- a/pcsx2/gui/Panels/MiscPanelStuff.cpp +++ b/pcsx2/gui/Panels/MiscPanelStuff.cpp @@ -125,12 +125,47 @@ bool Panels::StaticApplyState::ApplyAll() return ApplyPage( -1 ); } +// -------------------------------------------------------------------------------------- +// BaseApplicableConfigPanel Implementations +// -------------------------------------------------------------------------------------- +Panels::BaseApplicableConfigPanel::~BaseApplicableConfigPanel() throw() +{ + g_ApplyState.PanelList.remove( this ); +} + +Panels::BaseApplicableConfigPanel::BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient ) + : wxPanelWithHelpers( parent, orient ) + , m_Listener_SettingsApplied( wxGetApp().Source_SettingsApplied(), EventListener( this, OnSettingsApplied ) ) +{ + Init(); +} + +Panels::BaseApplicableConfigPanel::BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient, const wxString& staticLabel ) + : wxPanelWithHelpers( parent, orient, staticLabel ) + , m_Listener_SettingsApplied( wxGetApp().Source_SettingsApplied(), EventListener( this, OnSettingsApplied ) ) +{ + Init(); +} + void Panels::BaseApplicableConfigPanel::SetFocusToMe() { if( (m_OwnerBook == NULL) || (m_OwnerPage == wxID_NONE) ) return; m_OwnerBook->SetSelection( m_OwnerPage ); } +void Panels::BaseApplicableConfigPanel::Init() +{ + m_OwnerPage = g_ApplyState.CurOwnerPage; + m_OwnerBook = g_ApplyState.ParentBook; + g_ApplyState.PanelList.push_back( this ); +} + +void __evt_fastcall Panels::BaseApplicableConfigPanel::OnSettingsApplied( void* obj, int& ini ) +{ + if( obj == NULL ) return; + ((BaseApplicableConfigPanel*)obj)->OnSettingsChanged(); +} + // ----------------------------------------------------------------------- Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow* parent, bool isFirstTime ) @@ -169,6 +204,8 @@ Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow* parent, bool i *this += Text( (isFirstTime ? usermodeExplained : usermodeWarning) ); *this += m_radio_UserMode | pxSizerFlags::StdExpand(); *this += 4; + + OnSettingsChanged(); } void Panels::UsermodeSelectionPanel::Apply() @@ -176,6 +213,11 @@ void Panels::UsermodeSelectionPanel::Apply() UseAdminMode = (m_radio_UserMode->GetSelection() == 1); } +void Panels::UsermodeSelectionPanel::OnSettingsChanged() +{ + m_radio_UserMode->SetSelection( (int)UseAdminMode ); +} + // ----------------------------------------------------------------------- Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent ) : BaseApplicableConfigPanel( parent, wxHORIZONTAL ) @@ -198,11 +240,13 @@ Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent ) m_picker = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, size, compiled.GetPtr(), wxCB_READONLY | wxCB_SORT ); - m_picker->SetSelection( cursel ); *this += Text(_("Select a language: ")) | pxMiddle; *this += 5; *this += m_picker | pxSizerFlags::StdSpace(); + + m_picker->SetSelection( cursel ); + //OnSettingsChanged(); } void Panels::LanguageSelectionPanel::Apply() @@ -223,3 +267,8 @@ void Panels::LanguageSelectionPanel::Apply() } } } + +void Panels::LanguageSelectionPanel::OnSettingsChanged() +{ + m_picker->SetSelection( g_Conf->LanguageId ); +} diff --git a/pcsx2/gui/Panels/PluginSelectorPanel.cpp b/pcsx2/gui/Panels/PluginSelectorPanel.cpp index c4afcb3a67..0e2a541f16 100644 --- a/pcsx2/gui/Panels/PluginSelectorPanel.cpp +++ b/pcsx2/gui/Panels/PluginSelectorPanel.cpp @@ -247,6 +247,8 @@ Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow* parent, int idealWid Connect( pxEVT_EnumerationFinished, wxCommandEventHandler( PluginSelectorPanel::OnEnumComplete ) ); Connect( pxEVT_ShowStatusBar, wxCommandEventHandler( PluginSelectorPanel::OnShowStatusBar ) ); Connect( ButtonId_Configure, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PluginSelectorPanel::OnConfigure_Clicked ) ); + + OnSettingsChanged(); } Panels::PluginSelectorPanel::~PluginSelectorPanel() throw() @@ -254,7 +256,7 @@ Panels::PluginSelectorPanel::~PluginSelectorPanel() throw() CancelRefresh(); // in case the enumeration thread is currently refreshing... } -void Panels::PluginSelectorPanel::ReloadSettings() +void Panels::PluginSelectorPanel::OnSettingsChanged() { m_ComponentBoxes->GetDirPicker().Reset(); } diff --git a/pcsx2/gui/Panels/VideoPanel.cpp b/pcsx2/gui/Panels/VideoPanel.cpp index d769ea04f7..2c0adc161c 100644 --- a/pcsx2/gui/Panels/VideoPanel.cpp +++ b/pcsx2/gui/Panels/VideoPanel.cpp @@ -135,13 +135,6 @@ Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent ) *this += s_spins | pxExpand; *this += s_fps | pxExpand; - m_spin_NominalPct ->SetValue( 100 ); - m_spin_SlomoPct ->SetValue( 50 ); - m_spin_TurboPct ->SetValue( 100 ); - - m_text_BaseNtsc ->SetValue( L"59.94" ); - m_text_BasePal ->SetValue( L"50.00" ); - OnSettingsChanged(); } @@ -260,7 +253,7 @@ Panels::VideoPanel::VideoPanel( wxWindow* parent ) : *this += s_table | pxExpand; - m_check_SynchronousGS->SetValue( g_Conf->EmuOptions.GS.SynchronousMTGS ); + OnSettingsChanged(); } void Panels::VideoPanel::Apply() @@ -268,6 +261,11 @@ void Panels::VideoPanel::Apply() g_Conf->EmuOptions.GS.SynchronousMTGS = m_check_SynchronousGS->GetValue(); } +void Panels::VideoPanel::OnSettingsChanged() +{ + m_check_SynchronousGS->SetValue( g_Conf->EmuOptions.GS.SynchronousMTGS ); +} + void Panels::GSWindowSettingsPanel::OnSettingsChanged() { const AppConfig::GSWindowOptions& conf( g_Conf->GSWindow );