* Fix to changing plugins on the fly (should actually work pretty reliable now).

* Make applying emu settings a little more transparent, with less gs window flicker mess.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2920 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-04-27 21:29:37 +00:00
parent 7c31236f8e
commit 80cfbba7b7
4 changed files with 26 additions and 14 deletions

View File

@ -1131,7 +1131,9 @@ void PluginManager::Close( PluginsEnum_t pid )
pxAssume( (uint)pid < PluginId_Count ); pxAssume( (uint)pid < PluginId_Count );
if( !IsOpen(pid) ) return; if( !IsOpen(pid) ) return;
Console.Indent().WriteLn( "Closing %s", tbl_PluginInfo[pid].shortname );
if( !GetMTGS().IsSelf() ) // stop the spam!
Console.Indent().WriteLn( "Closing %s", tbl_PluginInfo[pid].shortname );
switch( pid ) switch( pid )
{ {

View File

@ -562,11 +562,13 @@ GSFrame& Pcsx2App::GetGsFrame() const
return *gsFrame; return *gsFrame;
} }
// NOTE: Plugins are *not* applied by this function. Changes to plugins need to handled
// manually. The PluginSelectorPanel does this, for example.
void AppApplySettings( const AppConfig* oldconf ) void AppApplySettings( const AppConfig* oldconf )
{ {
AffinityAssert_AllowFrom_MainUI(); AffinityAssert_AllowFrom_MainUI();
ScopedCoreThreadClose suspend_core; ScopedCoreThreadPause paused_core;
g_Conf->Folders.ApplyDefaults(); g_Conf->Folders.ApplyDefaults();
@ -601,7 +603,7 @@ void AppApplySettings( const AppConfig* oldconf )
NTFS_CompressFile( g_Conf->Folders.MemoryCards.ToString(), g_Conf->McdEnableNTFS ); NTFS_CompressFile( g_Conf->Folders.MemoryCards.ToString(), g_Conf->McdEnableNTFS );
sApp.DispatchEvent( AppStatus_SettingsApplied ); sApp.DispatchEvent( AppStatus_SettingsApplied );
suspend_core.AllowResume(); paused_core.AllowResume();
} }

View File

@ -334,11 +334,15 @@ bool GSFrame::Show( bool shown )
void GSFrame::AppStatusEvent_OnSettingsApplied() void GSFrame::AppStatusEvent_OnSettingsApplied()
{ {
if( IsBeingDeleted() ) return; if( IsBeingDeleted() ) return;
ShowFullScreen( g_Conf->GSWindow.DefaultToFullscreen );
Show( !g_Conf->GSWindow.CloseOnEsc || !CorePlugins.IsOpen(PluginId_GS) || !SysHasValidState() ); if( g_Conf->GSWindow.CloseOnEsc )
{
if( IsShown() && !CorePlugins.IsOpen(PluginId_GS) )
Show( false );
}
if( wxStaticText* label = GetLabel_OutputDisabled() ) if( wxStaticText* label = GetLabel_OutputDisabled() )
label->Show( !EmuConfig.GS.DisableOutput ); label->Show( EmuConfig.GS.DisableOutput );
} }
GSPanel* GSFrame::GetViewport() GSPanel* GSFrame::GetViewport()

View File

