Two more lockup fixes, and changing plugins takes effect without restarting now. :)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1801 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-09-09 16:52:11 +00:00
parent 8eb8f1bcea
commit 7f0039d646
9 changed files with 48 additions and 30 deletions

View File

@ -46,17 +46,6 @@ namespace Exception
public:
virtual ~BaseException() throw()=0; // the =0; syntax forces this class into "abstract" mode.
/*
// copy construct
BaseException( const BaseException& src ) :
m_message_diag( src.m_message_diag ),
m_message_user( src.m_message_user ),
m_stacktrace( src.m_stacktrace )
{ }
// trivial constructor, to appease the C++ multiple virtual inheritence gods. (CMVIGs!)
BaseException() {}*/
const wxString& DiagMsg() const { return m_message_diag; }
const wxString& UserMsg() const { return m_message_user; }

View File

@ -22,7 +22,6 @@ using namespace std;
namespace Console
{
MutexLock m_writelock;
std::string m_format_buffer;
bool __fastcall Write( Colors color, const wxString& fmt )
{
@ -44,14 +43,14 @@ namespace Console
// ------------------------------------------------------------------------
__forceinline void __fastcall _Write( const char* fmt, va_list args )
{
ScopedLock locker( m_writelock );
std::string m_format_buffer;
vssprintf( m_format_buffer, fmt, args );
Write( wxString::FromUTF8( m_format_buffer.c_str() ) );
}
__forceinline void __fastcall _WriteLn( const char* fmt, va_list args )
{
ScopedLock locker( m_writelock );
std::string m_format_buffer;
vssprintf( m_format_buffer, fmt, args );
m_format_buffer += "\n";
Write( wxString::FromUTF8( m_format_buffer.c_str() ) );

View File

@ -226,6 +226,7 @@ void mtgsThreadObject::Cancel()
{
//SendSimplePacket( GS_RINGTYPE_QUIT, 0, 0, 0 );
//SetEvent();
//m_sem_finished.WaitGui();
PersistentThread::Cancel();
}

View File

@ -378,7 +378,7 @@ void SysReset()
{
Console::Status( "Resetting PS2 virtual machine..." );
SysShutdown();
SysEndExecution();
StateRecovery::Clear();
ElfCRC = 0;

View File

@ -260,7 +260,7 @@ public:
void PostMenuAction( MenuIdentifiers menu_id ) const;
void Ping() const;
void ApplySettings();
void ApplySettings( const AppConfig& newconf );
void LoadSettings();
void SaveSettings();
@ -305,7 +305,7 @@ protected:
void OnSemaphorePing( wxCommandEvent& evt );
void OnMessageBox( pxMessageBoxEvent& evt );
void OnKeyDown( wxKeyEvent& evt );
void OnEmuKeyDown( wxKeyEvent& evt );
// ----------------------------------------------------------------------------
// Override wx default exception handling behavior

View File

@ -457,7 +457,7 @@ void AppConfig::Apply()
Folders.Savestates.Mkdir();
Folders.Snapshots.Mkdir();
g_Conf->EmuOptions.BiosFilename = g_Conf->FullpathToBios();
EmuOptions.BiosFilename = FullpathToBios();
// Update the compression attribute on the Memcards folder.
// Memcards generally compress very well via NTFS compression.
@ -596,7 +596,7 @@ void AppConfig_ReloadGlobalSettings( bool overwrite )
if( !overwrite )
wxGetApp().LoadSettings();
wxGetApp().ApplySettings();
wxGetApp().ApplySettings( *g_Conf );
g_Conf->Folders.Logs.Mkdir();
wxString newlogname( Path::Combine( g_Conf->Folders.Logs.ToString(), L"emuLog.txt" ) );

View File

@ -53,8 +53,13 @@ static wxString GetGSStateFilename()
return Path::Combine( g_Conf->Folders.Savestates, wxsFormat( L"/%8.8X.%d.gs", ElfCRC, StatesC ) );
}
void Pcsx2App::OnKeyDown( wxKeyEvent& evt )
// This handles KeyDown messages from the emu/gs window.
void Pcsx2App::OnEmuKeyDown( wxKeyEvent& evt )
{
// Block "Stray" messages, which get sent after the emulation state has been killed off.
// (happens when user hits multiple keys quickly before the emu thread can respond)
if( !EmulationInProgress() ) return;
switch( evt.GetKeyCode() )
{
case WXK_ESCAPE:

View File

@ -78,9 +78,8 @@ bool Panels::StaticApplyState::ApplyPage( int pageid, bool saveOnSuccess )
// If an exception is thrown above, this code below won't get run.
// (conveniently skipping any option application! :D)
*g_Conf = confcopy;
UseAdminMode = g_ApplyState.UseAdminMode;
wxGetApp().ApplySettings();
wxGetApp().ApplySettings( confcopy );
if( saveOnSuccess )
wxGetApp().SaveSettings();
}

View File

@ -375,7 +375,7 @@ bool Pcsx2App::OnInit()
Connect( pxEVT_CallStackBox, pxMessageBoxEventThing( Pcsx2App::OnMessageBox ) );
Connect( pxEVT_SemaphorePing, wxCommandEventHandler( Pcsx2App::OnSemaphorePing ) );
Connect( pxID_Window_GS, wxEVT_KEY_DOWN, wxKeyEventHandler( Pcsx2App::OnKeyDown ) );
Connect( pxID_Window_GS, wxEVT_KEY_DOWN, wxKeyEventHandler( Pcsx2App::OnEmuKeyDown ) );
// User/Admin Mode Dual Setup:
// Pcsx2 now supports two fundamental modes of operation. The default is Classic mode,
@ -410,7 +410,7 @@ bool Pcsx2App::OnInit()
m_MainFrame->Show();
SysInit();
ApplySettings();
ApplySettings( *g_Conf );
InitPlugins();
}
// ----------------------------------------------------------------------------
@ -511,20 +511,23 @@ void Pcsx2App::HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent&
// to handle window closures)
bool Pcsx2App::PrepForExit()
{
SysShutdown();
MemoryCard::Shutdown();
CleanupMess();
m_ProgramLogBox = NULL;
m_MainFrame = NULL;
return true;
}
int Pcsx2App::OnExit()
{
m_ProgramLogBox = NULL;
m_MainFrame = NULL;
MemoryCard::Shutdown();
PrepForExit();
if( g_Conf != NULL )
SaveSettings();
CleanupMess();
return wxApp::OnExit();
}
@ -547,8 +550,30 @@ Pcsx2App::~Pcsx2App()
}
void Pcsx2App::ApplySettings()
void Pcsx2App::ApplySettings( const AppConfig& newconf )
{
if( &newconf != g_Conf )
{
// Need to unload the current emulation state if the user changed plugins, because
// the whole plugin system needs to be re-loaded.
const PluginInfo* pi = tbl_PluginInfo-1;
while( ++pi, pi->shortname != NULL )
{
if( newconf.FullpathTo( pi->id ) != g_Conf->FullpathTo( pi->id ) )
break;
}
if( pi->shortname != NULL )
{
// [TODO] : Post notice that this shuts down existing emulation.
SysEndExecution();
safe_delete( g_plugins );
LoadPlugins();
}
*g_Conf = newconf;
}
g_Conf->Apply();
if( m_MainFrame != NULL )
m_MainFrame->ApplySettings();