mirror of https://github.com/PCSX2/pcsx2.git
wxgui:
* Improved thread safety of file logger (needs work yet) * Debug builds automatically open the console log during the first time wizard. * Added terminal logging to linux builds. * Linux: Bugfixed plugin configuration dialogs being unable to receive input. git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1725 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
25a31e3a03
commit
600f7b2207
|
@ -179,6 +179,7 @@ protected:
|
|||
bool TryOpenConfigCwd();
|
||||
void OnMessageBox( pxMessageBoxEvent& evt );
|
||||
void CleanupMess();
|
||||
void OpenWizardConsole();
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -314,9 +314,22 @@ void ConsoleLogFrame::ClearColor()
|
|||
|
||||
void ConsoleLogFrame::Write( const wxString& text )
|
||||
{
|
||||
// Many platforms still do not provide thread-safe implementations of
|
||||
// fputs or printf, so they need to be implemented here.
|
||||
// fixme: these really should go in the global message handler but I haven't time to
|
||||
// do that right now.
|
||||
if( emuLog != NULL )
|
||||
fputs( text.ToUTF8().data(), emuLog );
|
||||
|
||||
// Linux has a handy dandy universal console...
|
||||
// [TODO] make this a configurable option? Do we care? :)
|
||||
#ifdef __LINUX__
|
||||
printf( (L"PCSX2 > " + text).ToUTF8().data() );
|
||||
#endif
|
||||
|
||||
// remove selection (WriteText is in fact ReplaceSelection)
|
||||
// TODO : Optimize this to only replaceslection if some selection
|
||||
// messages have been recieved since the last write.
|
||||
// TODO : Optimize this to only replace selection if some selection
|
||||
// messages have been received since the last write.
|
||||
|
||||
#ifdef __WXMSW__
|
||||
wxTextPos nLen = m_TextCtrl.GetLastPosition();
|
||||
|
@ -351,7 +364,7 @@ void ConsoleLogFrame::DoClose()
|
|||
{
|
||||
// instead of closing just hide the window to be able to Show() it later
|
||||
Show(false);
|
||||
if( wxFrame* main = wxGetApp().GetMainWindow() )
|
||||
if( wxWindow* main = GetParent() )
|
||||
wxStaticCast( main, MainEmuFrame )->OnLogBoxHidden();
|
||||
}
|
||||
|
||||
|
@ -378,7 +391,7 @@ void ConsoleLogFrame::OnMoveAround( wxMoveEvent& evt )
|
|||
// Docking check! If the window position is within some amount
|
||||
// of the main window, enable docking.
|
||||
|
||||
if( wxFrame* main = wxGetApp().GetMainWindow() )
|
||||
if( wxWindow* main = GetParent() )
|
||||
{
|
||||
wxPoint topright( main->GetRect().GetTopRight() );
|
||||
wxRect snapzone( topright - wxSize( 8,8 ), wxSize( 16,16 ) );
|
||||
|
@ -580,9 +593,6 @@ namespace Console
|
|||
|
||||
bool Newline()
|
||||
{
|
||||
if( emuLog != NULL )
|
||||
fputs( "\n", emuLog );
|
||||
|
||||
wxCommandEvent evt( wxEVT_LOG_Newline );
|
||||
wxGetApp().ProgramLog_PostEvent( evt );
|
||||
wxGetApp().ProgramLog_CountMsg();
|
||||
|
@ -592,9 +602,6 @@ namespace Console
|
|||
|
||||
bool __fastcall Write( const char* fmt )
|
||||
{
|
||||
if( emuLog != NULL )
|
||||
fputs( fmt, emuLog );
|
||||
|
||||
wxCommandEvent evt( wxEVT_LOG_Write );
|
||||
evt.SetString( wxString::FromAscii( fmt ) );
|
||||
evt.SetExtraLong( th_CurrentColor );
|
||||
|
@ -606,9 +613,6 @@ namespace Console
|
|||
|
||||
bool __fastcall Write( const wxString& fmt )
|
||||
{
|
||||
if( emuLog != NULL )
|
||||
fputs( fmt.ToAscii().data(), emuLog );
|
||||
|
||||
wxCommandEvent evt( wxEVT_LOG_Write );
|
||||
evt.SetString( fmt );
|
||||
evt.SetExtraLong( th_CurrentColor );
|
||||
|
@ -623,12 +627,6 @@ namespace Console
|
|||
// Implementation note: I've duplicated Write+Newline behavior here to avoid polluting
|
||||
// the message pump with lots of erroneous messages (Newlines can be bound into Write message).
|
||||
|
||||
if( emuLog != NULL )
|
||||
{
|
||||
fputs( fmt, emuLog );
|
||||
fputs( "\n", emuLog );
|
||||
}
|
||||
|
||||
wxCommandEvent evt( wxEVT_LOG_Write );
|
||||
evt.SetString( wxString::FromAscii( fmt ) + L"\n" );
|
||||
evt.SetExtraLong( th_CurrentColor );
|
||||
|
@ -643,12 +641,6 @@ namespace Console
|
|||
// Implementation note: I've duplicated Write+Newline behavior here to avoid polluting
|
||||
// the message pump with lots of erroneous messages (Newlines can be bound into Write message).
|
||||
|
||||
if( emuLog != NULL )
|
||||
{
|
||||
fputs( fmt.ToAscii().data(), emuLog );
|
||||
fputs( "\n", emuLog );
|
||||
}
|
||||
|
||||
wxCommandEvent evt( wxEVT_LOG_Write );
|
||||
evt.SetString( fmt + L"\n" );
|
||||
evt.SetExtraLong( th_CurrentColor );
|
||||
|
|
|
@ -341,7 +341,11 @@ void Panels::PluginSelectorPanel::OnConfigure_Clicked( wxCommandEvent& evt )
|
|||
if( sel == wxNOT_FOUND ) return;
|
||||
wxDynamicLibrary dynlib( (*m_FileList)[(int)m_ComponentBoxes.Get(pid).GetClientData(sel)] );
|
||||
if( PluginConfigureFnptr configfunc = (PluginConfigureFnptr)dynlib.GetSymbol( tbl_PluginInfo[pid].GetShortname() + L"configure" ) )
|
||||
{
|
||||
wxGetTopLevelParent( this )->Disable();
|
||||
configfunc();
|
||||
wxGetTopLevelParent( this )->Enable();
|
||||
}
|
||||
}
|
||||
|
||||
void Panels::PluginSelectorPanel::OnEnumComplete( wxCommandEvent& evt )
|
||||
|
@ -432,12 +436,16 @@ void Panels::PluginSelectorPanel::EnumThread::Cancel()
|
|||
|
||||
sptr Panels::PluginSelectorPanel::EnumThread::ExecuteTask()
|
||||
{
|
||||
DevCon::WriteLn( "Plugin Enumeration Thread started..." );
|
||||
|
||||
Sleep( 10 ); // gives the gui thread some time to refresh
|
||||
|
||||
for( int curidx=0; curidx < m_master.FileCount(); ++curidx )
|
||||
{
|
||||
if( m_cancel ) return 0;
|
||||
|
||||
Results[curidx].TypeMask = 0;
|
||||
|
||||
try
|
||||
{
|
||||
PluginEnumerator penum( m_master.GetFilename( curidx ) );
|
||||
|
@ -457,6 +465,7 @@ sptr Panels::PluginSelectorPanel::EnumThread::ExecuteTask()
|
|||
catch( Exception::BadStream& ex )
|
||||
{
|
||||
Console::Status( ex.FormatDiagnosticMessage() );
|
||||
|
||||
}
|
||||
|
||||
pthread_testcancel();
|
||||
|
@ -469,5 +478,6 @@ sptr Panels::PluginSelectorPanel::EnumThread::ExecuteTask()
|
|||
wxCommandEvent done( wxEVT_EnumerationFinished );
|
||||
m_master.GetEventHandler()->AddPendingEvent( done );
|
||||
|
||||
DevCon::WriteLn( "Plugin Enumeration Thread complete!" );
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -125,6 +125,13 @@ wxFrame* Pcsx2App::GetMainWindow() const { return m_MainFrame; }
|
|||
|
||||
#include "HashMap.h"
|
||||
|
||||
void Pcsx2App::OpenWizardConsole()
|
||||
{
|
||||
if( !IsDebugBuild ) return;
|
||||
g_Conf->ProgLogBox.Visible = true;
|
||||
m_ProgramLogBox = new ConsoleLogFrame( NULL, L"PCSX2 Program Log", g_Conf->ProgLogBox );
|
||||
}
|
||||
|
||||
// User mode settings can't be stores in the CWD for two reasons:
|
||||
// (a) the user may not have permission to do so (most obvious)
|
||||
// (b) it would result in sloppy usermode.ini found all over a hard drive if people runs the
|
||||
|
@ -151,6 +158,7 @@ void Pcsx2App::ReadUserModeSettings()
|
|||
if( !conf_usermode->HasGroup( groupname ) )
|
||||
{
|
||||
// first time startup, so give the user the choice of user mode:
|
||||
OpenWizardConsole();
|
||||
FirstTimeWizard wiz( NULL );
|
||||
if( !wiz.RunWizard( wiz.GetUsermodePage() ) )
|
||||
throw Exception::StartupAborted( L"Startup aborted: User canceled FirstTime Wizard." );
|
||||
|
@ -174,6 +182,7 @@ void Pcsx2App::ReadUserModeSettings()
|
|||
// user wiped their pcsx2.ini -- needs a reconfiguration via wizard!
|
||||
// (we skip the first page since it's a usermode.ini thing)
|
||||
|
||||
OpenWizardConsole();
|
||||
FirstTimeWizard wiz( NULL );
|
||||
if( !wiz.RunWizard( wiz.GetPostUsermodePage() ) )
|
||||
throw Exception::StartupAborted( L"Startup aborted: User canceled Configuration Wizard." );
|
||||
|
@ -255,7 +264,15 @@ bool Pcsx2App::OnInit()
|
|||
AppConfig_ReloadGlobalSettings();
|
||||
|
||||
m_MainFrame = new MainEmuFrame( NULL, L"PCSX2" );
|
||||
|
||||
if( m_ProgramLogBox )
|
||||
{
|
||||
delete m_ProgramLogBox;
|
||||
g_Conf->ProgLogBox.Visible = true;
|
||||
}
|
||||
|
||||
m_ProgramLogBox = new ConsoleLogFrame( m_MainFrame, L"PCSX2 Program Log", g_Conf->ProgLogBox );
|
||||
|
||||
m_Ps2ConLogBox = m_ProgramLogBox; // just use a single logger for now.
|
||||
//m_Ps2ConLogBox = new ConsoleLogFrame( NULL, L"PS2 Console Log" );
|
||||
|
||||
|
|
Loading…
Reference in New Issue