mirror of https://github.com/PCSX2/pcsx2.git
GSopen2: synched with trunk to pick up various gui fixes.
git-svn-id: http://pcsx2.googlecode.com/svn/branches/GSopen2@1848 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
8de579954f
commit
cc1bc8d122
|
@ -9,4 +9,4 @@
|
||||||
:: so, don't go running this batch file in your root c:\ folder. It's probably not a wise action.
|
:: so, don't go running this batch file in your root c:\ folder. It's probably not a wise action.
|
||||||
:: Enjoy. :)
|
:: Enjoy. :)
|
||||||
|
|
||||||
del /s *.ncb;*.ilk;*.pdb;*.bsc;*.sbr;*.res
|
del /s *.ncb;*.ilk;*.pdb;*.bsc;*.sbr;*.res;*.pch
|
|
@ -165,6 +165,8 @@ namespace Threading
|
||||||
|
|
||||||
bool PersistentThread::IsRunning() const
|
bool PersistentThread::IsRunning() const
|
||||||
{
|
{
|
||||||
|
if (!m_running) return false;
|
||||||
|
|
||||||
if( !!m_detached )
|
if( !!m_detached )
|
||||||
return !!m_running;
|
return !!m_running;
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
<CodeBlocks_workspace_file>
|
<CodeBlocks_workspace_file>
|
||||||
<Workspace title="pcsx2_suite_2008 workspace">
|
<Workspace title="pcsx2_suite_2008 workspace">
|
||||||
<Project filename="pcsx2/Linux/pcsx2.cbp">
|
<Project filename="pcsx2/Linux/pcsx2.cbp" active="1">
|
||||||
<Depends filename="common/build/x86emitter/x86emitter.cbp" />
|
<Depends filename="common/build/x86emitter/x86emitter.cbp" />
|
||||||
<Depends filename="common/build/Utilities/Utilities.cbp" />
|
<Depends filename="common/build/Utilities/Utilities.cbp" />
|
||||||
<Depends filename="3rdparty/zlib/zlib.cbp" />
|
<Depends filename="3rdparty/zlib/zlib.cbp" />
|
||||||
|
@ -22,6 +22,6 @@
|
||||||
<Project filename="plugins/onepad/Linux/OnePad.cbp" />
|
<Project filename="plugins/onepad/Linux/OnePad.cbp" />
|
||||||
<Project filename="plugins/zerogs/opengl/Linux/ZeroGS.cbp" />
|
<Project filename="plugins/zerogs/opengl/Linux/ZeroGS.cbp" />
|
||||||
<Project filename="tools/bin2cpp/bin2cpp.cbp" />
|
<Project filename="tools/bin2cpp/bin2cpp.cbp" />
|
||||||
<Project filename="plugins/spu2-x/src/Linux/SPU2-X.cbp" active="1" />
|
<Project filename="plugins/spu2-x/src/Linux/SPU2-X.cbp" />
|
||||||
</Workspace>
|
</Workspace>
|
||||||
</CodeBlocks_workspace_file>
|
</CodeBlocks_workspace_file>
|
||||||
|
|
|
@ -175,7 +175,7 @@ void __fastcall WriteFIFO_page_6(u32 mem, const mem128_t *value)
|
||||||
psHu64(0x6008) = value[1];
|
psHu64(0x6008) = value[1];
|
||||||
|
|
||||||
FreezeRegs(1);
|
FreezeRegs(1);
|
||||||
const uint count = mtgsThread->PrepDataPacket(GIF_PATH_3, nloop0_packet, 1);
|
mtgsThread->PrepDataPacket(GIF_PATH_3, nloop0_packet, 1);
|
||||||
u64* data = (u64*)mtgsThread->GetDataPacketPtr();
|
u64* data = (u64*)mtgsThread->GetDataPacketPtr();
|
||||||
data[0] = value[0];
|
data[0] = value[0];
|
||||||
data[1] = value[1];
|
data[1] = value[1];
|
||||||
|
|
|
@ -282,6 +282,7 @@
|
||||||
<Unit filename="../gui/Dialogs/LogOptionsDialog.h" />
|
<Unit filename="../gui/Dialogs/LogOptionsDialog.h" />
|
||||||
<Unit filename="../gui/Dialogs/ModalPopups.h" />
|
<Unit filename="../gui/Dialogs/ModalPopups.h" />
|
||||||
<Unit filename="../gui/Dialogs/PickUserModeDialog.cpp" />
|
<Unit filename="../gui/Dialogs/PickUserModeDialog.cpp" />
|
||||||
|
<Unit filename="../gui/FrameForGS.cpp" />
|
||||||
<Unit filename="../gui/HostGui.cpp" />
|
<Unit filename="../gui/HostGui.cpp" />
|
||||||
<Unit filename="../gui/IniInterface.cpp" />
|
<Unit filename="../gui/IniInterface.cpp" />
|
||||||
<Unit filename="../gui/IniInterface.h" />
|
<Unit filename="../gui/IniInterface.h" />
|
||||||
|
|
|
@ -1887,7 +1887,7 @@ static int __fastcall Vif1TransDirectHL(u32 *data)
|
||||||
FreezeRegs(1);
|
FreezeRegs(1);
|
||||||
// copy 16 bytes the fast way:
|
// copy 16 bytes the fast way:
|
||||||
const u64* src = (u64*)splittransfer[0];
|
const u64* src = (u64*)splittransfer[0];
|
||||||
const uint count = mtgsThread->PrepDataPacket(GIF_PATH_2, nloop0_packet, 1);
|
mtgsThread->PrepDataPacket(GIF_PATH_2, nloop0_packet, 1);
|
||||||
u64* dst = (u64*)mtgsThread->GetDataPacketPtr();
|
u64* dst = (u64*)mtgsThread->GetDataPacketPtr();
|
||||||
dst[0] = src[0];
|
dst[0] = src[0];
|
||||||
dst[1] = src[1];
|
dst[1] = src[1];
|
||||||
|
|
|
@ -36,6 +36,7 @@ BEGIN_DECLARE_EVENT_TYPES()
|
||||||
DECLARE_EVENT_TYPE( pxEVT_SemaphorePing, -1 )
|
DECLARE_EVENT_TYPE( pxEVT_SemaphorePing, -1 )
|
||||||
DECLARE_EVENT_TYPE( pxEVT_OpenModalDialog, -1 )
|
DECLARE_EVENT_TYPE( pxEVT_OpenModalDialog, -1 )
|
||||||
DECLARE_EVENT_TYPE( pxEVT_ReloadPlugins, -1 )
|
DECLARE_EVENT_TYPE( pxEVT_ReloadPlugins, -1 )
|
||||||
|
DECLARE_EVENT_TYPE( pxEVT_LoadPluginsComplete, -1 )
|
||||||
END_DECLARE_EVENT_TYPES()
|
END_DECLARE_EVENT_TYPES()
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
@ -365,6 +366,7 @@ protected:
|
||||||
void HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& event) const;
|
void HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& event) const;
|
||||||
|
|
||||||
void OnReloadPlugins( wxCommandEvent& evt );
|
void OnReloadPlugins( wxCommandEvent& evt );
|
||||||
|
void OnLoadPluginsComplete( wxCommandEvent& evt );
|
||||||
void OnSemaphorePing( wxCommandEvent& evt );
|
void OnSemaphorePing( wxCommandEvent& evt );
|
||||||
void OnOpenModalDialog( wxCommandEvent& evt );
|
void OnOpenModalDialog( wxCommandEvent& evt );
|
||||||
void OnMessageBox( pxMessageBoxEvent& evt );
|
void OnMessageBox( pxMessageBoxEvent& evt );
|
||||||
|
|
|
@ -27,13 +27,14 @@
|
||||||
|
|
||||||
#include <wx/cmdline.h>
|
#include <wx/cmdline.h>
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
#include <wx/evtloop.h>
|
#include <wx/intl.h>
|
||||||
|
|
||||||
IMPLEMENT_APP(Pcsx2App)
|
IMPLEMENT_APP(Pcsx2App)
|
||||||
|
|
||||||
DEFINE_EVENT_TYPE( pxEVT_SemaphorePing );
|
DEFINE_EVENT_TYPE( pxEVT_SemaphorePing );
|
||||||
DEFINE_EVENT_TYPE( pxEVT_OpenModalDialog );
|
DEFINE_EVENT_TYPE( pxEVT_OpenModalDialog );
|
||||||
DEFINE_EVENT_TYPE( pxEVT_ReloadPlugins );
|
DEFINE_EVENT_TYPE( pxEVT_ReloadPlugins );
|
||||||
|
DEFINE_EVENT_TYPE( pxEVT_LoadPluginsComplete );
|
||||||
|
|
||||||
bool UseAdminMode = false;
|
bool UseAdminMode = false;
|
||||||
wxDirName SettingsFolder;
|
wxDirName SettingsFolder;
|
||||||
|
@ -427,6 +428,7 @@ bool Pcsx2App::OnInit()
|
||||||
Connect( pxEVT_SemaphorePing, wxCommandEventHandler( Pcsx2App::OnSemaphorePing ) );
|
Connect( pxEVT_SemaphorePing, wxCommandEventHandler( Pcsx2App::OnSemaphorePing ) );
|
||||||
Connect( pxEVT_OpenModalDialog, wxCommandEventHandler( Pcsx2App::OnOpenModalDialog ) );
|
Connect( pxEVT_OpenModalDialog, wxCommandEventHandler( Pcsx2App::OnOpenModalDialog ) );
|
||||||
Connect( pxEVT_ReloadPlugins, wxCommandEventHandler( Pcsx2App::OnReloadPlugins ) );
|
Connect( pxEVT_ReloadPlugins, wxCommandEventHandler( Pcsx2App::OnReloadPlugins ) );
|
||||||
|
Connect( pxEVT_LoadPluginsComplete, wxCommandEventHandler( Pcsx2App::OnLoadPluginsComplete ) );
|
||||||
|
|
||||||
Connect( pxID_Window_GS, wxEVT_KEY_DOWN, wxKeyEventHandler( Pcsx2App::OnEmuKeyDown ) );
|
Connect( pxID_Window_GS, wxEVT_KEY_DOWN, wxKeyEventHandler( Pcsx2App::OnEmuKeyDown ) );
|
||||||
|
|
||||||
|
@ -630,12 +632,13 @@ void Pcsx2App::OnMessageBox( pxMessageBoxEvent& evt )
|
||||||
Msgbox::OnEvent( evt );
|
Msgbox::OnEvent( evt );
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <wx/intl.h>
|
|
||||||
|
|
||||||
void Pcsx2App::CleanupMess()
|
void Pcsx2App::CleanupMess()
|
||||||
|
{
|
||||||
|
if( m_CorePlugins )
|
||||||
{
|
{
|
||||||
m_CorePlugins->Close();
|
m_CorePlugins->Close();
|
||||||
m_CorePlugins->Shutdown();
|
m_CorePlugins->Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
// Notice: deleting the plugin manager (unloading plugins) here causes Lilypad to crash,
|
// Notice: deleting the plugin manager (unloading plugins) here causes Lilypad to crash,
|
||||||
// likely due to some pending message in the queue that references lilypad procs.
|
// likely due to some pending message in the queue that references lilypad procs.
|
||||||
|
@ -768,7 +771,7 @@ void Pcsx2App::LoadSettings()
|
||||||
IniLoader loader( *conf );
|
IniLoader loader( *conf );
|
||||||
g_Conf->LoadSave( loader );
|
g_Conf->LoadSave( loader );
|
||||||
|
|
||||||
if( m_MainFrame != NULL )
|
if( m_MainFrame != NULL && m_MainFrame->m_RecentIsoList )
|
||||||
m_MainFrame->m_RecentIsoList->Load( *conf );
|
m_MainFrame->m_RecentIsoList->Load( *conf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,6 +783,6 @@ void Pcsx2App::SaveSettings()
|
||||||
IniSaver saver( *conf );
|
IniSaver saver( *conf );
|
||||||
g_Conf->LoadSave( saver );
|
g_Conf->LoadSave( saver );
|
||||||
|
|
||||||
if( m_MainFrame != NULL )
|
if( m_MainFrame != NULL && m_MainFrame->m_RecentIsoList )
|
||||||
m_MainFrame->m_RecentIsoList->Save( *conf );
|
m_MainFrame->m_RecentIsoList->Save( *conf );
|
||||||
}
|
}
|
||||||
|
|
|
@ -574,7 +574,7 @@ namespace Console
|
||||||
// [TODO] make this a configurable option? Do we care? :)
|
// [TODO] make this a configurable option? Do we care? :)
|
||||||
#ifdef __LINUX__
|
#ifdef __LINUX__
|
||||||
// puts does automatic newlines, which we don't want here
|
// puts does automatic newlines, which we don't want here
|
||||||
fputs( "PCSX2 > ", stdout );
|
//fputs( "PCSX2 > ", stdout );
|
||||||
fputs( src, stdout );
|
fputs( src, stdout );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -635,6 +635,7 @@ namespace Console
|
||||||
bool __fastcall WriteLn( const wxString& fmt )
|
bool __fastcall WriteLn( const wxString& fmt )
|
||||||
{
|
{
|
||||||
const wxString fmtline( fmt + L"\n" );
|
const wxString fmtline( fmt + L"\n" );
|
||||||
|
_immediate_logger( "PCSX2 > ");
|
||||||
_immediate_logger( fmtline );
|
_immediate_logger( fmtline );
|
||||||
|
|
||||||
if( emuLog != NULL )
|
if( emuLog != NULL )
|
||||||
|
|
|
@ -432,11 +432,8 @@ MainEmuFrame::~MainEmuFrame() throw()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( m_RecentIsoList != NULL )
|
if( m_RecentIsoList )
|
||||||
{
|
|
||||||
m_RecentIsoList->Save( *wxConfigBase::Get( false ) );
|
m_RecentIsoList->Save( *wxConfigBase::Get( false ) );
|
||||||
safe_delete( m_RecentIsoList );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DESTRUCTOR_CATCHALL
|
DESTRUCTOR_CATCHALL
|
||||||
}
|
}
|
||||||
|
@ -450,10 +447,10 @@ void MainEmuFrame::ApplySettings()
|
||||||
wxConfigBase* cfg = wxConfigBase::Get( false );
|
wxConfigBase* cfg = wxConfigBase::Get( false );
|
||||||
wxASSERT( cfg != NULL );
|
wxASSERT( cfg != NULL );
|
||||||
|
|
||||||
if( m_RecentIsoList != NULL )
|
if( m_RecentIsoList )
|
||||||
m_RecentIsoList->Save( *cfg );
|
m_RecentIsoList->Save( *cfg );
|
||||||
safe_delete( m_RecentIsoList );
|
m_RecentIsoList.reset();
|
||||||
m_RecentIsoList = new wxFileHistory( g_Conf->RecentFileCount );
|
m_RecentIsoList.reset( new wxFileHistory( g_Conf->RecentFileCount ) );
|
||||||
m_RecentIsoList->Load( *cfg );
|
m_RecentIsoList->Load( *cfg );
|
||||||
|
|
||||||
UpdateIsoSrcFile();
|
UpdateIsoSrcFile();
|
||||||
|
|
|
@ -37,7 +37,7 @@ class MainEmuFrame : public wxFrame
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxFileHistory* m_RecentIsoList;
|
wxScopedPtr<wxFileHistory> m_RecentIsoList;
|
||||||
wxStatusBar& m_statusbar;
|
wxStatusBar& m_statusbar;
|
||||||
wxStaticBitmap m_background;
|
wxStaticBitmap m_background;
|
||||||
|
|
||||||
|
|
|
@ -144,13 +144,15 @@ void MainEmuFrame::Menu_OpenELF_Click(wxCommandEvent &event)
|
||||||
void MainEmuFrame::Menu_LoadStates_Click(wxCommandEvent &event)
|
void MainEmuFrame::Menu_LoadStates_Click(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
int id = event.GetId() - MenuId_State_Load01 - 1;
|
int id = event.GetId() - MenuId_State_Load01 - 1;
|
||||||
Console::WriteLn("If this were hooked up, it would load slot %d.", id);
|
Console::WriteLn("Loading slot %d.", id);
|
||||||
|
States_Load(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainEmuFrame::Menu_SaveStates_Click(wxCommandEvent &event)
|
void MainEmuFrame::Menu_SaveStates_Click(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
int id = event.GetId() - MenuId_State_Save01 - 1;
|
int id = event.GetId() - MenuId_State_Save01 - 1;
|
||||||
Console::WriteLn("If this were hooked up, it would save slot %d.", id);
|
Console::WriteLn("Saving to slot %d.", id);
|
||||||
|
States_Save(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainEmuFrame::Menu_LoadStateOther_Click(wxCommandEvent &event)
|
void MainEmuFrame::Menu_LoadStateOther_Click(wxCommandEvent &event)
|
||||||
|
|
|
@ -416,7 +416,7 @@ void Panels::PluginSelectorPanel::OnConfigure_Clicked( wxCommandEvent& evt )
|
||||||
wxDynamicLibrary dynlib( (*m_FileList)[(int)m_ComponentBoxes.Get(pid).GetClientData(sel)] );
|
wxDynamicLibrary dynlib( (*m_FileList)[(int)m_ComponentBoxes.Get(pid).GetClientData(sel)] );
|
||||||
if( PluginConfigureFnptr configfunc = (PluginConfigureFnptr)dynlib.GetSymbol( tbl_PluginInfo[pid].GetShortname() + L"configure" ) )
|
if( PluginConfigureFnptr configfunc = (PluginConfigureFnptr)dynlib.GetSymbol( tbl_PluginInfo[pid].GetShortname() + L"configure" ) )
|
||||||
{
|
{
|
||||||
ScopedWindowDisable disabler( wxGetTopLevelParent( this ) );
|
wxWindowDisabler disabler;
|
||||||
configfunc();
|
configfunc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,8 @@ const wxChar* Panels::SpeedHacksPanel::GetEEcycleSliderMsg( int val )
|
||||||
L"audio on many FMVs."
|
L"audio on many FMVs."
|
||||||
);
|
);
|
||||||
|
|
||||||
jNO_DEFAULT
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return L"Unreachable Warning Suppressor!!";
|
return L"Unreachable Warning Suppressor!!";
|
||||||
|
@ -78,8 +79,8 @@ const wxChar* Panels::SpeedHacksPanel::GetVUcycleSliderMsg( int val )
|
||||||
L"3 - Maximum VU Cycle Stealing. Usefulness is limited, as this will cause flickering "
|
L"3 - Maximum VU Cycle Stealing. Usefulness is limited, as this will cause flickering "
|
||||||
L"visuals or slowdown in most games."
|
L"visuals or slowdown in most games."
|
||||||
);
|
);
|
||||||
|
default:
|
||||||
jNO_DEFAULT
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return L"Unreachable Warning Suppressor!!";
|
return L"Unreachable Warning Suppressor!!";
|
||||||
|
|
|
@ -25,6 +25,90 @@
|
||||||
#include "HostGui.h"
|
#include "HostGui.h"
|
||||||
#include "AppConfig.h"
|
#include "AppConfig.h"
|
||||||
|
|
||||||
|
using namespace Threading;
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------
|
||||||
|
// LoadPluginsTask
|
||||||
|
// --------------------------------------------------------------------------------------
|
||||||
|
// On completion the thread sends a pxEVT_LoadPluginsComplete message, which contains a
|
||||||
|
// handle to this thread object. If the load is successful, the Result var is set to
|
||||||
|
// non-NULL. If NULL, an error occurred and the thread loads the exception into either
|
||||||
|
// Ex_PluginError or Ex_RuntimeError.
|
||||||
|
//
|
||||||
|
class LoadPluginsTask : public Threading::PersistentThread
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Exception::PluginError* Ex_PluginError;
|
||||||
|
Exception::RuntimeError* Ex_RuntimeError;
|
||||||
|
PluginManager* Result;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxString m_folders[PluginId_Count];
|
||||||
|
|
||||||
|
public:
|
||||||
|
LoadPluginsTask( const wxString (&folders)[PluginId_Count] ) :
|
||||||
|
Ex_PluginError( NULL )
|
||||||
|
, Ex_RuntimeError( NULL )
|
||||||
|
, Result( NULL )
|
||||||
|
{
|
||||||
|
for(int i=0; i<PluginId_Count; ++i )
|
||||||
|
m_folders[i] = folders[i];
|
||||||
|
|
||||||
|
Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~LoadPluginsTask() throw();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int ExecuteTask();
|
||||||
|
};
|
||||||
|
|
||||||
|
static wxScopedPtr<LoadPluginsTask> _loadTask;
|
||||||
|
|
||||||
|
LoadPluginsTask::~LoadPluginsTask() throw()
|
||||||
|
{
|
||||||
|
_loadTask.release();
|
||||||
|
PersistentThread::Cancel();
|
||||||
|
_loadTask.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
int LoadPluginsTask::ExecuteTask()
|
||||||
|
{
|
||||||
|
wxGetApp().Ping();
|
||||||
|
Sleep(3);
|
||||||
|
|
||||||
|
wxCommandEvent evt( pxEVT_LoadPluginsComplete );
|
||||||
|
evt.SetClientData( this );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// This is for testing of the error handler... uncomment for fun?
|
||||||
|
//throw Exception::PluginError( PluginId_PAD, "This one is for testing the error handler!" );
|
||||||
|
|
||||||
|
Result = PluginManager_Create( m_folders );
|
||||||
|
}
|
||||||
|
catch( Exception::PluginError& ex )
|
||||||
|
{
|
||||||
|
Ex_PluginError = new Exception::PluginError( ex );
|
||||||
|
}
|
||||||
|
catch( Exception::RuntimeError& innerEx )
|
||||||
|
{
|
||||||
|
// Runtime errors are typically recoverable, so handle them here
|
||||||
|
// and prep them for re-throw on the main thread.
|
||||||
|
Ex_RuntimeError = new Exception::RuntimeError(
|
||||||
|
L"A runtime error occurred on the LoadPlugins thread.\n" + innerEx.FormatDiagnosticMessage(),
|
||||||
|
innerEx.FormatDisplayMessage()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// anything else leave unhandled so that the debugger catches it!
|
||||||
|
|
||||||
|
wxGetApp().AddPendingEvent( evt );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
int EnumeratePluginsInFolder( const wxDirName& searchpath, wxArrayString* dest )
|
int EnumeratePluginsInFolder( const wxDirName& searchpath, wxArrayString* dest )
|
||||||
{
|
{
|
||||||
wxScopedPtr<wxArrayString> placebo;
|
wxScopedPtr<wxArrayString> placebo;
|
||||||
|
@ -45,69 +129,29 @@ int EnumeratePluginsInFolder( const wxDirName& searchpath, wxArrayString* dest )
|
||||||
wxDir::GetAllFiles( searchpath.ToString(), realdest, wxsFormat( pattern, wxDynamicLibrary::GetDllExt()), wxDIR_FILES ) : 0;
|
wxDir::GetAllFiles( searchpath.ToString(), realdest, wxsFormat( pattern, wxDynamicLibrary::GetDllExt()), wxDIR_FILES ) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace Threading;
|
|
||||||
|
|
||||||
void Pcsx2App::OnReloadPlugins( wxCommandEvent& evt )
|
void Pcsx2App::OnReloadPlugins( wxCommandEvent& evt )
|
||||||
{
|
{
|
||||||
ReloadPlugins();
|
ReloadPlugins();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Pcsx2App::OnLoadPluginsComplete( wxCommandEvent& evt )
|
||||||
|
{
|
||||||
|
// scoped ptr ensures the thread object is cleaned up even on exception:
|
||||||
|
wxScopedPtr<LoadPluginsTask> killTask( (LoadPluginsTask*)evt.GetClientData() );
|
||||||
|
m_CorePlugins.reset( killTask->Result );
|
||||||
|
|
||||||
|
if( !m_CorePlugins )
|
||||||
|
{
|
||||||
|
if( killTask->Ex_PluginError != NULL )
|
||||||
|
throw *killTask->Ex_PluginError;
|
||||||
|
if( killTask->Ex_RuntimeError != NULL )
|
||||||
|
throw *killTask->Ex_RuntimeError; // Re-Throws generic threaded errors
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Pcsx2App::ReloadPlugins()
|
void Pcsx2App::ReloadPlugins()
|
||||||
{
|
{
|
||||||
class LoadPluginsTask : public Threading::BaseTaskThread
|
if( _loadTask ) return;
|
||||||
{
|
|
||||||
public:
|
|
||||||
PluginManager* Result;
|
|
||||||
Exception::PluginError* Ex_PluginError;
|
|
||||||
Exception::RuntimeError* Ex_RuntimeError;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const wxString (&m_folders)[PluginId_Count];
|
|
||||||
|
|
||||||
public:
|
|
||||||
LoadPluginsTask( const wxString (&folders)[PluginId_Count] ) :
|
|
||||||
Result( NULL )
|
|
||||||
, Ex_PluginError( NULL )
|
|
||||||
, Ex_RuntimeError( NULL )
|
|
||||||
, m_folders( folders )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~LoadPluginsTask() throw()
|
|
||||||
{
|
|
||||||
BaseTaskThread::Cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void Task()
|
|
||||||
{
|
|
||||||
wxGetApp().Ping();
|
|
||||||
Sleep(3);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//throw Exception::PluginError( PluginId_PAD, "This one is for testing the error handler!" );
|
|
||||||
Result = PluginManager_Create( m_folders );
|
|
||||||
}
|
|
||||||
catch( Exception::PluginError& ex )
|
|
||||||
{
|
|
||||||
Result = NULL;
|
|
||||||
Ex_PluginError = new Exception::PluginError( ex );
|
|
||||||
}
|
|
||||||
catch( Exception::RuntimeError& innerEx )
|
|
||||||
{
|
|
||||||
// Runtime errors are typically recoverable, so handle them here
|
|
||||||
// and prep them for re-throw on the main thread.
|
|
||||||
Result = NULL;
|
|
||||||
Ex_RuntimeError = new Exception::RuntimeError(
|
|
||||||
L"A runtime error occurred on the LoadPlugins thread.\n" + innerEx.FormatDiagnosticMessage(),
|
|
||||||
innerEx.FormatDisplayMessage()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// anything else leave unhandled so that the debugger catches it!
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
m_CoreThread.reset();
|
m_CoreThread.reset();
|
||||||
m_CorePlugins.reset();
|
m_CorePlugins.reset();
|
||||||
|
@ -123,41 +167,39 @@ void Pcsx2App::ReloadPlugins()
|
||||||
passins[pi->id] = g_Conf->FullpathTo( pi->id );
|
passins[pi->id] = g_Conf->FullpathTo( pi->id );
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadPluginsTask task( passins );
|
_loadTask.reset( new LoadPluginsTask( passins ) );
|
||||||
task.Start();
|
// ... and when it finishes it posts up a OnLoadPluginsComplete(). Bye. :)
|
||||||
task.PostTask();
|
|
||||||
task.WaitForResult();
|
|
||||||
|
|
||||||
if( task.Result == NULL )
|
|
||||||
{
|
|
||||||
if( task.Ex_PluginError != NULL )
|
|
||||||
throw *task.Ex_PluginError;
|
|
||||||
if( task.Ex_RuntimeError != NULL )
|
|
||||||
throw *task.Ex_RuntimeError; // Re-Throws generic threaded errors
|
|
||||||
}
|
|
||||||
|
|
||||||
m_CorePlugins.reset( task.Result );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Posts a message to the App to reload plugins. Plugins are loaded via a background thread
|
// Posts a message to the App to reload plugins. Plugins are loaded via a background thread
|
||||||
// which is started on a pending event, so don't expect them to be ready "right now."
|
// which is started on a pending event, so don't expect them to be ready "right now."
|
||||||
|
// If plugins are already loaded then no action is performed.
|
||||||
void LoadPluginsPassive()
|
void LoadPluginsPassive()
|
||||||
{
|
{
|
||||||
|
if( g_plugins ) return;
|
||||||
|
|
||||||
wxCommandEvent evt( pxEVT_ReloadPlugins );
|
wxCommandEvent evt( pxEVT_ReloadPlugins );
|
||||||
wxGetApp().AddPendingEvent( evt );
|
wxGetApp().AddPendingEvent( evt );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Blocks until plugins have been successfully loaded, or throws an exception if
|
// Blocks until plugins have been successfully loaded, or throws an exception if
|
||||||
// the user cancels the loading procedure after error.
|
// the user cancels the loading procedure after error. If plugins are already loaded
|
||||||
|
// then no action is performed.
|
||||||
void LoadPluginsImmediate()
|
void LoadPluginsImmediate()
|
||||||
{
|
{
|
||||||
wxASSERT( wxThread::IsMain() );
|
wxASSERT( wxThread::IsMain() );
|
||||||
|
if( g_plugins ) return;
|
||||||
|
|
||||||
static int _reentrant = 0;
|
static int _reentrant = 0;
|
||||||
EntryGuard guard( _reentrant );
|
EntryGuard guard( _reentrant );
|
||||||
|
|
||||||
wxASSERT( !guard.IsReentrant() );
|
wxASSERT( !guard.IsReentrant() );
|
||||||
wxGetApp().ReloadPlugins();
|
wxGetApp().ReloadPlugins();
|
||||||
|
while( _loadTask )
|
||||||
|
{
|
||||||
|
Sleep( 10 );
|
||||||
|
wxGetApp().ProcessPendingEvents();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnloadPlugins()
|
void UnloadPlugins()
|
||||||
|
|
Loading…
Reference in New Issue