diff --git a/pcsx2/PluginManager.cpp b/pcsx2/PluginManager.cpp index bd8d7f597..a1e5ab512 100644 --- a/pcsx2/PluginManager.cpp +++ b/pcsx2/PluginManager.cpp @@ -544,24 +544,24 @@ Exception::PluginLoadError::PluginLoadError( PluginsEnum_t pid, const wxString& wxString Exception::PluginLoadError::FormatDiagnosticMessage() const { - return wxsFormat( m_message_diag, tbl_PluginInfo[PluginId].GetShortname() ) + + return wxsFormat( m_message_diag, tbl_PluginInfo[PluginId].GetShortname().c_str() ) + L"\n\n" + StreamName; } wxString Exception::PluginLoadError::FormatDisplayMessage() const { - return wxsFormat( m_message_user, tbl_PluginInfo[PluginId].GetShortname() ) + + return wxsFormat( m_message_user, tbl_PluginInfo[PluginId].GetShortname().c_str() ) + L"\n\n" + StreamName; } wxString Exception::PluginError::FormatDiagnosticMessage() const { - return wxsFormat( m_message_diag, tbl_PluginInfo[PluginId].GetShortname() ); + return wxsFormat( m_message_diag, tbl_PluginInfo[PluginId].GetShortname().c_str() ); } wxString Exception::PluginError::FormatDisplayMessage() const { - return wxsFormat( m_message_user, tbl_PluginInfo[PluginId].GetShortname() ); + return wxsFormat( m_message_user, tbl_PluginInfo[PluginId].GetShortname().c_str() ); } ////////////////////////////////////////////////////////////////////////////////////////// @@ -698,14 +698,13 @@ static bool OpenPlugin_CDVD() static bool OpenPlugin_GS() { - if( !mtgsThread->IsSelf() ) + if( mtgsThread == NULL ) { - if( mtgsThread == NULL ) - mtgsOpen(); // mtgsOpen raises its own exception on error - + mtgsOpen(); // mtgsOpen raises its own exception on error return true; } - else + + if( mtgsThread->IsSelf() ) return !GSopen( (void*)&pDsp, "PCSX2", renderswitch ? 2 : 1 ); // Note: rederswitch is us abusing the isMultiThread parameter for that so diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index 3a5e470e7..68172d923 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -181,7 +181,7 @@ protected: void CleanupMess(); void OpenWizardConsole(); - int MainLoop(); + void HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& event) const; // ---------------------------------------------------------------------------- // Override wx default exception handling behavior diff --git a/pcsx2/gui/ConsoleLogger.cpp b/pcsx2/gui/ConsoleLogger.cpp index b39076e9e..e3b0347db 100644 --- a/pcsx2/gui/ConsoleLogger.cpp +++ b/pcsx2/gui/ConsoleLogger.cpp @@ -577,7 +577,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( L"PCSX2 > ", stdout ); + fputs( "PCSX2 > ", stdout ); fputs( src, stdout ); #endif diff --git a/pcsx2/gui/main.cpp b/pcsx2/gui/main.cpp index 20c85009a..c8a40c4e4 100644 --- a/pcsx2/gui/main.cpp +++ b/pcsx2/gui/main.cpp @@ -307,78 +307,28 @@ void Pcsx2App::CleanupMess() safe_delete( g_Conf ); } -static int pxRunningEventLoopCount = 0; - -class pxEvtLoop : public wxEventLoop +void Pcsx2App::HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& event) const { -protected: - struct pxRunningEventLoopCounter + try { - pxRunningEventLoopCounter() { pxRunningEventLoopCount++; } - ~pxRunningEventLoopCounter() { pxRunningEventLoopCount--; } - }; - -public: - virtual int Run() - { - // event loops are not recursive, you need to create another loop! - wxCHECK_MSG( !IsRunning(), -1, _T("can't reenter a message loop") ); - - wxEventLoopActivator activate(wx_static_cast(wxEventLoop *, this)); - -#if defined(__WXMSW__) && wxUSE_THREADS - pxRunningEventLoopCounter evtLoopCounter; -#endif // __WXMSW__ - - while( true ) - { - try - { - while( !m_shouldExit ) - { - // give ourselves the possibility to do whatever we want! - OnNextIteration(); - - while( Pending() ) - { - if( !Dispatch() ) - { - m_shouldExit = true; - break; - } - } - - if( wxTheApp ) - wxTheApp->ProcessIdle(); - } - break; - } - // ---------------------------------------------------------------------------- - catch( Exception::PluginError& ex ) - { - } - // ---------------------------------------------------------------------------- - catch( Exception::RuntimeError& ex ) - { - // Runtime errors which have been unhandled should still be safe to recover from, - // so lets issue a message to the user and then continue the message pump. - - Console::Error( ex.FormatDiagnosticMessage() ); - Msgbox::Alert( ex.FormatDisplayMessage() ); - } - } + (handler->*func)(event); } -}; + // ---------------------------------------------------------------------------- + catch( Exception::PluginError& ex ) + { + } + // ---------------------------------------------------------------------------- + catch( Exception::RuntimeError& ex ) + { + // Runtime errors which have been unhandled should still be safe to recover from, + // so lets issue a message to the user and then continue the message pump. -// This overload performs universal exception handling for specific types of recoverable -// errors that can be thrown from a multitude of events. -int Pcsx2App::MainLoop() -{ - assert( m_mainLoop == NULL ); - m_mainLoop = new pxEvtLoop(); - return m_mainLoop->Run(); + Console::Error( ex.FormatDiagnosticMessage() ); + Msgbox::Alert( ex.FormatDisplayMessage() ); + } } + // Common exit handler which can be called from any event (though really it should // be called only from CloseWindow handlers since that's the more appropriate way // to handle window closures)