2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
2010-05-03 14:08:02 +00:00
|
|
|
* Copyright (C) 2002-2010 PCSX2 Dev Team
|
2009-11-08 04:32:15 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* 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.
|
2009-07-03 00:49:40 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
2009-07-03 00:49:40 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
2009-07-03 00:49:40 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "PrecompiledHeader.h"
|
|
|
|
#include "Threading.h"
|
2010-08-06 05:46:09 +00:00
|
|
|
#include "TraceLog.h"
|
2009-12-24 22:22:34 +00:00
|
|
|
#include "TlsVariable.inl"
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
#include "RedtapeWindows.h" // nneded for OutputDebugString
|
2010-06-06 04:17:43 +00:00
|
|
|
|
2009-07-03 00:49:40 +00:00
|
|
|
using namespace Threading;
|
|
|
|
|
2009-12-24 22:22:34 +00:00
|
|
|
// thread-local console indentation setting.
|
|
|
|
static DeclareTls(int) conlog_Indent( 0 );
|
|
|
|
|
|
|
|
// thread-local console color storage.
|
|
|
|
static DeclareTls(ConsoleColors) conlog_Color( DefaultConsoleColor );
|
|
|
|
|
|
|
|
|
2009-12-07 22:43:16 +00:00
|
|
|
static wxString m_buffer; // used by ConsoleBuffer
|
|
|
|
static Mutex m_bufferlock; // used by ConsoleBuffer
|
|
|
|
|
2015-11-17 17:38:26 +00:00
|
|
|
#ifdef __POSIX__
|
2015-10-31 00:16:17 +00:00
|
|
|
static FILE *stdout_fp = stdout;
|
|
|
|
|
|
|
|
void Console_SetStdout(FILE *fp)
|
|
|
|
{
|
|
|
|
stdout_fp = fp;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-10-05 14:40:46 +00:00
|
|
|
// This function re-assigns the console log writer(s) to the specified target. It makes sure
|
|
|
|
// to flush any contents from the buffered console log (which typically accumulates due to
|
|
|
|
// log suspension during log file/window re-init operations) into the new log.
|
|
|
|
//
|
|
|
|
// Important! Only Assert and Null console loggers are allowed during C++ startup init (when
|
|
|
|
// the program or DLL first loads). Other log targets rely on the static buffer and a
|
|
|
|
// threaded mutex lock, which are only valid after C++ initialization has finished.
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
void Console_SetActiveHandler( const IConsoleWriter& writer, FILE* flushfp )
|
2009-07-03 00:49:40 +00:00
|
|
|
{
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
pxAssertDev(
|
2010-08-06 05:46:09 +00:00
|
|
|
(writer.WriteRaw != NULL) && (writer.DoWriteLn != NULL) &&
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
(writer.Newline != NULL) && (writer.SetTitle != NULL) &&
|
2009-11-15 06:26:55 +00:00
|
|
|
(writer.DoSetColor != NULL),
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
"Invalid IConsoleWriter object! All function pointer interfaces must be implemented."
|
|
|
|
);
|
2009-11-08 04:32:15 +00:00
|
|
|
|
2009-12-07 22:43:16 +00:00
|
|
|
if( &writer != &ConsoleWriter_Buffered )
|
|
|
|
{
|
|
|
|
ScopedLock lock( m_bufferlock );
|
|
|
|
if( !ConsoleBuffer_Get().IsEmpty() )
|
|
|
|
writer.DoWriteLn( ConsoleBuffer_Get() );
|
|
|
|
}
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2015-05-27 16:20:06 +00:00
|
|
|
Console = writer;
|
|
|
|
DevConWriter = writer;
|
2009-07-03 00:49:40 +00:00
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
#ifdef PCSX2_DEBUG
|
2015-05-27 16:20:06 +00:00
|
|
|
DbgCon = writer;
|
2010-08-06 05:46:09 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
// Writes text to the Visual Studio Output window (Microsoft Windows only).
|
|
|
|
// On all other platforms this pipes to Stdout instead.
|
|
|
|
void MSW_OutputDebugString( const wxString& text )
|
|
|
|
{
|
|
|
|
#if defined(__WXMSW__) && !defined(__WXMICROWIN__)
|
|
|
|
static bool hasDebugger = wxIsDebuggerRunning();
|
|
|
|
if( hasDebugger ) OutputDebugString( text );
|
|
|
|
#else
|
2015-10-31 00:16:17 +00:00
|
|
|
fputs(text.utf8_str(), stdout_fp);
|
|
|
|
fflush(stdout_fp);
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
#endif
|
|
|
|
}
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2015-10-31 00:16:17 +00:00
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
2009-10-05 14:40:46 +00:00
|
|
|
// ConsoleNull
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
2009-07-03 00:49:40 +00:00
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
static void __concall ConsoleNull_SetTitle( const wxString& title ) {}
|
2009-11-15 06:26:55 +00:00
|
|
|
static void __concall ConsoleNull_DoSetColor( ConsoleColors color ) {}
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
static void __concall ConsoleNull_Newline() {}
|
|
|
|
static void __concall ConsoleNull_DoWrite( const wxString& fmt ) {}
|
|
|
|
static void __concall ConsoleNull_DoWriteLn( const wxString& fmt ) {}
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2009-10-05 14:40:46 +00:00
|
|
|
const IConsoleWriter ConsoleWriter_Null =
|
|
|
|
{
|
2009-11-16 03:23:59 +00:00
|
|
|
ConsoleNull_DoWrite,
|
|
|
|
ConsoleNull_DoWriteLn,
|
2009-11-15 06:26:55 +00:00
|
|
|
ConsoleNull_DoSetColor,
|
2009-10-05 14:40:46 +00:00
|
|
|
|
2009-12-07 22:43:16 +00:00
|
|
|
ConsoleNull_DoWrite,
|
2009-10-05 14:40:46 +00:00
|
|
|
ConsoleNull_Newline,
|
|
|
|
ConsoleNull_SetTitle,
|
2009-11-18 16:53:44 +00:00
|
|
|
|
|
|
|
0, // instance-level indentation (should always be 0)
|
2009-10-05 14:40:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------
|
2009-12-07 22:43:16 +00:00
|
|
|
// Console_Stdout
|
2009-10-05 14:40:46 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
|
2014-08-03 18:11:22 +00:00
|
|
|
#ifdef __linux__
|
2015-10-29 18:57:17 +00:00
|
|
|
static __fi const char* GetLinuxConsoleColor(ConsoleColors color)
|
2009-11-08 04:32:15 +00:00
|
|
|
{
|
2009-11-12 14:52:29 +00:00
|
|
|
switch(color)
|
|
|
|
{
|
2014-12-21 11:41:01 +00:00
|
|
|
case Color_Black:
|
2015-10-29 18:57:17 +00:00
|
|
|
case Color_StrongBlack: return "\033[30m\033[1m";
|
2009-11-12 14:52:29 +00:00
|
|
|
|
2015-10-29 18:57:17 +00:00
|
|
|
case Color_Red: return "\033[31m";
|
|
|
|
case Color_StrongRed: return "\033[31m\033[1m";
|
2009-11-12 14:52:29 +00:00
|
|
|
|
2015-10-29 18:57:17 +00:00
|
|
|
case Color_Green: return "\033[32m";
|
|
|
|
case Color_StrongGreen: return "\033[32m\033[1m";
|
2009-11-12 14:52:29 +00:00
|
|
|
|
2015-10-29 18:57:17 +00:00
|
|
|
case Color_Yellow: return "\033[33m";
|
|
|
|
case Color_StrongYellow: return "\033[33m\033[1m";
|
2009-11-12 14:52:29 +00:00
|
|
|
|
2015-10-29 18:57:17 +00:00
|
|
|
case Color_Blue: return "\033[34m";
|
|
|
|
case Color_StrongBlue: return "\033[34m\033[1m";
|
2009-11-12 14:52:29 +00:00
|
|
|
|
|
|
|
// No orange, so use magenta.
|
|
|
|
case Color_Orange:
|
2015-10-29 18:57:17 +00:00
|
|
|
case Color_Magenta: return "\033[35m";
|
2009-11-12 14:52:29 +00:00
|
|
|
case Color_StrongOrange:
|
2015-10-29 18:57:17 +00:00
|
|
|
case Color_StrongMagenta: return "\033[35m\033[1m";
|
2009-11-12 14:52:29 +00:00
|
|
|
|
2015-10-29 18:57:17 +00:00
|
|
|
case Color_Cyan: return "\033[36m";
|
|
|
|
case Color_StrongCyan: return "\033[36m\033[1m";
|
2009-11-12 14:52:29 +00:00
|
|
|
|
|
|
|
// Use 'white' instead of grey.
|
|
|
|
case Color_Gray:
|
2015-10-29 18:57:17 +00:00
|
|
|
case Color_White: return "\033[37m";
|
2009-11-12 14:52:29 +00:00
|
|
|
case Color_StrongGray:
|
2015-10-29 18:57:17 +00:00
|
|
|
case Color_StrongWhite: return "\033[37m\033[1m";
|
2009-11-12 14:52:29 +00:00
|
|
|
|
|
|
|
// On some other value being passed, clear any formatting.
|
|
|
|
case Color_Default:
|
2015-10-29 18:57:17 +00:00
|
|
|
default: return "\033[0m";
|
2009-11-12 14:52:29 +00:00
|
|
|
}
|
|
|
|
}
|
2009-11-08 04:32:15 +00:00
|
|
|
#endif
|
|
|
|
|
2009-10-05 14:40:46 +00:00
|
|
|
// One possible default write action at startup and shutdown is to use the stdout.
|
2009-12-07 22:43:16 +00:00
|
|
|
static void __concall ConsoleStdout_DoWrite( const wxString& fmt )
|
2009-10-05 14:40:46 +00:00
|
|
|
{
|
2010-08-06 05:46:09 +00:00
|
|
|
MSW_OutputDebugString( fmt );
|
2009-10-05 14:40:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Default write action at startup and shutdown is to use the stdout.
|
2009-12-07 22:43:16 +00:00
|
|
|
static void __concall ConsoleStdout_DoWriteLn( const wxString& fmt )
|
2009-10-05 14:40:46 +00:00
|
|
|
{
|
2010-08-06 05:46:09 +00:00
|
|
|
MSW_OutputDebugString( fmt + L"\n" );
|
2009-10-05 14:40:46 +00:00
|
|
|
}
|
|
|
|
|
2009-12-07 22:43:16 +00:00
|
|
|
static void __concall ConsoleStdout_Newline()
|
2009-11-08 04:32:15 +00:00
|
|
|
{
|
2010-08-06 05:46:09 +00:00
|
|
|
MSW_OutputDebugString( L"\n" );
|
2009-11-08 04:32:15 +00:00
|
|
|
}
|
|
|
|
|
2009-12-07 22:43:16 +00:00
|
|
|
static void __concall ConsoleStdout_DoSetColor( ConsoleColors color )
|
2009-11-08 04:32:15 +00:00
|
|
|
{
|
2014-08-03 18:11:22 +00:00
|
|
|
#ifdef __linux__
|
2015-10-31 00:16:17 +00:00
|
|
|
fprintf(stdout_fp, "\033[0m%s", GetLinuxConsoleColor(color));
|
|
|
|
fflush(stdout_fp);
|
2009-11-08 04:32:15 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-12-07 22:43:16 +00:00
|
|
|
static void __concall ConsoleStdout_SetTitle( const wxString& title )
|
2009-11-08 04:32:15 +00:00
|
|
|
{
|
2014-08-03 18:11:22 +00:00
|
|
|
#ifdef __linux__
|
2015-10-31 00:16:17 +00:00
|
|
|
fputs("\033]0;", stdout_fp);
|
|
|
|
fputs(title.utf8_str(), stdout_fp);
|
|
|
|
fputs("\007", stdout_fp);
|
2009-11-08 04:32:15 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-12-07 22:43:16 +00:00
|
|
|
const IConsoleWriter ConsoleWriter_Stdout =
|
2009-10-05 14:40:46 +00:00
|
|
|
{
|
2009-12-07 22:43:16 +00:00
|
|
|
ConsoleStdout_DoWrite, // Writes without newlines go to buffer to avoid error log spam.
|
|
|
|
ConsoleStdout_DoWriteLn,
|
|
|
|
ConsoleStdout_DoSetColor,
|
2009-10-05 14:40:46 +00:00
|
|
|
|
2010-06-06 04:17:43 +00:00
|
|
|
ConsoleNull_DoWrite, // writes from re-piped stdout are ignored here, lest we create infinite loop hell >_<
|
2009-12-07 22:43:16 +00:00
|
|
|
ConsoleStdout_Newline,
|
|
|
|
ConsoleStdout_SetTitle,
|
2009-11-18 16:53:44 +00:00
|
|
|
0, // instance-level indentation (should always be 0)
|
2009-10-05 14:40:46 +00:00
|
|
|
};
|
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
2009-10-05 14:40:46 +00:00
|
|
|
// ConsoleAssert
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
2009-07-03 20:12:33 +00:00
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
static void __concall ConsoleAssert_DoWrite( const wxString& fmt )
|
|
|
|
{
|
|
|
|
pxFail( L"Console class has not been initialized; Message written:\n\t" + fmt );
|
|
|
|
}
|
2009-07-03 00:49:40 +00:00
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
static void __concall ConsoleAssert_DoWriteLn( const wxString& fmt )
|
|
|
|
{
|
|
|
|
pxFail( L"Console class has not been initialized; Message written:\n\t" + fmt );
|
|
|
|
}
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2009-10-05 14:40:46 +00:00
|
|
|
const IConsoleWriter ConsoleWriter_Assert =
|
|
|
|
{
|
|
|
|
ConsoleAssert_DoWrite,
|
|
|
|
ConsoleAssert_DoWriteLn,
|
2009-11-15 06:26:55 +00:00
|
|
|
ConsoleNull_DoSetColor,
|
2009-10-05 14:40:46 +00:00
|
|
|
|
2009-12-07 22:43:16 +00:00
|
|
|
ConsoleNull_DoWrite,
|
2009-10-05 14:40:46 +00:00
|
|
|
ConsoleNull_Newline,
|
|
|
|
ConsoleNull_SetTitle,
|
2009-11-18 16:53:44 +00:00
|
|
|
|
|
|
|
0, // instance-level indentation (should always be 0)
|
2009-10-05 14:40:46 +00:00
|
|
|
};
|
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
2009-10-05 14:40:46 +00:00
|
|
|
// ConsoleBuffer
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
2009-07-03 00:49:40 +00:00
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
const wxString& ConsoleBuffer_Get()
|
|
|
|
{
|
|
|
|
return m_buffer;
|
|
|
|
}
|
2009-07-03 00:49:40 +00:00
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
void ConsoleBuffer_Clear()
|
|
|
|
{
|
2009-12-07 22:43:16 +00:00
|
|
|
ScopedLock lock( m_bufferlock );
|
2010-06-09 17:37:11 +00:00
|
|
|
m_buffer.clear();
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
}
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2009-10-05 14:40:46 +00:00
|
|
|
// Flushes the contents of the ConsoleBuffer to the specified destination file stream, and
|
|
|
|
// clears the buffer contents to 0.
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
void ConsoleBuffer_FlushToFile( FILE *fp )
|
|
|
|
{
|
2009-12-07 22:43:16 +00:00
|
|
|
ScopedLock lock( m_bufferlock );
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
if( fp == NULL || m_buffer.IsEmpty() ) return;
|
User Interface:
* Fixed and added better Emulation/System menu updating. Suspend/Resume is more consistent, and Reset grays itself out after being used.
* Entering plugin configurations auto-suspends the emulator.
* Changing plugins in the Configuration PAnel takes effect now without a restart.
* Added preliminary support for an ExtensibleConfirmation Dialog box (contains a sizer you can add content to, and also has an optional "[x] Do not show this again" checkbox).
Bugfixes:
* Added some mutex protection to cdvdNewDiskCB; "just in case."
* Resolved several recursion and deadlock scenarios when (very!) rapidly suspending, resuming, and resetting the emu.
Developments / Code Cleanups:
* Renamed SysCoreThread ExecutionModes: Suspend/Resume are now Opened/Closed (which more accurately reflects the fact they opena nd close the plugins, and helps avoid ambiguity with the "Paused" state).
* Added Exception::ThreadTimedOut, which is now thrown from Semaphore::Wait when recursive wxApp::Yield() calls are detected, and a deadlock occurs (basically cancels the current action which, most of the time, allows for full recovery).
* Major Threading namespace cleanups, documentations, etc.
* Removed wxScopedArray (scopedarray.h) and replaced it with a better implemeneted ScopedArray class.
* Removed toUTF8 class, which I only added a couple weeks ago because I didn't realize wxCharBuffer had an implicit typecast to (char*).
* Implemented more Source/Listener events for Pcsx2App. CoreThread events are sourced properly now, and added SettingsApplied and SettingsLoadSave Sources.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2010 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-16 03:58:29 +00:00
|
|
|
px_fputs( fp, m_buffer.ToUTF8() );
|
2010-06-09 17:37:11 +00:00
|
|
|
m_buffer.clear();
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
}
|
2009-07-03 00:49:40 +00:00
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
static void __concall ConsoleBuffer_DoWrite( const wxString& fmt )
|
|
|
|
{
|
2009-12-07 22:43:16 +00:00
|
|
|
ScopedLock lock( m_bufferlock );
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
m_buffer += fmt;
|
|
|
|
}
|
2009-07-03 00:49:40 +00:00
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
static void __concall ConsoleBuffer_DoWriteLn( const wxString& fmt )
|
|
|
|
{
|
2009-12-07 22:43:16 +00:00
|
|
|
ScopedLock lock( m_bufferlock );
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
m_buffer += fmt + L"\n";
|
|
|
|
}
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2009-10-05 14:40:46 +00:00
|
|
|
const IConsoleWriter ConsoleWriter_Buffered =
|
|
|
|
{
|
|
|
|
ConsoleBuffer_DoWrite, // Writes without newlines go to buffer to avoid assertion spam.
|
|
|
|
ConsoleBuffer_DoWriteLn,
|
2009-11-15 06:26:55 +00:00
|
|
|
ConsoleNull_DoSetColor,
|
2009-10-05 14:40:46 +00:00
|
|
|
|
2009-12-07 22:43:16 +00:00
|
|
|
ConsoleBuffer_DoWrite,
|
2009-10-05 14:40:46 +00:00
|
|
|
ConsoleNull_Newline,
|
|
|
|
ConsoleNull_SetTitle,
|
2009-11-18 16:53:44 +00:00
|
|
|
|
|
|
|
0, // instance-level indentation (should always be 0)
|
2009-10-05 14:40:46 +00:00
|
|
|
};
|
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
2009-10-05 14:40:46 +00:00
|
|
|
// Console_wxLogError
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
2009-07-03 00:49:40 +00:00
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
static void __concall Console_wxLogError_DoWriteLn( const wxString& fmt )
|
|
|
|
{
|
|
|
|
if( !m_buffer.IsEmpty() )
|
2009-07-03 00:49:40 +00:00
|
|
|
{
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
wxLogError( m_buffer );
|
2010-06-09 17:37:11 +00:00
|
|
|
m_buffer.clear();
|
2009-07-03 00:49:40 +00:00
|
|
|
}
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
wxLogError( fmt );
|
|
|
|
}
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2009-10-05 14:40:46 +00:00
|
|
|
const IConsoleWriter ConsoleWriter_wxError =
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
{
|
2009-10-05 14:40:46 +00:00
|
|
|
ConsoleBuffer_DoWrite, // Writes without newlines go to buffer to avoid error log spam.
|
|
|
|
Console_wxLogError_DoWriteLn,
|
2009-11-15 06:26:55 +00:00
|
|
|
ConsoleNull_DoSetColor,
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
|
2009-12-07 22:43:16 +00:00
|
|
|
ConsoleBuffer_DoWrite,
|
2009-10-05 14:40:46 +00:00
|
|
|
ConsoleNull_Newline,
|
|
|
|
ConsoleNull_SetTitle,
|
2009-11-18 16:53:44 +00:00
|
|
|
|
|
|
|
0, // instance-level indentation (should always be 0)
|
2009-10-05 14:40:46 +00:00
|
|
|
};
|
|
|
|
|
2009-10-29 13:32:40 +00:00
|
|
|
// =====================================================================================================
|
2010-08-31 05:14:00 +00:00
|
|
|
// IConsoleWriter (implementations)
|
2009-10-29 13:32:40 +00:00
|
|
|
// =====================================================================================================
|
|
|
|
// (all non-virtual members that do common work and then pass the result through DoWrite
|
|
|
|
// or DoWriteLn)
|
|
|
|
|
2009-11-15 06:26:55 +00:00
|
|
|
// Parameters:
|
|
|
|
// glob_indent - this parameter is used to specify a global indentation setting. It is used by
|
2010-08-06 05:46:09 +00:00
|
|
|
// WriteLn function, but defaults to 0 for Warning and Error calls. Local indentation always
|
2009-11-15 06:26:55 +00:00
|
|
|
// applies to all writes.
|
|
|
|
wxString IConsoleWriter::_addIndentation( const wxString& src, int glob_indent=0 ) const
|
|
|
|
{
|
|
|
|
const int indent = glob_indent + _imm_indentation;
|
|
|
|
if( indent == 0 ) return src;
|
|
|
|
|
2010-06-09 17:37:11 +00:00
|
|
|
wxString result( src );
|
2009-11-15 06:26:55 +00:00
|
|
|
const wxString indentStr( L'\t', indent );
|
2010-06-09 17:37:11 +00:00
|
|
|
result.Replace( L"\n", L"\n" + indentStr );
|
2009-11-15 06:26:55 +00:00
|
|
|
return indentStr + result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Sets the indentation to be applied to all WriteLn's. The indentation is added to the
|
|
|
|
// primary write, and to any newlines specified within the write. Note that this applies
|
|
|
|
// to calls to WriteLn *only* -- calls to Write bypass the indentation parser.
|
|
|
|
const IConsoleWriter& IConsoleWriter::SetIndent( int tabcount ) const
|
|
|
|
{
|
|
|
|
conlog_Indent += tabcount;
|
|
|
|
pxAssert( conlog_Indent >= 0 );
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
IConsoleWriter IConsoleWriter::Indent( int tabcount ) const
|
|
|
|
{
|
|
|
|
IConsoleWriter retval = *this;
|
|
|
|
retval._imm_indentation = tabcount;
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Changes the active console color.
|
|
|
|
// This color will be unset by calls to colored text methods
|
|
|
|
// such as ErrorMsg and Notice.
|
|
|
|
const IConsoleWriter& IConsoleWriter::SetColor( ConsoleColors color ) const
|
|
|
|
{
|
2010-08-06 05:46:09 +00:00
|
|
|
// Ignore current color requests since, well, the current color is already set. ;)
|
|
|
|
if( color == Color_Current ) return *this;
|
|
|
|
|
|
|
|
pxAssertMsg( (color > Color_Current) && (color < ConsoleColors_Count), "Invalid ConsoleColor specified." );
|
2009-11-18 16:53:44 +00:00
|
|
|
|
2009-11-15 06:26:55 +00:00
|
|
|
if( conlog_Color != color )
|
|
|
|
DoSetColor( conlog_Color = color );
|
2009-11-18 16:53:44 +00:00
|
|
|
|
2009-11-15 06:26:55 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
ConsoleColors IConsoleWriter::GetColor() const
|
|
|
|
{
|
|
|
|
return conlog_Color;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Restores the console color to default (usually black, or low-intensity white if the console uses a black background)
|
|
|
|
const IConsoleWriter& IConsoleWriter::ClearColor() const
|
|
|
|
{
|
|
|
|
if( conlog_Color != DefaultConsoleColor )
|
|
|
|
DoSetColor( conlog_Color = DefaultConsoleColor );
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2009-10-29 13:32:40 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// ASCII/UTF8 (char*)
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
bool IConsoleWriter::FormatV( const char* fmt, va_list args ) const
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
{
|
2010-08-06 05:46:09 +00:00
|
|
|
DoWriteLn( _addIndentation( pxsFmtV(fmt,args), conlog_Indent ) );
|
2009-11-05 19:32:27 +00:00
|
|
|
return false;
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:32:27 +00:00
|
|
|
bool IConsoleWriter::WriteLn( const char* fmt, ... ) const
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
2010-08-06 05:46:09 +00:00
|
|
|
FormatV(fmt, args);
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
va_end(args);
|
2009-11-05 19:32:27 +00:00
|
|
|
|
|
|
|
return false;
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:32:27 +00:00
|
|
|
bool IConsoleWriter::WriteLn( ConsoleColors color, const char* fmt, ... ) const
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
2009-11-15 06:26:55 +00:00
|
|
|
ConsoleColorScope cs( color );
|
2010-08-06 05:46:09 +00:00
|
|
|
FormatV(fmt, args);
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
va_end(args);
|
2009-11-05 19:32:27 +00:00
|
|
|
|
|
|
|
return false;
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:32:27 +00:00
|
|
|
bool IConsoleWriter::Error( const char* fmt, ... ) const
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
{
|
2009-10-29 13:32:40 +00:00
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
2009-11-15 06:26:55 +00:00
|
|
|
ConsoleColorScope cs( Color_StrongRed );
|
2010-08-06 05:46:09 +00:00
|
|
|
FormatV(fmt, args);
|
2009-10-29 13:32:40 +00:00
|
|
|
va_end(args);
|
2009-11-05 19:32:27 +00:00
|
|
|
|
|
|
|
return false;
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:32:27 +00:00
|
|
|
bool IConsoleWriter::Warning( const char* fmt, ... ) const
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
{
|
2009-10-29 13:32:40 +00:00
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
2009-11-15 06:26:55 +00:00
|
|
|
ConsoleColorScope cs( Color_StrongOrange );
|
2010-08-06 05:46:09 +00:00
|
|
|
FormatV(fmt, args);
|
2009-10-29 13:32:40 +00:00
|
|
|
va_end(args);
|
2009-11-05 19:32:27 +00:00
|
|
|
|
|
|
|
return false;
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
}
|
|
|
|
|
2009-10-29 13:32:40 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
2010-08-06 05:46:09 +00:00
|
|
|
// Write Variants - Unicode/UTF16 style
|
2009-10-29 13:32:40 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
bool IConsoleWriter::FormatV( const wxChar* fmt, va_list args ) const
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
{
|
2010-08-06 05:46:09 +00:00
|
|
|
DoWriteLn( _addIndentation( pxsFmtV( fmt, args ), conlog_Indent ) );
|
2009-11-05 19:32:27 +00:00
|
|
|
return false;
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:32:27 +00:00
|
|
|
bool IConsoleWriter::WriteLn( const wxChar* fmt, ... ) const
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
{
|
2009-10-29 13:32:40 +00:00
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
2010-08-06 05:46:09 +00:00
|
|
|
FormatV(fmt,args);
|
2009-10-29 13:32:40 +00:00
|
|
|
va_end(args);
|
2009-11-05 19:32:27 +00:00
|
|
|
|
|
|
|
return false;
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:32:27 +00:00
|
|
|
bool IConsoleWriter::WriteLn( ConsoleColors color, const wxChar* fmt, ... ) const
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
{
|
2009-10-29 13:32:40 +00:00
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
2009-11-15 06:26:55 +00:00
|
|
|
ConsoleColorScope cs( color );
|
2010-08-06 05:46:09 +00:00
|
|
|
FormatV(fmt,args);
|
2009-10-29 13:32:40 +00:00
|
|
|
va_end(args);
|
2009-11-05 19:32:27 +00:00
|
|
|
|
|
|
|
return false;
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:32:27 +00:00
|
|
|
bool IConsoleWriter::Error( const wxChar* fmt, ... ) const
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
{
|
2009-10-29 13:32:40 +00:00
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
2009-11-15 06:26:55 +00:00
|
|
|
ConsoleColorScope cs( Color_StrongRed );
|
2010-08-06 05:46:09 +00:00
|
|
|
FormatV(fmt,args);
|
2009-10-29 13:32:40 +00:00
|
|
|
va_end(args);
|
2009-11-05 19:32:27 +00:00
|
|
|
|
|
|
|
return false;
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
}
|
|
|
|
|
2009-11-05 19:32:27 +00:00
|
|
|
bool IConsoleWriter::Warning( const wxChar* fmt, ... ) const
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
{
|
2009-10-29 13:32:40 +00:00
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
2009-11-15 06:26:55 +00:00
|
|
|
ConsoleColorScope cs( Color_StrongOrange );
|
2010-08-06 05:46:09 +00:00
|
|
|
FormatV(fmt,args);
|
2009-10-29 13:32:40 +00:00
|
|
|
va_end(args);
|
2009-11-05 19:32:27 +00:00
|
|
|
|
|
|
|
return false;
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
}
|
|
|
|
|
2014-06-29 06:57:33 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// Write Variants - Unknown style
|
|
|
|
// --------------------------------------------------------------------------------------
|
2014-08-01 20:42:00 +00:00
|
|
|
bool IConsoleWriter::WriteLn( const wxString fmt, ... ) const
|
2014-06-29 06:57:33 +00:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
|
|
|
FormatV(fmt.wx_str(),args);
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-08-01 20:42:00 +00:00
|
|
|
bool IConsoleWriter::WriteLn( ConsoleColors color, const wxString fmt, ... ) const
|
2014-06-29 06:57:33 +00:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
|
|
|
ConsoleColorScope cs( color );
|
|
|
|
FormatV(fmt.wx_str(),args);
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-08-01 20:42:00 +00:00
|
|
|
bool IConsoleWriter::Error( const wxString fmt, ... ) const
|
2014-06-29 06:57:33 +00:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
|
|
|
ConsoleColorScope cs( Color_StrongRed );
|
|
|
|
FormatV(fmt.wx_str(),args);
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-08-01 20:42:00 +00:00
|
|
|
bool IConsoleWriter::Warning( const wxString fmt, ... ) const
|
2014-06-29 06:57:33 +00:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
|
|
|
ConsoleColorScope cs( Color_StrongOrange );
|
|
|
|
FormatV(fmt.wx_str(),args);
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-07 22:43:16 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
2010-08-06 05:46:09 +00:00
|
|
|
// ConsoleColorScope / ConsoleIndentScope
|
2009-12-07 22:43:16 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
ConsoleColorScope::ConsoleColorScope( ConsoleColors newcolor )
|
2009-12-07 22:43:16 +00:00
|
|
|
{
|
2010-08-06 05:46:09 +00:00
|
|
|
m_IsScoped = false;
|
|
|
|
m_newcolor = newcolor;
|
|
|
|
EnterScope();
|
|
|
|
}
|
2009-12-07 22:43:16 +00:00
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
ConsoleColorScope::~ConsoleColorScope() throw()
|
|
|
|
{
|
|
|
|
LeaveScope();
|
|
|
|
}
|
2009-12-07 22:43:16 +00:00
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
void ConsoleColorScope::EnterScope()
|
|
|
|
{
|
|
|
|
if (!m_IsScoped)
|
|
|
|
{
|
|
|
|
m_old_color = Console.GetColor();
|
|
|
|
Console.SetColor( m_newcolor );
|
|
|
|
m_IsScoped = true;
|
|
|
|
}
|
2009-12-07 22:43:16 +00:00
|
|
|
}
|
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
void ConsoleColorScope::LeaveScope()
|
2009-12-07 22:43:16 +00:00
|
|
|
{
|
2010-08-06 05:46:09 +00:00
|
|
|
m_IsScoped = m_IsScoped && (Console.SetColor( m_old_color ), false);
|
|
|
|
}
|
2009-12-07 22:43:16 +00:00
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
ConsoleIndentScope::ConsoleIndentScope( int tabs )
|
|
|
|
{
|
|
|
|
m_IsScoped = false;
|
|
|
|
m_amount = tabs;
|
|
|
|
EnterScope();
|
|
|
|
}
|
2009-12-07 22:43:16 +00:00
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
ConsoleIndentScope::~ConsoleIndentScope() throw()
|
|
|
|
{
|
2015-09-22 17:06:12 +00:00
|
|
|
try {
|
|
|
|
LeaveScope();
|
|
|
|
}
|
|
|
|
DESTRUCTOR_CATCHALL
|
2010-08-06 05:46:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ConsoleIndentScope::EnterScope()
|
|
|
|
{
|
|
|
|
m_IsScoped = m_IsScoped || (Console.SetIndent( m_amount ),true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConsoleIndentScope::LeaveScope()
|
|
|
|
{
|
|
|
|
m_IsScoped = m_IsScoped && (Console.SetIndent( -m_amount ),false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ConsoleAttrScope::ConsoleAttrScope( ConsoleColors newcolor, int indent )
|
|
|
|
{
|
|
|
|
m_old_color = Console.GetColor();
|
|
|
|
Console.SetIndent( m_tabsize = indent );
|
|
|
|
Console.SetColor( newcolor );
|
|
|
|
}
|
|
|
|
|
|
|
|
ConsoleAttrScope::~ConsoleAttrScope() throw()
|
|
|
|
{
|
2015-09-22 17:06:12 +00:00
|
|
|
try {
|
|
|
|
Console.SetColor( m_old_color );
|
|
|
|
Console.SetIndent( -m_tabsize );
|
|
|
|
}
|
|
|
|
DESTRUCTOR_CATCHALL
|
2009-12-07 22:43:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-05 14:40:46 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// Default Writer for C++ init / startup:
|
|
|
|
// --------------------------------------------------------------------------------------
|
2010-08-06 05:46:09 +00:00
|
|
|
// Currently all build types default to Stdout, which is very functional on Linux but not
|
|
|
|
// always so useful on Windows (which itself lacks a proper stdout console without using
|
|
|
|
// platform specific code). Under windows Stdout will attempt to write to the IDE Debug
|
|
|
|
// console, if one is available (such as running pcsx2 via MSVC). If not available, then
|
|
|
|
// the log message will pretty much be lost into the ether.
|
|
|
|
//
|
2010-06-06 04:17:43 +00:00
|
|
|
#define _DefaultWriter_ ConsoleWriter_Stdout
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
|
2015-05-27 16:20:06 +00:00
|
|
|
IConsoleWriter Console = _DefaultWriter_;
|
|
|
|
IConsoleWriter DevConWriter = _DefaultWriter_;
|
2010-08-06 05:46:09 +00:00
|
|
|
bool DevConWriterEnabled = false;
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
|
|
|
|
#ifdef PCSX2_DEBUG
|
2015-05-27 16:20:06 +00:00
|
|
|
IConsoleWriter DbgConWriter = _DefaultWriter_;
|
2009-10-05 14:40:46 +00:00
|
|
|
#endif
|
|
|
|
|
2015-05-27 16:20:06 +00:00
|
|
|
NullConsoleWriter NullCon = {};
|
2010-08-06 05:46:09 +00:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------
|
2010-08-16 15:01:13 +00:00
|
|
|
// ConsoleLogSource (implementations)
|
2010-08-06 05:46:09 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Writes to the console using the specified color. This overrides the default color setting
|
|
|
|
// for this log.
|
|
|
|
bool ConsoleLogSource::WriteV( ConsoleColors color, const char *fmt, va_list list ) const
|
|
|
|
{
|
|
|
|
ConsoleColorScope cs(color);
|
2010-08-31 05:14:00 +00:00
|
|
|
DoWrite( pxsFmtV(fmt,list).c_str() );
|
2010-08-06 05:46:09 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ConsoleLogSource::WriteV( ConsoleColors color, const wxChar *fmt, va_list list ) const
|
|
|
|
{
|
|
|
|
ConsoleColorScope cs(color);
|
2010-08-31 05:14:00 +00:00
|
|
|
DoWrite( pxsFmtV(fmt,list).c_str() );
|
2010-08-06 05:46:09 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Writes to the console using the source's default color. Note that the source's default
|
|
|
|
// color will always be used, thus ConsoleColorScope() will not be effectual unless the
|
|
|
|
// console's default color is Color_Default.
|
|
|
|
bool ConsoleLogSource::WriteV( const char *fmt, va_list list ) const
|
|
|
|
{
|
|
|
|
WriteV( DefaultColor, fmt, list );
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ConsoleLogSource::WriteV( const wxChar *fmt, va_list list ) const
|
|
|
|
{
|
|
|
|
WriteV( DefaultColor, fmt, list );
|
|
|
|
return false;
|
|
|
|
}
|