diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp index bf7441482d..3f57eab7e6 100644 --- a/pcsx2/Pcsx2Config.cpp +++ b/pcsx2/Pcsx2Config.cpp @@ -394,9 +394,8 @@ void Pcsx2Config::Load( const wxString& srcfile ) { //m_IsLoaded = true; - // Note: Extra parenthesis resolves "I think this is a function" issues with C++. wxFileConfig cfg( srcfile ); - IniLoader loader( (IniLoader( cfg )) ); + IniLoader loader( cfg ); LoadSave( loader ); } @@ -405,6 +404,6 @@ void Pcsx2Config::Save( const wxString& dstfile ) //if( !m_IsLoaded ) return; wxFileConfig cfg( dstfile ); - IniSaver saver( (IniSaver( cfg )) ); + IniSaver saver( cfg ); LoadSave( saver ); } diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index 246c980171..5b5884afdf 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -458,7 +458,8 @@ public: void DispatchEvent( PluginEventType evt ); void DispatchEvent( AppEventType evt ); void DispatchEvent( CoreThreadStatus evt ); - void DispatchEvent( IniInterface& ini ); + void DispatchUiSettingsEvent( IniInterface& ini ); + void DispatchVmSettingsEvent( IniInterface& ini ); // ---------------------------------------------------------------------------- protected: diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index 258ee520f2..55d21931a7 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -285,18 +285,12 @@ namespace FilenameDefs { wxFileName GetUiConfig() { - // FIXME? ini extension on Win32 is normal. Linux ini filename default might differ - // from this? like pcsx2_conf or something ... ? --air - - return pxGetAppName() + L".ini"; + return pxGetAppName() + L"_ui.ini"; } wxFileName GetVmConfig() { - // FIXME? ini extension on Win32 is normal. Linux ini filename default might differ - // from this? like pcsx2_conf or something ... ? --air - - return pxGetAppName() + L".ini"; + return pxGetAppName() + L"_vm.ini"; } wxFileName GetUsermodeConfig() @@ -437,6 +431,18 @@ void App_LoadSaveInstallSettings( IniInterface& ini ) ini.Flush(); } +void App_LoadInstallSettings( wxConfigBase* ini ) +{ + IniLoader loader( ini ); + App_LoadSaveInstallSettings( loader ); +} + +void App_SaveInstallSettings( wxConfigBase* ini ) +{ + IniSaver saver( ini ); + App_LoadSaveInstallSettings( saver ); +} + // ------------------------------------------------------------------------ void AppConfig::LoadSaveMemcards( IniInterface& ini ) { @@ -962,11 +968,8 @@ AppIniLoader::AppIniLoader() { } - -void AppLoadSettings() +static void LoadUiSettings() { - if( wxGetApp().Rpc_TryInvoke(AppLoadSettings) ) return; - AppIniLoader loader; ConLog_LoadSaveSettings( loader ); SysTraceLog_LoadSaveSettings( loader ); @@ -977,21 +980,56 @@ void AppLoadSettings() if( !wxFile::Exists( g_Conf->CurrentIso ) ) g_Conf->CurrentIso.clear(); + sApp.DispatchUiSettingsEvent( loader ); +} + +static void LoadVmSettings() +{ // Load virtual machine options and apply some defaults overtop saved items, which // are regulated by the PCSX2 UI. - { - ScopedPtr vmini( OpenFileConfig( GetVmSettingsFilename() ) ); - IniLoader vmloader( vmini ); - g_Conf->EmuOptions.LoadSave( vmloader ); - g_Conf->EmuOptions.GS.LimitScalar = g_Conf->Framerate.NominalScalar; + ScopedPtr vmini( OpenFileConfig( GetVmSettingsFilename() ) ); + IniLoader vmloader( vmini ); + g_Conf->EmuOptions.LoadSave( vmloader ); + g_Conf->EmuOptions.GS.LimitScalar = g_Conf->Framerate.NominalScalar; - if (g_Conf->EnablePresets){ - g_Conf->IsOkApplyPreset(g_Conf->PresetIndex); - } + if (g_Conf->EnablePresets){ + g_Conf->IsOkApplyPreset(g_Conf->PresetIndex); } - sApp.DispatchEvent( loader ); + sApp.DispatchVmSettingsEvent( vmloader ); +} + +void AppLoadSettings() +{ + if( wxGetApp().Rpc_TryInvoke(AppLoadSettings) ) return; + + LoadUiSettings(); + LoadVmSettings(); +} + +static void SaveUiSettings() +{ + if( !wxFile::Exists( g_Conf->CurrentIso ) ) + g_Conf->CurrentIso.clear(); + + sApp.GetRecentIsoManager().Add( g_Conf->CurrentIso ); + + AppIniSaver saver; + g_Conf->LoadSave( saver ); + ConLog_LoadSaveSettings( saver ); + SysTraceLog_LoadSaveSettings( saver ); + + sApp.DispatchUiSettingsEvent( saver ); +} + +static void SaveVmSettings() +{ + ScopedPtr vmini( OpenFileConfig( GetVmSettingsFilename() ) ); + IniSaver vmsaver( vmini ); + g_Conf->EmuOptions.LoadSave( vmsaver ); + + sApp.DispatchVmSettingsEvent( vmsaver ); } void AppSaveSettings() @@ -1009,29 +1047,13 @@ void AppSaveSettings() return; } - if( !wxFile::Exists( g_Conf->CurrentIso ) ) - g_Conf->CurrentIso.clear(); - - sApp.GetRecentIsoManager().Add( g_Conf->CurrentIso ); + SaveUiSettings(); + SaveVmSettings(); AtomicExchange( isPosted, false ); - - AppIniSaver saver; - g_Conf->LoadSave( saver ); - ConLog_LoadSaveSettings( saver ); - SysTraceLog_LoadSaveSettings( saver ); - - // Save virtual machine items. - - { - ScopedPtr vmini( OpenFileConfig( GetVmSettingsFilename() ) ); - IniSaver vmsaver( vmini ); - g_Conf->EmuOptions.LoadSave( vmsaver ); - } - - sApp.DispatchEvent( saver ); } + // Returns the current application configuration file. This is preferred over using // wxConfigBase::GetAppConfig(), since it defaults to *not* creating a config file // automatically (which is typically highly undesired behavior in our system) diff --git a/pcsx2/gui/AppConfig.h b/pcsx2/gui/AppConfig.h index 49a7798c65..8a606179b7 100644 --- a/pcsx2/gui/AppConfig.h +++ b/pcsx2/gui/AppConfig.h @@ -298,6 +298,8 @@ extern void AppSaveSettings(); extern void AppApplySettings( const AppConfig* oldconf=NULL ); extern void App_LoadSaveInstallSettings( IniInterface& ini ); +extern void App_SaveInstallSettings( wxConfigBase* ini ); +extern void App_LoadInstallSettings( wxConfigBase* ini ); extern void ConLog_LoadSaveSettings( IniInterface& ini ); extern void SysTraceLog_LoadSaveSettings( IniInterface& ini ); diff --git a/pcsx2/gui/AppEventListeners.h b/pcsx2/gui/AppEventListeners.h index 4a54621a43..4d492df907 100644 --- a/pcsx2/gui/AppEventListeners.h +++ b/pcsx2/gui/AppEventListeners.h @@ -30,8 +30,11 @@ enum CoreThreadStatus enum AppEventType { - AppStatus_SettingsLoaded, - AppStatus_SettingsSaved, + AppStatus_UiSettingsLoaded, + AppStatus_UiSettingsSaved, + AppStatus_VmSettingsLoaded, + AppStatus_VmSettingsSaved, + AppStatus_SettingsApplied, AppStatus_Exiting }; @@ -41,9 +44,9 @@ enum PluginEventType CorePlugins_Loaded, CorePlugins_Init, CorePlugins_Opening, // dispatched prior to plugins being opened - CorePlugins_Opened, // dispatched after plugins are opened + CorePlugins_Opened, // dispatched after plugins are opened CorePlugins_Closing, // dispatched prior to plugins being closed - CorePlugins_Closed, // dispatched after plugins are closed + CorePlugins_Closed, // dispatched after plugins are closed CorePlugins_Shutdown, CorePlugins_Unloaded, }; @@ -62,7 +65,7 @@ struct AppSettingsEventInfo : AppEventInfo { IniInterface& m_ini; - AppSettingsEventInfo( IniInterface& ini ); + AppSettingsEventInfo( IniInterface& ini, AppEventType evt_type ); IniInterface& GetIni() const { @@ -143,7 +146,9 @@ public: virtual void DispatchEvent( const AppEventInfo& evtinfo ); protected: - virtual void AppStatusEvent_OnSettingsLoadSave( const AppSettingsEventInfo& evtinfo ) {} + virtual void AppStatusEvent_OnUiSettingsLoadSave( const AppSettingsEventInfo& evtinfo ) {} + virtual void AppStatusEvent_OnVmSettingsLoadSave( const AppSettingsEventInfo& evtinfo ) {} + virtual void AppStatusEvent_OnSettingsApplied() {} virtual void AppStatusEvent_OnExit() {} }; @@ -189,7 +194,7 @@ public: virtual ~EventListenerHelper_CoreThread() throw() {} protected: - void OnCoreThread_Indeterminate() { Owner.OnCoreThread_Indeterminate(); } + void CoreThread_OnIndeterminate() { Owner.OnCoreThread_Indeterminate(); } void CoreThread_OnStarted() { Owner.OnCoreThread_Started(); } void CoreThread_OnResumed() { Owner.OnCoreThread_Resumed(); } void CoreThread_OnSuspended() { Owner.OnCoreThread_Suspended(); } @@ -245,7 +250,8 @@ public: virtual ~EventListenerHelper_AppStatus() throw() {} protected: - virtual void AppStatusEvent_OnSettingsLoadSave( const AppSettingsEventInfo& evtinfo ) { Owner.AppStatusEvent_OnSettingsLoadSave( evtinfo ); } + virtual void AppStatusEvent_OnUiSettingsLoadSave( const AppSettingsEventInfo& evtinfo ) { Owner.AppStatusEvent_OnUiSettingsLoadSave( evtinfo ); } + virtual void AppStatusEvent_OnVmSettingsLoadSave( const AppSettingsEventInfo& evtinfo ) { Owner.AppStatusEvent_OnVmSettingsLoadSave( evtinfo ); } virtual void AppStatusEvent_OnSettingsApplied() { Owner.AppStatusEvent_OnSettingsApplied(); } virtual void AppStatusEvent_OnExit() { Owner.AppStatusEvent_OnExit(); } }; diff --git a/pcsx2/gui/AppEventSources.cpp b/pcsx2/gui/AppEventSources.cpp index d58fa38ad1..6a5d835cfc 100644 --- a/pcsx2/gui/AppEventSources.cpp +++ b/pcsx2/gui/AppEventSources.cpp @@ -22,8 +22,8 @@ template class EventSource< IEventListener_CoreThread >; template class EventSource< IEventListener_Plugins >; template class EventSource< IEventListener_AppStatus >; -AppSettingsEventInfo::AppSettingsEventInfo( IniInterface& ini ) - : AppEventInfo( ini.IsSaving() ? AppStatus_SettingsSaved : AppStatus_SettingsLoaded ) +AppSettingsEventInfo::AppSettingsEventInfo( IniInterface& ini, AppEventType evt_type ) + : AppEventInfo( evt_type ) , m_ini( ini ) { } @@ -95,13 +95,24 @@ void IEventListener_AppStatus::DispatchEvent( const AppEventInfo& evtinfo ) { switch( evtinfo.evt_type ) { - case AppStatus_SettingsLoaded: - case AppStatus_SettingsSaved: - AppStatusEvent_OnSettingsLoadSave( (const AppSettingsEventInfo&)evtinfo ); + case AppStatus_UiSettingsLoaded: + case AppStatus_UiSettingsSaved: + AppStatusEvent_OnUiSettingsLoadSave( (const AppSettingsEventInfo&)evtinfo ); break; - case AppStatus_SettingsApplied: AppStatusEvent_OnSettingsApplied(); break; - case AppStatus_Exiting: AppStatusEvent_OnExit(); break; + case AppStatus_VmSettingsLoaded: + case AppStatus_VmSettingsSaved: + AppStatusEvent_OnVmSettingsLoadSave( (const AppSettingsEventInfo&)evtinfo ); + break; + + case AppStatus_SettingsApplied: + AppStatusEvent_OnSettingsApplied(); + break; + + + case AppStatus_Exiting: + AppStatusEvent_OnExit(); + break; } } @@ -146,10 +157,16 @@ void Pcsx2App::DispatchEvent( CoreThreadStatus evt ) CoreThread.RethrowException(); } -void Pcsx2App::DispatchEvent( IniInterface& ini ) +void Pcsx2App::DispatchUiSettingsEvent( IniInterface& ini ) { if( !AffinityAssert_AllowFrom_MainUI() ) return; - m_evtsrc_AppStatus.Dispatch( AppSettingsEventInfo( ini ) ); + m_evtsrc_AppStatus.Dispatch( AppSettingsEventInfo( ini, ini.IsSaving() ? AppStatus_UiSettingsSaved : AppStatus_UiSettingsLoaded ) ); +} + +void Pcsx2App::DispatchVmSettingsEvent( IniInterface& ini ) +{ + if( !AffinityAssert_AllowFrom_MainUI() ) return; + m_evtsrc_AppStatus.Dispatch( AppSettingsEventInfo( ini, ini.IsSaving() ? AppStatus_VmSettingsSaved : AppStatus_VmSettingsLoaded ) ); } diff --git a/pcsx2/gui/AppInit.cpp b/pcsx2/gui/AppInit.cpp index 0b7b47ada1..336da2a521 100644 --- a/pcsx2/gui/AppInit.cpp +++ b/pcsx2/gui/AppInit.cpp @@ -613,7 +613,7 @@ void Pcsx2App::CleanupOnExit() void Pcsx2App::CleanupResources() { ScopedBusyCursor cursor( Cursor_ReallyBusy ); - delete wxConfigBase::Set( NULL ); + //delete wxConfigBase::Set( NULL ); while( wxGetLocale() != NULL ) delete wxGetLocale(); diff --git a/pcsx2/gui/AppUserMode.cpp b/pcsx2/gui/AppUserMode.cpp index 39ffae076b..2f26808191 100644 --- a/pcsx2/gui/AppUserMode.cpp +++ b/pcsx2/gui/AppUserMode.cpp @@ -317,16 +317,14 @@ void Pcsx2App::EstablishAppUserMode() bool runWiz; conf_install->Read( L"RunWizard", &runWiz, true ); - IniLoader loader( conf_install ); - App_LoadSaveInstallSettings( loader ); + App_LoadInstallSettings( conf_install ); if( !Startup.ForceWizard && !runWiz ) return; DoFirstTimeWizard(); // Save user's new settings - IniSaver saver( *conf_install ); - App_LoadSaveInstallSettings( saver ); + App_SaveInstallSettings( conf_install ); AppConfig_OnChangedSettingsFolder( true ); AppSaveSettings(); diff --git a/pcsx2/gui/ApplyState.h b/pcsx2/gui/ApplyState.h index e8925cd917..e0eadea274 100644 --- a/pcsx2/gui/ApplyState.h +++ b/pcsx2/gui/ApplyState.h @@ -139,7 +139,7 @@ protected: // be called after a failed Apply (canceled due to error). virtual void AppStatusEvent_OnSettingsApplied() {} - virtual void AppStatusEvent_OnSettingsLoadSave( const AppSettingsEventInfo& ) {} + virtual void AppStatusEvent_OnUiSettingsLoadSave( const AppSettingsEventInfo& ) {} virtual void AppStatusEvent_OnExit() {} }; @@ -187,14 +187,15 @@ public: void Init(); // Mandatory override: As a rule for proper interface design, all deriving classes need - // to implement this function. There's no implementation of an options/settings panel - // that does not heed the changes of application status/settings changes. ;) + // to implement this OnSettingsApplied function. There's no implementation of an options/ + // settings panel that does not heed the changes of application status/settings changes. ;) // // 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 AppStatusEvent_OnSettingsApplied()=0; - virtual void AppStatusEvent_OnSettingsLoadSave( const AppSettingsEventInfo& ) {} + virtual void AppStatusEvent_OnUiSettingsLoadSave( const AppSettingsEventInfo& ) {} + virtual void AppStatusEvent_OnVmSettingsLoadSave( const AppSettingsEventInfo& ) {} virtual void AppStatusEvent_OnExit() {} protected: diff --git a/pcsx2/gui/Dialogs/BaseConfigurationDialog.cpp b/pcsx2/gui/Dialogs/BaseConfigurationDialog.cpp index d2ef954974..8596e672a4 100644 --- a/pcsx2/gui/Dialogs/BaseConfigurationDialog.cpp +++ b/pcsx2/gui/Dialogs/BaseConfigurationDialog.cpp @@ -74,7 +74,8 @@ void BaseApplicableDialog::Init() void BaseApplicableDialog::OnSettingsApplied( wxCommandEvent& evt ) { evt.Skip(); - if( evt.GetId() == GetId() ) AppStatusEvent_OnSettingsApplied(); + if( evt.GetId() == GetId() ) + AppStatusEvent_OnSettingsApplied(); } diff --git a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp index 12d4fde412..a0b5126d15 100644 --- a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp +++ b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp @@ -71,7 +71,7 @@ namespace Panels Panels::FirstTimeIntroPanel::FirstTimeIntroPanel( wxWindow* parent ) : wxPanelWithHelpers( parent, wxVERTICAL ) { - SetMinWidth( 640 ); + SetMinWidth( 600 ); FastFormatUnicode faqFile; faqFile.Write( L"file:///%s/Docs/PCSX2 FAQ %u.%u.%u.pdf", @@ -81,9 +81,10 @@ Panels::FirstTimeIntroPanel::FirstTimeIntroPanel( wxWindow* parent ) wxStaticBoxSizer& langSel = *new wxStaticBoxSizer( wxVERTICAL, this, _("Language selector") ); langSel += new Panels::LanguageSelectionPanel( this ) | StdCenter(); - langSel += Label(_("Change this only if you need to.\nThe system default should be fine for most operating systems.")); + langSel += Heading(_("Change the language only if you need to.\nThe system default should be fine for most operating systems.")); + langSel += 8; - *this += langSel | StdCenter(); + *this += langSel | StdExpand(); *this += GetCharHeight() * 2; *this += Heading(AddAppName(L"Welcome to %s!")).Bold(); @@ -101,11 +102,11 @@ Panels::FirstTimeIntroPanel::FirstTimeIntroPanel( wxWindow* parent ) *this += new wxHyperlinkCtrl( this, wxID_ANY, _("Configuration Guides (online)"), L"http://www.pcsx2.net/guide.php" - ) | pxProportion(1).Center().Border( wxALL, 5 ); + ) | pxCenter.Border( wxALL, 5 ); *this += new wxHyperlinkCtrl( this, wxID_ANY, _("Readme / FAQ (Offline/PDF)"), faqFile.c_str() - ) | pxProportion(1).Center().Border( wxALL, 5 ); + ) | pxCenter.Border( wxALL, 5 ); } diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index f7a7bd622d..f0b3475042 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -274,11 +274,6 @@ void MainEmuFrame::DispatchEvent( const CoreThreadStatus& status ) ApplyCoreStatus(); } -void MainEmuFrame::AppStatusEvent_OnSettingsLoadSave() -{ - // nothing to do here right now. -} - void MainEmuFrame::AppStatusEvent_OnSettingsApplied() { ApplySettings(); diff --git a/pcsx2/gui/MainFrame.h b/pcsx2/gui/MainFrame.h index 74348f6bb3..b1704caba0 100644 --- a/pcsx2/gui/MainFrame.h +++ b/pcsx2/gui/MainFrame.h @@ -132,7 +132,6 @@ protected: virtual void DispatchEvent( const PluginEventType& plugin_evt ); virtual void DispatchEvent( const CoreThreadStatus& status ); - virtual void AppStatusEvent_OnSettingsLoadSave(); virtual void AppStatusEvent_OnSettingsApplied(); public: diff --git a/pcsx2/gui/Panels/PluginSelectorPanel.cpp b/pcsx2/gui/Panels/PluginSelectorPanel.cpp index 2754240d88..719d902f8a 100644 --- a/pcsx2/gui/Panels/PluginSelectorPanel.cpp +++ b/pcsx2/gui/Panels/PluginSelectorPanel.cpp @@ -439,8 +439,6 @@ Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow* parent ) Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( PluginSelectorPanel::OnPluginSelected ) ); Connect( ButtonId_Configure, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PluginSelectorPanel::OnConfigure_Clicked ) ); - - AppStatusEvent_OnSettingsApplied(); } Panels::PluginSelectorPanel::~PluginSelectorPanel() throw() @@ -455,7 +453,7 @@ void Panels::PluginSelectorPanel::AppStatusEvent_OnSettingsApplied() static wxString GetApplyFailedMsg() { - return wxsFormat( pxE( "!Notice:PluginSelector:ApplyFailed", + return pxsFmt( pxE( "!Notice:PluginSelector:ApplyFailed", L"All plugins must have valid selections for %s to run. If you are unable to make " L"a valid selection due to missing plugins or an incomplete install of %s, then " L"press cancel to close the Configuration panel." diff --git a/pcsx2/gui/RecentIsoList.cpp b/pcsx2/gui/RecentIsoList.cpp index 2ad512a072..be83503376 100644 --- a/pcsx2/gui/RecentIsoList.cpp +++ b/pcsx2/gui/RecentIsoList.cpp @@ -186,7 +186,7 @@ void RecentIsoManager::AppStatusEvent_OnSettingsApplied() // TODO : Implement application of Recent Iso List "maximum" history option } -void RecentIsoManager::AppStatusEvent_OnSettingsLoadSave( const AppSettingsEventInfo& evt ) +void RecentIsoManager::AppStatusEvent_OnUiSettingsLoadSave( const AppSettingsEventInfo& evt ) { IniInterface& ini( evt.GetIni() ); diff --git a/pcsx2/gui/RecentIsoList.h b/pcsx2/gui/RecentIsoList.h index 9e99b40bae..d7ea719159 100644 --- a/pcsx2/gui/RecentIsoList.h +++ b/pcsx2/gui/RecentIsoList.h @@ -60,7 +60,7 @@ protected: void OnChangedSelection( wxCommandEvent& evt ); void LoadListFrom( IniInterface& ini ); - void AppStatusEvent_OnSettingsLoadSave( const AppSettingsEventInfo& ini ); + void AppStatusEvent_OnUiSettingsLoadSave( const AppSettingsEventInfo& ini ); void AppStatusEvent_OnSettingsApplied(); };