mirror of https://github.com/PCSX2/pcsx2.git
UI: Refactored plugin loops to use lambdas. (#3569)
This commit is contained in:
parent
79f2468952
commit
2849776054
|
@ -943,12 +943,12 @@ void SysCorePlugins::Load( const wxString (&folders)[PluginId_Count] )
|
||||||
Console.WriteLn(Color_StrongBlue, L"\nLoading plugins from %s...", WX_STR(g_Conf->Folders[FolderId_Plugins].ToString()));
|
Console.WriteLn(Color_StrongBlue, L"\nLoading plugins from %s...", WX_STR(g_Conf->Folders[FolderId_Plugins].ToString()));
|
||||||
|
|
||||||
ConsoleIndentScope indent;
|
ConsoleIndentScope indent;
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do
|
|
||||||
{
|
ForPlugins([&] (const PluginInfo * pi) {
|
||||||
Load( pi->id, folders[pi->id] );
|
Load( pi->id, folders[pi->id] );
|
||||||
pxYield( 2 );
|
pxYield( 2 );
|
||||||
|
});
|
||||||
|
|
||||||
} while( ++pi, pi->shortname != NULL );
|
|
||||||
indent.LeaveScope();
|
indent.LeaveScope();
|
||||||
|
|
||||||
// Hack for PAD's stupid parameter passed on Init
|
// Hack for PAD's stupid parameter passed on Init
|
||||||
|
@ -1126,7 +1126,7 @@ void SysCorePlugins::Open()
|
||||||
|
|
||||||
SendSettingsFolder();
|
SendSettingsFolder();
|
||||||
|
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
ForPlugins([&] (const PluginInfo * pi) {
|
||||||
Open( pi->id );
|
Open( pi->id );
|
||||||
// If GS doesn't support GSopen2, need to wait until call to GSopen
|
// If GS doesn't support GSopen2, need to wait until call to GSopen
|
||||||
// returns to populate pDsp. If it does, can initialize other plugins
|
// returns to populate pDsp. If it does, can initialize other plugins
|
||||||
|
@ -1140,7 +1140,7 @@ void SysCorePlugins::Open()
|
||||||
#else
|
#else
|
||||||
if (pi->id == PluginId_GS && !GSopen2) GetMTGS().WaitForOpen();
|
if (pi->id == PluginId_GS && !GSopen2) GetMTGS().WaitForOpen();
|
||||||
#endif
|
#endif
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
|
|
||||||
if (GSopen2) GetMTGS().WaitForOpen();
|
if (GSopen2) GetMTGS().WaitForOpen();
|
||||||
|
|
||||||
|
@ -1283,9 +1283,10 @@ bool SysCorePlugins::Init()
|
||||||
if( !NeedsInit() ) return false;
|
if( !NeedsInit() ) return false;
|
||||||
|
|
||||||
Console.WriteLn( Color_StrongBlue, "Initializing plugins..." );
|
Console.WriteLn( Color_StrongBlue, "Initializing plugins..." );
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
|
||||||
|
ForPlugins([&] (const PluginInfo * pi) {
|
||||||
Init( pi->id );
|
Init( pi->id );
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
|
|
||||||
if( SysPlugins.Mcd == NULL )
|
if( SysPlugins.Mcd == NULL )
|
||||||
{
|
{
|
||||||
|
@ -1501,10 +1502,10 @@ bool SysCorePlugins::KeyEvent( const keyEvent& evt )
|
||||||
// pick up the key and return "true" (for handled) will cause the loop to break.
|
// pick up the key and return "true" (for handled) will cause the loop to break.
|
||||||
// The current version of PS2E doesn't support it yet, though.
|
// The current version of PS2E doesn't support it yet, though.
|
||||||
|
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
ForPlugins([&] (const PluginInfo * pi) {
|
||||||
if( pi->id != PluginId_PAD && m_info[pi->id] )
|
if( pi->id != PluginId_PAD && m_info[pi->id] )
|
||||||
m_info[pi->id]->CommonBindings.KeyEvent( const_cast<keyEvent*>(&evt) );
|
m_info[pi->id]->CommonBindings.KeyEvent( const_cast<keyEvent*>(&evt) );
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1514,9 +1515,9 @@ void SysCorePlugins::SendSettingsFolder()
|
||||||
ScopedLock lock( m_mtx_PluginStatus );
|
ScopedLock lock( m_mtx_PluginStatus );
|
||||||
if( m_SettingsFolder.IsEmpty() ) return;
|
if( m_SettingsFolder.IsEmpty() ) return;
|
||||||
|
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
ForPlugins([&] (const PluginInfo * pi) {
|
||||||
if( m_info[pi->id] ) m_info[pi->id]->CommonBindings.SetSettingsDir( m_SettingsFolder.utf8_str() );
|
if( m_info[pi->id] ) m_info[pi->id]->CommonBindings.SetSettingsDir( m_SettingsFolder.utf8_str() );
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SysCorePlugins::SetSettingsFolder( const wxString& folder )
|
void SysCorePlugins::SetSettingsFolder( const wxString& folder )
|
||||||
|
@ -1538,9 +1539,9 @@ void SysCorePlugins::SendLogFolder()
|
||||||
ScopedLock lock( m_mtx_PluginStatus );
|
ScopedLock lock( m_mtx_PluginStatus );
|
||||||
if( m_LogFolder.IsEmpty() ) return;
|
if( m_LogFolder.IsEmpty() ) return;
|
||||||
|
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
ForPlugins([&] (const PluginInfo * pi) {
|
||||||
if( m_info[pi->id] ) m_info[pi->id]->CommonBindings.SetLogDir( m_LogFolder.utf8_str() );
|
if( m_info[pi->id] ) m_info[pi->id]->CommonBindings.SetLogDir( m_LogFolder.utf8_str() );
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SysCorePlugins::SetLogFolder( const wxString& folder )
|
void SysCorePlugins::SetLogFolder( const wxString& folder )
|
||||||
|
@ -1577,11 +1578,10 @@ bool SysCorePlugins::AreLoaded() const
|
||||||
bool SysCorePlugins::AreOpen() const
|
bool SysCorePlugins::AreOpen() const
|
||||||
{
|
{
|
||||||
ScopedLock lock( m_mtx_PluginStatus );
|
ScopedLock lock( m_mtx_PluginStatus );
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
|
||||||
if( !IsOpen(pi->id) ) return false;
|
|
||||||
} while( ++pi, pi->shortname != NULL );
|
|
||||||
|
|
||||||
return true;
|
return IfPlugins([&] (const PluginInfo * pi) {
|
||||||
|
return !IsOpen(pi->id);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SysCorePlugins::AreAnyLoaded() const
|
bool SysCorePlugins::AreAnyLoaded() const
|
||||||
|
@ -1598,11 +1598,10 @@ bool SysCorePlugins::AreAnyLoaded() const
|
||||||
bool SysCorePlugins::AreAnyInitialized() const
|
bool SysCorePlugins::AreAnyInitialized() const
|
||||||
{
|
{
|
||||||
ScopedLock lock( m_mtx_PluginStatus );
|
ScopedLock lock( m_mtx_PluginStatus );
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
|
||||||
if( IsInitialized(pi->id) ) return true;
|
|
||||||
} while( ++pi, pi->shortname != NULL );
|
|
||||||
|
|
||||||
return false;
|
return IfPlugins([&] (const PluginInfo * pi) {
|
||||||
|
return IsInitialized(pi->id);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SysCorePlugins::IsOpen( PluginsEnum_t pid ) const
|
bool SysCorePlugins::IsOpen( PluginsEnum_t pid ) const
|
||||||
|
@ -1627,60 +1626,49 @@ bool SysCorePlugins::IsLoaded( PluginsEnum_t pid ) const
|
||||||
|
|
||||||
bool SysCorePlugins::NeedsLoad() const
|
bool SysCorePlugins::NeedsLoad() const
|
||||||
{
|
{
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
return IfPlugins([&] (const PluginInfo * pi) {
|
||||||
if( !IsLoaded(pi->id) ) return true;
|
return !IsLoaded(pi->id);
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SysCorePlugins::NeedsUnload() const
|
bool SysCorePlugins::NeedsUnload() const
|
||||||
{
|
{
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
|
||||||
if( IsLoaded(pi->id) ) return true;
|
|
||||||
} while( ++pi, pi->shortname != NULL );
|
|
||||||
|
|
||||||
return false;
|
return IfPlugins([&] (const PluginInfo * pi) {
|
||||||
|
return IsLoaded(pi->id);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SysCorePlugins::NeedsInit() const
|
bool SysCorePlugins::NeedsInit() const
|
||||||
{
|
{
|
||||||
ScopedLock lock( m_mtx_PluginStatus );
|
ScopedLock lock( m_mtx_PluginStatus );
|
||||||
|
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
return IfPlugins([&] (const PluginInfo * pi) {
|
||||||
if( !IsInitialized(pi->id) ) return true;
|
return !IsInitialized(pi->id);
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SysCorePlugins::NeedsShutdown() const
|
bool SysCorePlugins::NeedsShutdown() const
|
||||||
{
|
{
|
||||||
ScopedLock lock( m_mtx_PluginStatus );
|
ScopedLock lock( m_mtx_PluginStatus );
|
||||||
|
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
return IfPlugins([&] (const PluginInfo * pi) {
|
||||||
if( IsInitialized(pi->id) ) return true;
|
return IsInitialized(pi->id);
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SysCorePlugins::NeedsOpen() const
|
bool SysCorePlugins::NeedsOpen() const
|
||||||
{
|
{
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
return IfPlugins([&] (const PluginInfo * pi) {
|
||||||
if( !IsOpen(pi->id) ) return true;
|
return !IsOpen(pi->id);
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SysCorePlugins::NeedsClose() const
|
bool SysCorePlugins::NeedsClose() const
|
||||||
{
|
{
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
return IfPlugins([&] (const PluginInfo * pi) {
|
||||||
if( IsOpen(pi->id) ) return true;
|
return IsOpen(pi->id);
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxString SysCorePlugins::GetName( PluginsEnum_t pid ) const
|
const wxString SysCorePlugins::GetName( PluginsEnum_t pid ) const
|
||||||
|
|
|
@ -421,6 +421,30 @@ protected:
|
||||||
|
|
||||||
extern const PluginInfo tbl_PluginInfo[];
|
extern const PluginInfo tbl_PluginInfo[];
|
||||||
|
|
||||||
|
template<typename Func>
|
||||||
|
static void ForPlugins(const Func& f)
|
||||||
|
{
|
||||||
|
const PluginInfo* pi = tbl_PluginInfo;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
f(pi);
|
||||||
|
} while(++pi, pi->shortname != nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Func>
|
||||||
|
static bool IfPlugins(const Func& f)
|
||||||
|
{
|
||||||
|
const PluginInfo* pi = tbl_PluginInfo;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (f(pi)) return true;
|
||||||
|
} while(++pi, pi->shortname != nullptr);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// GetPluginManager() is a required external implementation. This function is *NOT*
|
// GetPluginManager() is a required external implementation. This function is *NOT*
|
||||||
// provided by the PCSX2 core library. It provides an interface for the linking User
|
// provided by the PCSX2 core library. It provides an interface for the linking User
|
||||||
// Interface apps or DLLs to reference their own instance of SysCorePlugins (also allowing
|
// Interface apps or DLLs to reference their own instance of SysCorePlugins (also allowing
|
||||||
|
|
|
@ -88,13 +88,12 @@ static void PostPluginStatus( PluginEventType pevt )
|
||||||
|
|
||||||
static void ConvertPluginFilenames( wxString (&passins)[PluginId_Count] )
|
static void ConvertPluginFilenames( wxString (&passins)[PluginId_Count] )
|
||||||
{
|
{
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do
|
ForPlugins([&] (const PluginInfo * pi) {
|
||||||
{
|
|
||||||
passins[pi->id] = wxGetApp().Overrides.Filenames[pi->id].GetFullPath();
|
passins[pi->id] = wxGetApp().Overrides.Filenames[pi->id].GetFullPath();
|
||||||
|
|
||||||
if( passins[pi->id].IsEmpty() || !wxFileExists( passins[pi->id] ) )
|
if( passins[pi->id].IsEmpty() || !wxFileExists( passins[pi->id] ) )
|
||||||
passins[pi->id] = g_Conf->FullpathTo( pi->id );
|
passins[pi->id] = g_Conf->FullpathTo( pi->id );
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void (AppCorePlugins::*FnPtr_AppPluginManager)();
|
typedef void (AppCorePlugins::*FnPtr_AppPluginManager)();
|
||||||
|
@ -335,12 +334,6 @@ void AppCorePlugins::Open()
|
||||||
{
|
{
|
||||||
AffinityAssert_AllowFrom_CoreThread();
|
AffinityAssert_AllowFrom_CoreThread();
|
||||||
|
|
||||||
/*if( !GetSysExecutorThread().IsSelf() )
|
|
||||||
{
|
|
||||||
GetSysExecutorThread().ProcessEvent( new SysExecEvent_AppPluginManager( &AppCorePlugins::Open ) );
|
|
||||||
return;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
SetLogFolder( GetLogFolder().ToString() );
|
SetLogFolder( GetLogFolder().ToString() );
|
||||||
SetSettingsFolder( GetSettingsFolder().ToString() );
|
SetSettingsFolder( GetSettingsFolder().ToString() );
|
||||||
|
|
||||||
|
@ -547,7 +540,6 @@ void SysExecEvent_SaveSinglePlugin::InvokeEvent()
|
||||||
s_DisableGsWindow = true; // keeps the GS window smooth by avoiding closing the window
|
s_DisableGsWindow = true; // keeps the GS window smooth by avoiding closing the window
|
||||||
|
|
||||||
ScopedCoreThreadPause paused_core;
|
ScopedCoreThreadPause paused_core;
|
||||||
//_LoadPluginsImmediate();
|
|
||||||
|
|
||||||
if( CorePlugins.AreLoaded() )
|
if( CorePlugins.AreLoaded() )
|
||||||
{
|
{
|
||||||
|
@ -569,8 +561,6 @@ void SysExecEvent_SaveSinglePlugin::InvokeEvent()
|
||||||
Console.WriteLn( Color_Green, L"Recovering single plugin: " + tbl_PluginInfo[m_pid].GetShortname() );
|
Console.WriteLn( Color_Green, L"Recovering single plugin: " + tbl_PluginInfo[m_pid].GetShortname() );
|
||||||
memLoadingState load( plugstore.get() );
|
memLoadingState load( plugstore.get() );
|
||||||
GetCorePlugins().Freeze( m_pid, load );
|
GetCorePlugins().Freeze( m_pid, load );
|
||||||
// GS plugin suspend / resume hack. Removed in r4363, hopefully never to return :p
|
|
||||||
//GetCorePlugins().Close( m_pid ); // hack for stupid GS plugins.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -243,11 +243,11 @@ void Pcsx2App::OnInitCmdLine( wxCmdLineParser& parser )
|
||||||
|
|
||||||
parser.AddSwitch( wxEmptyString,L"profiling", _("update options to ease profiling (debug)") );
|
parser.AddSwitch( wxEmptyString,L"profiling", _("update options to ease profiling (debug)") );
|
||||||
|
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do {
|
ForPlugins([&] (const PluginInfo * pi) {
|
||||||
parser.AddOption( wxEmptyString, pi->GetShortname().Lower(),
|
parser.AddOption( wxEmptyString, pi->GetShortname().Lower(),
|
||||||
pxsFmt( _("specify the file to use as the %s plugin"), WX_STR(pi->GetShortname()) )
|
pxsFmt( _("specify the file to use as the %s plugin"), WX_STR(pi->GetShortname()) )
|
||||||
);
|
);
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
|
|
||||||
parser.SetSwitchChars( L"-" );
|
parser.SetSwitchChars( L"-" );
|
||||||
}
|
}
|
||||||
|
@ -261,6 +261,7 @@ bool Pcsx2App::OnCmdLineError( wxCmdLineParser& parser )
|
||||||
bool Pcsx2App::ParseOverrides( wxCmdLineParser& parser )
|
bool Pcsx2App::ParseOverrides( wxCmdLineParser& parser )
|
||||||
{
|
{
|
||||||
wxString dest;
|
wxString dest;
|
||||||
|
bool parsed = true;
|
||||||
|
|
||||||
if (parser.Found( L"cfgpath", &dest ) && !dest.IsEmpty())
|
if (parser.Found( L"cfgpath", &dest ) && !dest.IsEmpty())
|
||||||
{
|
{
|
||||||
|
@ -287,34 +288,33 @@ bool Pcsx2App::ParseOverrides( wxCmdLineParser& parser )
|
||||||
if (parser.Found(L"fullscreen")) Overrides.GsWindowMode = GsWinMode_Fullscreen;
|
if (parser.Found(L"fullscreen")) Overrides.GsWindowMode = GsWinMode_Fullscreen;
|
||||||
if (parser.Found(L"windowed")) Overrides.GsWindowMode = GsWinMode_Windowed;
|
if (parser.Found(L"windowed")) Overrides.GsWindowMode = GsWinMode_Windowed;
|
||||||
|
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do
|
ForPlugins([&] (const PluginInfo * pi) {
|
||||||
{
|
if (parser.Found( pi->GetShortname().Lower(), &dest))
|
||||||
if( !parser.Found( pi->GetShortname().Lower(), &dest ) ) continue;
|
|
||||||
|
|
||||||
if( wxFileExists( dest ) )
|
|
||||||
Console.Warning( pi->GetShortname() + L" override: " + dest );
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
wxDialogWithHelpers okcan( NULL, AddAppName(_("Plugin Override Error - %s")) );
|
if( wxFileExists( dest ) )
|
||||||
|
Console.Warning( pi->GetShortname() + L" override: " + dest );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxDialogWithHelpers okcan( NULL, AddAppName(_("Plugin Override Error - %s")) );
|
||||||
|
|
||||||
okcan += okcan.Heading( wxsFormat(
|
okcan += okcan.Heading( wxsFormat(
|
||||||
_("%s Plugin Override Error! The following file does not exist or is not a valid %s plugin:\n\n"),
|
_("%s Plugin Override Error! The following file does not exist or is not a valid %s plugin:\n\n"),
|
||||||
pi->GetShortname().c_str(), pi->GetShortname().c_str()
|
pi->GetShortname().c_str(), pi->GetShortname().c_str()
|
||||||
) );
|
) );
|
||||||
|
|
||||||
okcan += okcan.GetCharHeight();
|
okcan += okcan.GetCharHeight();
|
||||||
okcan += okcan.Text(dest);
|
okcan += okcan.Text(dest);
|
||||||
okcan += okcan.GetCharHeight();
|
okcan += okcan.GetCharHeight();
|
||||||
okcan += okcan.Heading(AddAppName(_("Press OK to use the default configured plugin, or Cancel to close %s.")));
|
okcan += okcan.Heading(AddAppName(_("Press OK to use the default configured plugin, or Cancel to close %s.")));
|
||||||
|
|
||||||
if( wxID_CANCEL == pxIssueConfirmation( okcan, MsgButtons().OKCancel() ) ) return false;
|
if( wxID_CANCEL == pxIssueConfirmation( okcan, MsgButtons().OKCancel() ) ) parsed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parsed) Overrides.Filenames.Plugins[pi->id] = dest;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
Overrides.Filenames.Plugins[pi->id] = dest;
|
|
||||||
|
|
||||||
} while( ++pi, pi->shortname != NULL );
|
return parsed;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Pcsx2App::OnCmdLineParsed( wxCmdLineParser& parser )
|
bool Pcsx2App::OnCmdLineParsed( wxCmdLineParser& parser )
|
||||||
|
|
|
@ -356,8 +356,7 @@ Panels::PluginSelectorPanel::ComboBoxPanel::ComboBoxPanel( PluginSelectorPanel*
|
||||||
s_plugin.SetFlexibleDirection( wxHORIZONTAL );
|
s_plugin.SetFlexibleDirection( wxHORIZONTAL );
|
||||||
s_plugin.AddGrowableCol( 1 ); // expands combo boxes to full width.
|
s_plugin.AddGrowableCol( 1 ); // expands combo boxes to full width.
|
||||||
|
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do
|
ForPlugins([&] (const PluginInfo * pi) {
|
||||||
{
|
|
||||||
const PluginsEnum_t pid = pi->id;
|
const PluginsEnum_t pid = pi->id;
|
||||||
|
|
||||||
m_combobox[pid] = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
m_combobox[pid] = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||||
|
@ -368,7 +367,7 @@ Panels::PluginSelectorPanel::ComboBoxPanel::ComboBoxPanel( PluginSelectorPanel*
|
||||||
s_plugin += Label( pi->GetShortname() ) | pxBorder( wxTOP | wxLEFT, 2 );
|
s_plugin += Label( pi->GetShortname() ) | pxBorder( wxTOP | wxLEFT, 2 );
|
||||||
s_plugin += m_combobox[pid] | pxExpand;
|
s_plugin += m_combobox[pid] | pxExpand;
|
||||||
s_plugin += m_configbutton[pid];
|
s_plugin += m_configbutton[pid];
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
|
|
||||||
// if (InstallationMode != InstallMode_Portable)
|
// if (InstallationMode != InstallMode_Portable)
|
||||||
m_FolderPicker.SetStaticDesc( _("Click the Browse button to select a different folder for PCSX2 plugins.") );
|
m_FolderPicker.SetStaticDesc( _("Click the Browse button to select a different folder for PCSX2 plugins.") );
|
||||||
|
@ -396,17 +395,16 @@ void Panels::PluginSelectorPanel::DispatchEvent( const PluginEventType& evt )
|
||||||
|
|
||||||
if( IsBeingDeleted() ) return;
|
if( IsBeingDeleted() ) return;
|
||||||
|
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do
|
ForPlugins([&] (const PluginInfo * pi) {
|
||||||
{
|
|
||||||
wxComboBox& box( m_ComponentBoxes->Get(pi->id) );
|
wxComboBox& box( m_ComponentBoxes->Get(pi->id) );
|
||||||
int sel = box.GetSelection();
|
int sel = box.GetSelection();
|
||||||
if( sel == wxNOT_FOUND ) continue;
|
if (sel != wxNOT_FOUND) {
|
||||||
|
m_ComponentBoxes->GetConfigButton(pi->id).Enable(
|
||||||
m_ComponentBoxes->GetConfigButton(pi->id).Enable(
|
|
||||||
(m_FileList==NULL || m_FileList->Count() == 0) ? false :
|
(m_FileList==NULL || m_FileList->Count() == 0) ? false :
|
||||||
g_Conf->FullpathMatchTest( pi->id,(*m_FileList)[((uptr)box.GetClientData(sel))] )
|
g_Conf->FullpathMatchTest( pi->id,(*m_FileList)[((uptr)box.GetClientData(sel))] )
|
||||||
);
|
);
|
||||||
} while( ++pi, pi->shortname != NULL );
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,8 +458,7 @@ void Panels::PluginSelectorPanel::Apply()
|
||||||
|
|
||||||
AppConfig curconf( *g_Conf );
|
AppConfig curconf( *g_Conf );
|
||||||
|
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do
|
ForPlugins([&] (const PluginInfo * pi) {
|
||||||
{
|
|
||||||
const PluginsEnum_t pid = pi->id;
|
const PluginsEnum_t pid = pi->id;
|
||||||
int sel = m_ComponentBoxes->Get(pid).GetSelection();
|
int sel = m_ComponentBoxes->Get(pid).GetSelection();
|
||||||
if( sel == wxNOT_FOUND )
|
if( sel == wxNOT_FOUND )
|
||||||
|
@ -474,7 +471,7 @@ void Panels::PluginSelectorPanel::Apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
g_Conf->BaseFilenames.Plugins[pid] = GetFilename((uptr)m_ComponentBoxes->Get(pid).GetClientData(sel));
|
g_Conf->BaseFilenames.Plugins[pid] = GetFilename((uptr)m_ComponentBoxes->Get(pid).GetClientData(sel));
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Make sure folders are up to date, and try to load/reload plugins if needed...
|
// Make sure folders are up to date, and try to load/reload plugins if needed...
|
||||||
|
@ -484,7 +481,9 @@ void Panels::PluginSelectorPanel::Apply()
|
||||||
// Need to unload the current emulation state if the user changed plugins, because
|
// Need to unload the current emulation state if the user changed plugins, because
|
||||||
// the whole plugin system needs to be re-loaded.
|
// the whole plugin system needs to be re-loaded.
|
||||||
|
|
||||||
pi = tbl_PluginInfo; do {
|
const PluginInfo* pi = tbl_PluginInfo;
|
||||||
|
|
||||||
|
do {
|
||||||
if( g_Conf->FullpathTo( pi->id ) != curconf.FullpathTo( pi->id ) )
|
if( g_Conf->FullpathTo( pi->id ) != curconf.FullpathTo( pi->id ) )
|
||||||
break;
|
break;
|
||||||
} while( ++pi, pi->shortname != NULL );
|
} while( ++pi, pi->shortname != NULL );
|
||||||
|
@ -592,10 +591,9 @@ void Panels::PluginSelectorPanel::OnPluginSelected( wxCommandEvent& evt )
|
||||||
{
|
{
|
||||||
if( IsBeingDeleted() || m_ComponentBoxes->IsBeingDeleted() ) return;
|
if( IsBeingDeleted() || m_ComponentBoxes->IsBeingDeleted() ) return;
|
||||||
|
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do
|
IfPlugins([&] (const PluginInfo * pi) {
|
||||||
{
|
|
||||||
wxComboBox& box( m_ComponentBoxes->Get(pi->id) );
|
wxComboBox& box( m_ComponentBoxes->Get(pi->id) );
|
||||||
if( box.GetId() == evt.GetId() )
|
if ( box.GetId() == evt.GetId() )
|
||||||
{
|
{
|
||||||
// Button is enabled if:
|
// Button is enabled if:
|
||||||
// (a) plugins aren't even loaded yet.
|
// (a) plugins aren't even loaded yet.
|
||||||
|
@ -605,9 +603,10 @@ void Panels::PluginSelectorPanel::OnPluginSelected( wxCommandEvent& evt )
|
||||||
m_ComponentBoxes->GetConfigButton( pi->id ).Enable( isSame );
|
m_ComponentBoxes->GetConfigButton( pi->id ).Enable( isSame );
|
||||||
|
|
||||||
if( !isSame ) evt.Skip(); // enabled Apply button! :D
|
if( !isSame ) evt.Skip(); // enabled Apply button! :D
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
} while( ++pi, pi->shortname != NULL );
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panels::PluginSelectorPanel::OnConfigure_Clicked( wxCommandEvent& evt )
|
void Panels::PluginSelectorPanel::OnConfigure_Clicked( wxCommandEvent& evt )
|
||||||
|
@ -788,8 +787,7 @@ void Panels::PluginSelectorPanel::OnProgress( wxCommandEvent& evt )
|
||||||
|
|
||||||
EnumeratedPluginInfo& result( m_EnumeratorThread->Results[evtidx] );
|
EnumeratedPluginInfo& result( m_EnumeratorThread->Results[evtidx] );
|
||||||
|
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do
|
ForPlugins([&] (const PluginInfo * pi) {
|
||||||
{
|
|
||||||
const PluginsEnum_t pid = pi->id;
|
const PluginsEnum_t pid = pi->id;
|
||||||
if( result.TypeMask & pi->typemask )
|
if( result.TypeMask & pi->typemask )
|
||||||
{
|
{
|
||||||
|
@ -807,7 +805,7 @@ void Panels::PluginSelectorPanel::OnProgress( wxCommandEvent& evt )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -835,8 +833,8 @@ void Panels::PluginSelectorPanel::EnumThread::DoNextPlugin( int curidx )
|
||||||
PluginEnumerator penum( m_master.GetFilename( curidx ) );
|
PluginEnumerator penum( m_master.GetFilename( curidx ) );
|
||||||
|
|
||||||
result.Name = penum.GetName();
|
result.Name = penum.GetName();
|
||||||
const PluginInfo* pi = tbl_PluginInfo; do
|
|
||||||
{
|
ForPlugins([&] (const PluginInfo * pi) {
|
||||||
const PluginsEnum_t pid = pi->id;
|
const PluginsEnum_t pid = pi->id;
|
||||||
result.TypeMask |= pi->typemask;
|
result.TypeMask |= pi->typemask;
|
||||||
if( penum.CheckVersion( pid ) )
|
if( penum.CheckVersion( pid ) )
|
||||||
|
@ -844,7 +842,7 @@ void Panels::PluginSelectorPanel::EnumThread::DoNextPlugin( int curidx )
|
||||||
result.PassedTest |= tbl_PluginInfo[pid].typemask;
|
result.PassedTest |= tbl_PluginInfo[pid].typemask;
|
||||||
penum.GetVersionString( result.Version[pid], pid );
|
penum.GetVersionString( result.Version[pid], pid );
|
||||||
}
|
}
|
||||||
} while( ++pi, pi->shortname != NULL );
|
});
|
||||||
}
|
}
|
||||||
catch (Exception::NotEnumerablePlugin& ex)
|
catch (Exception::NotEnumerablePlugin& ex)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue