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.
|
||||
:: 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
|
||||
{
|
||||
if (!m_running) return false;
|
||||
|
||||
if( !!m_detached )
|
||||
return !!m_running;
|
||||
else
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_workspace_file>
|
||||
<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/Utilities/Utilities.cbp" />
|
||||
<Depends filename="3rdparty/zlib/zlib.cbp" />
|
||||
|
@ -22,6 +22,6 @@
|
|||
<Project filename="plugins/onepad/Linux/OnePad.cbp" />
|
||||
<Project filename="plugins/zerogs/opengl/Linux/ZeroGS.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>
|
||||
</CodeBlocks_workspace_file>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
||||
*
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
|
@ -52,7 +52,7 @@ extern int FOreadpos;
|
|||
void __fastcall ReadFIFO_page_4(u32 mem, u64 *out)
|
||||
{
|
||||
jASSUME( (mem >= VIF0_FIFO) && (mem < VIF1_FIFO) );
|
||||
|
||||
|
||||
VIF_LOG("ReadFIFO/VIF0 0x%08X", mem);
|
||||
//out[0] = psHu64(mem );
|
||||
//out[1] = psHu64(mem+8);
|
||||
|
@ -93,7 +93,7 @@ void __fastcall ReadFIFO_page_6(u32 mem, u64 *out)
|
|||
//out[1] = psHu64(mem+8);
|
||||
|
||||
out[0] = psHu64(0x6000);
|
||||
out[1] = psHu64(0x6008);
|
||||
out[1] = psHu64(0x6008);
|
||||
}
|
||||
|
||||
void __fastcall ReadFIFO_page_7(u32 mem, u64 *out)
|
||||
|
@ -126,24 +126,24 @@ void __fastcall WriteFIFO_page_4(u32 mem, const mem128_t *value)
|
|||
jASSUME( (mem >= VIF0_FIFO) && (mem < VIF1_FIFO) );
|
||||
|
||||
VIF_LOG("WriteFIFO/VIF0, addr=0x%08X", mem);
|
||||
|
||||
|
||||
//psHu64(mem ) = value[0];
|
||||
//psHu64(mem+8) = value[1];
|
||||
|
||||
psHu64(0x4000) = value[0];
|
||||
psHu64(0x4008) = value[1];
|
||||
|
||||
|
||||
vif0ch->qwc += 1;
|
||||
int ret = VIF0transfer((u32*)value, 4, 0);
|
||||
assert( ret == 0 ); // vif stall code not implemented
|
||||
}
|
||||
|
||||
|
||||
void __fastcall WriteFIFO_page_5(u32 mem, const mem128_t *value)
|
||||
{
|
||||
jASSUME( (mem >= VIF1_FIFO) && (mem < GIF_FIFO) );
|
||||
|
||||
VIF_LOG("WriteFIFO/VIF1, addr=0x%08X", mem);
|
||||
|
||||
|
||||
//psHu64(mem ) = value[0];
|
||||
//psHu64(mem+8) = value[1];
|
||||
|
||||
|
@ -175,14 +175,14 @@ void __fastcall WriteFIFO_page_6(u32 mem, const mem128_t *value)
|
|||
psHu64(0x6008) = value[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();
|
||||
data[0] = value[0];
|
||||
data[1] = value[1];
|
||||
mtgsThread->SendDataPacket();
|
||||
FreezeRegs(0);
|
||||
}
|
||||
|
||||
|
||||
void __fastcall WriteFIFO_page_7(u32 mem, const mem128_t *value)
|
||||
{
|
||||
jASSUME( (mem >= IPUout_FIFO) && (mem < D0_CHCR) );
|
||||
|
|
|
@ -282,6 +282,7 @@
|
|||
<Unit filename="../gui/Dialogs/LogOptionsDialog.h" />
|
||||
<Unit filename="../gui/Dialogs/ModalPopups.h" />
|
||||
<Unit filename="../gui/Dialogs/PickUserModeDialog.cpp" />
|
||||
<Unit filename="../gui/FrameForGS.cpp" />
|
||||
<Unit filename="../gui/HostGui.cpp" />
|
||||
<Unit filename="../gui/IniInterface.cpp" />
|
||||
<Unit filename="../gui/IniInterface.h" />
|
||||
|
|
330
pcsx2/VifDma.cpp
330
pcsx2/VifDma.cpp
File diff suppressed because it is too large
Load Diff
|
@ -36,6 +36,7 @@ BEGIN_DECLARE_EVENT_TYPES()
|
|||
DECLARE_EVENT_TYPE( pxEVT_SemaphorePing, -1 )
|
||||
DECLARE_EVENT_TYPE( pxEVT_OpenModalDialog, -1 )
|
||||
DECLARE_EVENT_TYPE( pxEVT_ReloadPlugins, -1 )
|
||||
DECLARE_EVENT_TYPE( pxEVT_LoadPluginsComplete, -1 )
|
||||
END_DECLARE_EVENT_TYPES()
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -365,6 +366,7 @@ protected:
|
|||
void HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& event) const;
|
||||
|
||||
void OnReloadPlugins( wxCommandEvent& evt );
|
||||
void OnLoadPluginsComplete( wxCommandEvent& evt );
|
||||
void OnSemaphorePing( wxCommandEvent& evt );
|
||||
void OnOpenModalDialog( wxCommandEvent& evt );
|
||||
void OnMessageBox( pxMessageBoxEvent& evt );
|
||||
|
|
|
@ -27,13 +27,14 @@
|
|||
|
||||
#include <wx/cmdline.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/evtloop.h>
|
||||
#include <wx/intl.h>
|
||||
|
||||
IMPLEMENT_APP(Pcsx2App)
|
||||
|
||||
DEFINE_EVENT_TYPE( pxEVT_SemaphorePing );
|
||||
DEFINE_EVENT_TYPE( pxEVT_OpenModalDialog );
|
||||
DEFINE_EVENT_TYPE( pxEVT_ReloadPlugins );
|
||||
DEFINE_EVENT_TYPE( pxEVT_LoadPluginsComplete );
|
||||
|
||||
bool UseAdminMode = false;
|
||||
wxDirName SettingsFolder;
|
||||
|
@ -427,6 +428,7 @@ bool Pcsx2App::OnInit()
|
|||
Connect( pxEVT_SemaphorePing, wxCommandEventHandler( Pcsx2App::OnSemaphorePing ) );
|
||||
Connect( pxEVT_OpenModalDialog, wxCommandEventHandler( Pcsx2App::OnOpenModalDialog ) );
|
||||
Connect( pxEVT_ReloadPlugins, wxCommandEventHandler( Pcsx2App::OnReloadPlugins ) );
|
||||
Connect( pxEVT_LoadPluginsComplete, wxCommandEventHandler( Pcsx2App::OnLoadPluginsComplete ) );
|
||||
|
||||
Connect( pxID_Window_GS, wxEVT_KEY_DOWN, wxKeyEventHandler( Pcsx2App::OnEmuKeyDown ) );
|
||||
|
||||
|
@ -630,12 +632,13 @@ void Pcsx2App::OnMessageBox( pxMessageBoxEvent& evt )
|
|||
Msgbox::OnEvent( evt );
|
||||
}
|
||||
|
||||
#include <wx/intl.h>
|
||||
|
||||
void Pcsx2App::CleanupMess()
|
||||
{
|
||||
m_CorePlugins->Close();
|
||||
m_CorePlugins->Shutdown();
|
||||
if( m_CorePlugins )
|
||||
{
|
||||
m_CorePlugins->Close();
|
||||
m_CorePlugins->Shutdown();
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
@ -768,7 +771,7 @@ void Pcsx2App::LoadSettings()
|
|||
IniLoader loader( *conf );
|
||||
g_Conf->LoadSave( loader );
|
||||
|
||||
if( m_MainFrame != NULL )
|
||||
if( m_MainFrame != NULL && m_MainFrame->m_RecentIsoList )
|
||||
m_MainFrame->m_RecentIsoList->Load( *conf );
|
||||
}
|
||||
|
||||
|
@ -780,6 +783,6 @@ void Pcsx2App::SaveSettings()
|
|||
IniSaver saver( *conf );
|
||||
g_Conf->LoadSave( saver );
|
||||
|
||||
if( m_MainFrame != NULL )
|
||||
if( m_MainFrame != NULL && m_MainFrame->m_RecentIsoList )
|
||||
m_MainFrame->m_RecentIsoList->Save( *conf );
|
||||
}
|
||||
|
|
|
@ -574,7 +574,7 @@ namespace Console
|
|||
// [TODO] make this a configurable option? Do we care? :)
|
||||
#ifdef __LINUX__
|
||||
// puts does automatic newlines, which we don't want here
|
||||
fputs( "PCSX2 > ", stdout );
|
||||
//fputs( "PCSX2 > ", stdout );
|
||||
fputs( src, stdout );
|
||||
#endif
|
||||
|
||||
|
@ -635,6 +635,7 @@ namespace Console
|
|||
bool __fastcall WriteLn( const wxString& fmt )
|
||||
{
|
||||
const wxString fmtline( fmt + L"\n" );
|
||||
_immediate_logger( "PCSX2 > ");
|
||||
_immediate_logger( fmtline );
|
||||
|
||||
if( emuLog != NULL )
|
||||
|
|
|
@ -432,11 +432,8 @@ MainEmuFrame::~MainEmuFrame() throw()
|
|||
{
|
||||
try
|
||||
{
|
||||
if( m_RecentIsoList != NULL )
|
||||
{
|
||||
if( m_RecentIsoList )
|
||||
m_RecentIsoList->Save( *wxConfigBase::Get( false ) );
|
||||
safe_delete( m_RecentIsoList );
|
||||
}
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
@ -450,10 +447,10 @@ void MainEmuFrame::ApplySettings()
|
|||
wxConfigBase* cfg = wxConfigBase::Get( false );
|
||||
wxASSERT( cfg != NULL );
|
||||
|
||||
if( m_RecentIsoList != NULL )
|
||||
if( m_RecentIsoList )
|
||||
m_RecentIsoList->Save( *cfg );
|
||||
safe_delete( m_RecentIsoList );
|
||||
m_RecentIsoList = new wxFileHistory( g_Conf->RecentFileCount );
|
||||
m_RecentIsoList.reset();
|
||||
m_RecentIsoList.reset( new wxFileHistory( g_Conf->RecentFileCount ) );
|
||||
m_RecentIsoList->Load( *cfg );
|
||||
|
||||
UpdateIsoSrcFile();
|
||||
|
|
|
@ -37,7 +37,7 @@ class MainEmuFrame : public wxFrame
|
|||
// ------------------------------------------------------------------------
|
||||
|
||||
protected:
|
||||
wxFileHistory* m_RecentIsoList;
|
||||
wxScopedPtr<wxFileHistory> m_RecentIsoList;
|
||||
wxStatusBar& m_statusbar;
|
||||
wxStaticBitmap m_background;
|
||||
|
||||
|
|
|
@ -144,13 +144,15 @@ void MainEmuFrame::Menu_OpenELF_Click(wxCommandEvent &event)
|
|||
void MainEmuFrame::Menu_LoadStates_Click(wxCommandEvent &event)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
||||
*
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
|
@ -297,7 +297,7 @@ void Panels::PluginSelectorPanel::Apply()
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Make sure folders are up to date, and try to load/reload plugins if needed...
|
||||
|
||||
|
||||
g_Conf->Folders.ApplyDefaults();
|
||||
|
||||
// Need to unload the current emulation state if the user changed plugins, because
|
||||
|
@ -340,7 +340,7 @@ void Panels::PluginSelectorPanel::Apply()
|
|||
wxsFormat( L"The selected %s plugin failed to load.", plugname.c_str() ) + L"\n\n" + GetApplyFailedMsg()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Panels::PluginSelectorPanel::CancelRefresh()
|
||||
|
@ -416,7 +416,7 @@ void Panels::PluginSelectorPanel::OnConfigure_Clicked( wxCommandEvent& evt )
|
|||
wxDynamicLibrary dynlib( (*m_FileList)[(int)m_ComponentBoxes.Get(pid).GetClientData(sel)] );
|
||||
if( PluginConfigureFnptr configfunc = (PluginConfigureFnptr)dynlib.GetSymbol( tbl_PluginInfo[pid].GetShortname() + L"configure" ) )
|
||||
{
|
||||
ScopedWindowDisable disabler( wxGetTopLevelParent( this ) );
|
||||
wxWindowDisabler disabler;
|
||||
configfunc();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
||||
*
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
|
@ -47,7 +47,8 @@ const wxChar* Panels::SpeedHacksPanel::GetEEcycleSliderMsg( int val )
|
|||
L"audio on many FMVs."
|
||||
);
|
||||
|
||||
jNO_DEFAULT
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
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"visuals or slowdown in most games."
|
||||
);
|
||||
|
||||
jNO_DEFAULT
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return L"Unreachable Warning Suppressor!!";
|
||||
|
@ -172,7 +173,7 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
|
|||
L"Uses SSE's Min/Max Floating Point Operations instead of custom logical Min/Max routines. "
|
||||
L"Known to break Gran Tourismo 4, Tekken 5."
|
||||
) );
|
||||
|
||||
|
||||
m_check_vuMinMax->SetValue(opts.vuMinMax);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
|
|
@ -25,6 +25,90 @@
|
|||
#include "HostGui.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 )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
using namespace Threading;
|
||||
|
||||
void Pcsx2App::OnReloadPlugins( wxCommandEvent& evt )
|
||||
{
|
||||
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()
|
||||
{
|
||||
class LoadPluginsTask : public Threading::BaseTaskThread
|
||||
{
|
||||
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!
|
||||
}
|
||||
};
|
||||
if( _loadTask ) return;
|
||||
|
||||
m_CoreThread.reset();
|
||||
m_CorePlugins.reset();
|
||||
|
@ -123,41 +167,39 @@ void Pcsx2App::ReloadPlugins()
|
|||
passins[pi->id] = g_Conf->FullpathTo( pi->id );
|
||||
}
|
||||
|
||||
LoadPluginsTask task( passins );
|
||||
task.Start();
|
||||
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 );
|
||||
_loadTask.reset( new LoadPluginsTask( passins ) );
|
||||
// ... and when it finishes it posts up a OnLoadPluginsComplete(). Bye. :)
|
||||
}
|
||||
|
||||
// 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."
|
||||
// If plugins are already loaded then no action is performed.
|
||||
void LoadPluginsPassive()
|
||||
{
|
||||
if( g_plugins ) return;
|
||||
|
||||
wxCommandEvent evt( pxEVT_ReloadPlugins );
|
||||
wxGetApp().AddPendingEvent( evt );
|
||||
}
|
||||
|
||||
// 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()
|
||||
{
|
||||
wxASSERT( wxThread::IsMain() );
|
||||
if( g_plugins ) return;
|
||||
|
||||
static int _reentrant = 0;
|
||||
EntryGuard guard( _reentrant );
|
||||
|
||||
wxASSERT( !guard.IsReentrant() );
|
||||
wxGetApp().ReloadPlugins();
|
||||
while( _loadTask )
|
||||
{
|
||||
Sleep( 10 );
|
||||
wxGetApp().ProcessPendingEvents();
|
||||
}
|
||||
}
|
||||
|
||||
void UnloadPlugins()
|
||||
|
|
Loading…
Reference in New Issue