@ -37,13 +37,13 @@ using namespace Threading;
BEGIN_DECLARE_EVENT_TYPES() BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EVENT_TYPE(pxEVT_EnumeratedNext, -1) DECLARE_EVENT_TYPE(pxEVT_EnumeratedNext, -1)
DECLARE_EVENT_TYPE(pxEVT_EnumerationFinished, -1) DECLARE_EVENT_TYPE(pxEvt_EnumerationFinished, -1)
DECLARE_EVENT_TYPE(pxEVT_ShowStatusBar, -1) DECLARE_EVENT_TYPE(pxEVT_ShowStatusBar, -1)
DECLARE_EVENT_TYPE(pxEvt_SysExecEventComplete, -1) DECLARE_EVENT_TYPE(pxEvt_SysExecEventComplete, -1)
END_DECLARE_EVENT_TYPES() END_DECLARE_EVENT_TYPES()
DEFINE_EVENT_TYPE(pxEVT_EnumeratedNext) DEFINE_EVENT_TYPE(pxEVT_EnumeratedNext)
DEFINE_EVENT_TYPE(pxEVT_EnumerationFinished); DEFINE_EVENT_TYPE(pxEvt_EnumerationFinished);
DEFINE_EVENT_TYPE(pxEVT_ShowStatusBar); DEFINE_EVENT_TYPE(pxEVT_ShowStatusBar);
DEFINE_EVENT_TYPE(pxEvt_SysExecEventComplete) DEFINE_EVENT_TYPE(pxEvt_SysExecEventComplete)
@ -258,6 +258,7 @@ void SysExecEvent_ApplyPlugins::_DoInvoke()
CorePlugins.Shutdown(); CorePlugins.Shutdown();
CorePlugins.Unload(); CorePlugins.Unload();
LoadPluginsImmediate(); LoadPluginsImmediate();
CoreThread.RecoverState();
wxCommandEvent tevt( pxEvt_SysExecEventComplete ); wxCommandEvent tevt( pxEvt_SysExecEventComplete );
m_dialog->GetEventHandler()->AddPendingEvent( tevt ); m_dialog->GetEventHandler()->AddPendingEvent( tevt );
@ -419,7 +420,7 @@ Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow* parent, int idealWid
//Connect( refresh->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PluginSelectorPanel::OnRefresh ) ); //Connect( refresh->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PluginSelectorPanel::OnRefresh ) );
Connect( pxEVT_EnumeratedNext, wxCommandEventHandler( PluginSelectorPanel::OnProgress ) ); Connect( pxEVT_EnumeratedNext, wxCommandEventHandler( PluginSelectorPanel::OnProgress ) );
Connect( pxEVT_EnumerationFinished, wxCommandEventHandler( PluginSelectorPanel::OnEnumComplete ) ); Connect( pxEvt_EnumerationFinished, wxCommandEventHandler( PluginSelectorPanel::OnEnumComplete ) );
Connect( pxEVT_ShowStatusBar, wxCommandEventHandler( PluginSelectorPanel::OnShowStatusBar ) ); Connect( pxEVT_ShowStatusBar, wxCommandEventHandler( PluginSelectorPanel::OnShowStatusBar ) );
Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( PluginSelectorPanel::OnPluginSelected ) ); Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( PluginSelectorPanel::OnPluginSelected ) );
@ -595,7 +596,11 @@ bool Panels::PluginSelectorPanel::ValidateEnumerationStatus()
m_FileList.SwapPtr( pluginlist ); m_FileList.SwapPtr( pluginlist );
m_StatusPanel->SetGaugeLength( pluggers ); // set the gague length a little shorter than the plugin count. 2 reasons:
// * some of the plugins might be duds.
// * on high end machines and Win7, the statusbar lags a lot and never gets to 100% before being hidden.
m_StatusPanel->SetGaugeLength( std::max( 1, (pluggers-1) - (pluggers/8) ) );
return validated; return validated;
} }
@ -706,7 +711,7 @@ void Panels::PluginSelectorPanel::OnProgress( wxCommandEvent& evt )
const int nextidx = evtidx+1; const int nextidx = evtidx+1;
if( nextidx == m_FileList->Count() ) if( nextidx == m_FileList->Count() )
{ {
wxCommandEvent done( pxEVT_EnumerationFinished ); wxCommandEvent done( pxEvt_EnumerationFinished );
GetEventHandler()->AddPendingEvent( done ); GetEventHandler()->AddPendingEvent( done );
} }
else else
@ -808,12 +813,11 @@ void Panels::PluginSelectorPanel::EnumThread::ExecuteTaskInThread()
// speed isn't critical here, but the pretty status bar sure is. Sleep off // speed isn't critical here, but the pretty status bar sure is. Sleep off
// some brief cycles to give the status bar time to refresh. // some brief cycles to give the status bar time to refresh.
Sleep( 2 ); Sleep( 5 );
//Sleep(150); // uncomment this to slow down the selector, for debugging threading. //Sleep(150); // uncomment this to slow down the selector, for debugging threading.
} }
wxCommandEvent done( pxEVT_EnumerationFinished ); wxCommandEvent done( pxEvt_EnumerationFinished );
done.SetClientData( this ); done.SetClientData( this );
m_master.GetEventHandler()->AddPendingEvent( done ); m_master.GetEventHandler()->AddPendingEvent( done );