2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
|
|
|
* Copyright (C) 2002-2009 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"
|
|
|
|
|
|
|
|
using namespace Threading;
|
|
|
|
|
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(
|
|
|
|
(writer.DoWrite != NULL) && (writer.DoWriteLn != NULL) &&
|
|
|
|
(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
|
|
|
|
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( !ConsoleBuffer_Get().IsEmpty() )
|
|
|
|
writer.DoWriteLn( ConsoleBuffer_Get() );
|
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
|
|
|
Console = 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_DEVBUILD
|
|
|
|
DevCon = writer;
|
|
|
|
#endif
|
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
|
|
|
|
DbgCon = writer;
|
|
|
|
#endif
|
|
|
|
}
|
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
|
|
|
// --------------------------------------------------------------------------------------
|
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
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// Console_Stdio
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
|
2009-11-08 04:32:15 +00:00
|
|
|
#ifdef __LINUX__
|
2009-11-12 14:52:29 +00:00
|
|
|
static __forceinline const wxChar* GetLinuxConsoleColor(ConsoleColors color)
|
2009-11-08 04:32:15 +00:00
|
|
|
{
|
2009-11-12 14:52:29 +00:00
|
|
|
switch(color)
|
|
|
|
{
|
|
|
|
case Color_Black: return L"\033[30m";
|
|
|
|
case Color_StrongBlack: return L"\033[30m\033[1m";
|
|
|
|
|
|
|
|
case Color_Red: return L"\033[31m";
|
|
|
|
case Color_StrongRed: return L"\033[31m\033[1m";
|
|
|
|
|
|
|
|
case Color_Green: return L"\033[32m";
|
|
|
|
case Color_StrongGreen: return L"\033[32m\033[1m";
|
|
|
|
|
|
|
|
case Color_Yellow: return L"\033[33m";
|
|
|
|
case Color_StrongYellow: return L"\033[33m\033[1m";
|
|
|
|
|
|
|
|
case Color_Blue: return L"\033[34m";
|
|
|
|
case Color_StrongBlue: return L"\033[34m\033[1m";
|
|
|
|
|
|
|
|
// No orange, so use magenta.
|
|
|
|
case Color_Orange:
|
|
|
|
case Color_Magenta: return L"\033[35m";
|
|
|
|
case Color_StrongOrange:
|
|
|
|
case Color_StrongMagenta: return L"\033[35m\033[1m";
|
|
|
|
|
|
|
|
case Color_Cyan: return L"\033[36m";
|
|
|
|
case Color_StrongCyan: return L"\033[36m\033[1m";
|
|
|
|
|
|
|
|
// Use 'white' instead of grey.
|
|
|
|
case Color_Gray:
|
|
|
|
case Color_White: return L"\033[37m";
|
|
|
|
case Color_StrongGray:
|
|
|
|
case Color_StrongWhite: return L"\033[37m\033[1m";
|
|
|
|
|
|
|
|
// On some other value being passed, clear any formatting.
|
|
|
|
case Color_Default:
|
|
|
|
default: return L"\033[0m";
|
|
|
|
}
|
|
|
|
}
|
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.
|
|
|
|
static void __concall ConsoleStdio_DoWrite( const wxString& fmt )
|
|
|
|
{
|
|
|
|
wxPrintf( fmt );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Default write action at startup and shutdown is to use the stdout.
|
|
|
|
static void __concall ConsoleStdio_DoWriteLn( const wxString& fmt )
|
|
|
|
{
|
|
|
|
wxPrintf( fmt + L"\n" );
|
|
|
|
}
|
|
|
|
|
2009-11-08 04:32:15 +00:00
|
|
|
static void __concall ConsoleStdio_Newline()
|
|
|
|
{
|
|
|
|
wxPrintf( L"\n" );
|
|
|
|
}
|
|
|
|
|
2009-11-15 06:26:55 +00:00
|
|
|
static void __concall ConsoleStdio_DoSetColor( ConsoleColors color )
|
2009-11-08 04:32:15 +00:00
|
|
|
{
|
|
|
|
#ifdef __LINUX__
|
2009-11-12 14:52:29 +00:00
|
|
|
wxPrintf(L"\033[0m");
|
|
|
|
wxPrintf(GetLinuxConsoleColor(color));
|
2009-11-08 04:32:15 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-11-12 14:52:29 +00:00
|
|
|
static void __concall ConsoleStdio_SetTitle( const wxString& title )
|
2009-11-08 04:32:15 +00:00
|
|
|
{
|
|
|
|
#ifdef __LINUX__
|
2009-11-12 14:52:29 +00:00
|
|
|
wxPrintf(L"\033]0;" + title + L"\007");
|
2009-11-08 04:32:15 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-10-05 14:40:46 +00:00
|
|
|
const IConsoleWriter ConsoleWriter_Stdio =
|
|
|
|
{
|
|
|
|
ConsoleStdio_DoWrite, // Writes without newlines go to buffer to avoid error log spam.
|
|
|
|
ConsoleStdio_DoWriteLn,
|
2009-11-15 06:26:55 +00:00
|
|
|
ConsoleStdio_DoSetColor,
|
2009-10-05 14:40:46 +00:00
|
|
|
|
2009-11-08 04:32:15 +00:00
|
|
|
ConsoleStdio_Newline,
|
|
|
|
ConsoleStdio_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
|
|
|
|
|
|
|
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
|
|
|
static wxString 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
|
|
|
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()
|
|
|
|
{
|
|
|
|
m_buffer.Clear();
|
|
|
|
}
|
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 )
|
|
|
|
{
|
|
|
|
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() );
|
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.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
|
|
|
static void __concall ConsoleBuffer_DoWrite( const wxString& fmt )
|
|
|
|
{
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
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
|
|
|
|
|
|
|
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 );
|
|
|
|
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-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
|
|
|
// Sanity check: truncate strings if they exceed 512k in length. Anything like that
|
|
|
|
// is either a bug or really horrible code that needs to be stopped before it causes
|
|
|
|
// system deadlock.
|
|
|
|
static const int MaxFormattedStringLength = 0x80000;
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2009-10-29 13:32:40 +00:00
|
|
|
template< typename CharType >
|
2009-10-31 19:18:29 +00:00
|
|
|
class FormatBuffer : public Mutex
|
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
|
|
|
public:
|
|
|
|
bool& clearbit;
|
|
|
|
SafeArray<CharType> buffer;
|
2009-11-08 04:32:15 +00:00
|
|
|
|
2009-10-29 13:32:40 +00:00
|
|
|
FormatBuffer( bool& bit_to_clear_on_destruction ) :
|
|
|
|
clearbit( bit_to_clear_on_destruction )
|
|
|
|
, buffer( 4096, wxsFormat( L"%s Format Buffer", (sizeof(CharType)==1) ? "Ascii" : "Unicode" ) )
|
|
|
|
{
|
|
|
|
}
|
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
|
|
|
virtual ~FormatBuffer() throw()
|
|
|
|
{
|
|
|
|
clearbit = true;
|
|
|
|
Wait(); // lock the mutex, just in case.
|
|
|
|
}
|
2009-11-08 04:32:15 +00:00
|
|
|
|
2009-10-29 13:32:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static bool ascii_buffer_is_deleted = false;
|
|
|
|
static bool unicode_buffer_is_deleted = false;
|
|
|
|
|
|
|
|
static FormatBuffer<char> ascii_buffer( ascii_buffer_is_deleted );
|
|
|
|
static FormatBuffer<wxChar> unicode_buffer( unicode_buffer_is_deleted );
|
|
|
|
|
|
|
|
static void format_that_ascii_mess( SafeArray<char>& buffer, const char* fmt, va_list argptr )
|
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-18 16:53:44 +00:00
|
|
|
|
2009-10-29 13:32:40 +00:00
|
|
|
while( true )
|
|
|
|
{
|
|
|
|
int size = buffer.GetLength();
|
|
|
|
int len = vsnprintf(buffer.GetPtr(), size, fmt, argptr);
|
|
|
|
|
|
|
|
// some implementations of vsnprintf() don't NUL terminate
|
|
|
|
// the string if there is not enough space for it so
|
|
|
|
// always do it manually
|
|
|
|
buffer[size-1] = '\0';
|
|
|
|
|
|
|
|
if( size >= MaxFormattedStringLength ) break;
|
|
|
|
|
|
|
|
// vsnprintf() may return either -1 (traditional Unix behavior) or the
|
|
|
|
// total number of characters which would have been written if the
|
|
|
|
// buffer were large enough (newer standards such as Unix98)
|
|
|
|
|
|
|
|
if ( len < 0 )
|
|
|
|
len = size + (size/4);
|
|
|
|
|
|
|
|
if ( len < size ) break;
|
|
|
|
buffer.ExactAlloc( len + 1 );
|
|
|
|
};
|
|
|
|
|
|
|
|
// performing an assertion or log of a truncated string is unsafe, so let's not; even
|
|
|
|
// though it'd be kinda nice if we did.
|
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
|
|
|
static void format_that_unicode_mess( SafeArray<wxChar>& buffer, const wxChar* fmt, va_list argptr)
|
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
|
|
|
while( true )
|
|
|
|
{
|
|
|
|
int size = buffer.GetLength();
|
|
|
|
int len = wxVsnprintf(buffer.GetPtr(), size, fmt, argptr);
|
|
|
|
|
|
|
|
// some implementations of vsnprintf() don't NUL terminate
|
|
|
|
// the string if there is not enough space for it so
|
|
|
|
// always do it manually
|
|
|
|
buffer[size-1] = L'\0';
|
|
|
|
|
|
|
|
if( size >= MaxFormattedStringLength ) break;
|
|
|
|
|
|
|
|
// vsnprintf() may return either -1 (traditional Unix behavior) or the
|
|
|
|
// total number of characters which would have been written if the
|
|
|
|
// buffer were large enough (newer standards such as Unix98)
|
|
|
|
|
|
|
|
if ( len < 0 )
|
|
|
|
len = size + (size/4);
|
|
|
|
|
|
|
|
if ( len < size ) break;
|
|
|
|
buffer.ExactAlloc( len + 1 );
|
|
|
|
};
|
|
|
|
|
|
|
|
// performing an assertion or log of a truncated string is unsafe, so let's not; even
|
|
|
|
// though it'd be kinda nice if we did.
|
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-15 06:26:55 +00:00
|
|
|
// thread-local console indentation setting.
|
|
|
|
static __threadlocal int conlog_Indent = 0;
|
|
|
|
|
|
|
|
// thread-local console color storage.
|
|
|
|
static __threadlocal ConsoleColors conlog_Color = DefaultConsoleColor;
|
|
|
|
|
2009-10-29 13:32:40 +00:00
|
|
|
static wxString ascii_format_string(const char* fmt, va_list argptr)
|
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
|
|
|
if( ascii_buffer_is_deleted )
|
|
|
|
{
|
|
|
|
SafeArray<char> localbuf( 4096, L"Temporary Ascii Formatting Buffer" );
|
|
|
|
format_that_ascii_mess( localbuf, fmt, argptr );
|
|
|
|
return fromUTF8( localbuf.GetPtr() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ScopedLock locker( ascii_buffer );
|
|
|
|
format_that_ascii_mess( ascii_buffer.buffer, fmt, argptr );
|
|
|
|
return fromUTF8( ascii_buffer.buffer.GetPtr() );
|
|
|
|
}
|
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
|
|
|
|
|
|
|
static wxString unicode_format_string(const wxChar* fmt, va_list argptr)
|
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
|
|
|
if( unicode_buffer_is_deleted )
|
|
|
|
{
|
|
|
|
SafeArray<wxChar> localbuf( 4096, L"Temporary Unicode Formatting Buffer" );
|
|
|
|
format_that_unicode_mess( localbuf, fmt, argptr );
|
|
|
|
return localbuf.GetPtr();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ScopedLock locker( unicode_buffer );
|
|
|
|
format_that_unicode_mess( unicode_buffer.buffer, fmt, argptr );
|
|
|
|
return unicode_buffer.buffer.GetPtr();
|
|
|
|
}
|
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
|
|
|
// =====================================================================================================
|
|
|
|
// IConsole Interfaces
|
|
|
|
// =====================================================================================================
|
|
|
|
// (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
|
|
|
|
// WriteLn function, but defaults to 0 for Notice and Error calls. Local indentation always
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
wxArrayString pieces;
|
|
|
|
SplitString( pieces, src, L'\n' );
|
|
|
|
const wxString indentStr( L'\t', indent );
|
|
|
|
wxString result;
|
|
|
|
result.reserve( src.Length() + 24 );
|
|
|
|
JoinString( result, pieces, L'\n' + indentStr );
|
|
|
|
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
|
|
|
|
{
|
|
|
|
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*)
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
|
2009-11-05 19:32:27 +00:00
|
|
|
bool IConsoleWriter::Write( 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-11-16 03:23:59 +00:00
|
|
|
if( DoWrite == ConsoleNull_DoWrite ) return false;
|
2009-11-15 06:26:55 +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
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
2009-10-29 13:32:40 +00:00
|
|
|
DoWrite( ascii_format_string(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::Write( 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
|
|
|
{
|
2009-11-16 03:23:59 +00:00
|
|
|
if( DoWrite == ConsoleNull_DoWrite ) return false;
|
2009-11-15 06:26:55 +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
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
2009-11-15 06:26:55 +00:00
|
|
|
ConsoleColorScope cs( color );
|
2009-10-29 13:32:40 +00:00
|
|
|
DoWrite( ascii_format_string(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( 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-11-16 03:23:59 +00:00
|
|
|
if( DoWriteLn == ConsoleNull_DoWriteLn ) return false;
|
2009-11-15 06:26:55 +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
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
2009-11-15 06:26:55 +00:00
|
|
|
DoWriteLn( _addIndentation( ascii_format_string(fmt, args), conlog_Indent ) );
|
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
|
|
|
{
|
2009-11-16 03:23:59 +00:00
|
|
|
if( DoWriteLn == ConsoleNull_DoWriteLn ) 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
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
2009-11-15 06:26:55 +00:00
|
|
|
ConsoleColorScope cs( color );
|
|
|
|
DoWriteLn( _addIndentation( ascii_format_string(fmt, args), conlog_Indent ) );
|
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-11-16 03:23:59 +00:00
|
|
|
if( DoWriteLn == ConsoleNull_DoWriteLn ) return false;
|
2009-11-15 06:26:55 +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 );
|
|
|
|
DoWriteLn( _addIndentation( ascii_format_string(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-11-16 03:23:59 +00:00
|
|
|
if( DoWriteLn == ConsoleNull_DoWriteLn ) return false;
|
2009-11-15 06:26:55 +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 );
|
|
|
|
DoWriteLn( _addIndentation( ascii_format_string(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
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// FmtWrite Variants - Unicode/UTF16 style
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
|
2009-11-05 19:32:27 +00:00
|
|
|
bool IConsoleWriter::Write( 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-11-16 03:23:59 +00:00
|
|
|
if( DoWrite == ConsoleNull_DoWrite ) return false;
|
2009-11-15 06:26:55 +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
|
|
|
va_list args;
|
|
|
|
va_start(args,fmt);
|
2009-10-29 13:32:40 +00:00
|
|
|
DoWrite( unicode_format_string( 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::Write( 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-11-16 03:23:59 +00:00
|
|
|
if( DoWrite == ConsoleNull_DoWrite ) return false;
|
2009-11-15 06:26:55 +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 );
|
2009-10-29 13:32:40 +00:00
|
|
|
DoWrite( unicode_format_string( fmt, args ) );
|
|
|
|
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( 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-11-16 03:23:59 +00:00
|
|
|
if( DoWriteLn == ConsoleNull_DoWriteLn ) return false;
|
2009-11-15 06:26:55 +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
|
|
|
DoWriteLn( _addIndentation( unicode_format_string( fmt, args ), conlog_Indent ) );
|
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-11-16 03:23:59 +00:00
|
|
|
if( DoWriteLn == ConsoleNull_DoWriteLn ) return false;
|
2009-11-15 06:26:55 +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 );
|
|
|
|
DoWriteLn( _addIndentation( unicode_format_string( fmt, args ), conlog_Indent ) );
|
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-11-16 03:23:59 +00:00
|
|
|
if( DoWriteLn == ConsoleNull_DoWriteLn ) return false;
|
2009-11-15 06:26:55 +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 );
|
|
|
|
DoWriteLn( _addIndentation( unicode_format_string( 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-11-16 03:23:59 +00:00
|
|
|
if( DoWriteLn == ConsoleNull_DoWriteLn ) return false;
|
2009-11-15 06:26:55 +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 );
|
|
|
|
DoWriteLn( _addIndentation( unicode_format_string( 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-05 14:40:46 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// Default Writer for C++ init / startup:
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// In GUI modes under Windows I default to Assert, because windows lacks a qualified universal
|
|
|
|
// program console. In console mode I use Stdio instead, since the program is pretty well
|
|
|
|
// promised a valid console in any platform (except maybe Macs, which probably consider consoles
|
|
|
|
// a fundamental design flaw or something).
|
|
|
|
|
|
|
|
#if wxUSE_GUI && defined(__WXMSW__)
|
|
|
|
# define _DefaultWriter_ ConsoleWriter_Assert
|
|
|
|
#else
|
|
|
|
# define _DefaultWriter_ ConsoleWriter_Stdio
|
|
|
|
#endif
|
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
|
|
|
|
|
|
|
// Important! Only Assert and Null console loggers are allowed for initial console targeting.
|
|
|
|
// Other log targets rely on the static buffer and a threaded mutex lock, which are only valid
|
|
|
|
// after C++ initialization has finished.
|
|
|
|
|
2009-10-05 14:40:46 +00:00
|
|
|
IConsoleWriter Console = _DefaultWriter_;
|
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_DEVBUILD
|
2009-10-05 14:40:46 +00:00
|
|
|
IConsoleWriter DevConWriter= _DefaultWriter_;
|
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
|
|
|
|
|
|
|
|
#ifdef PCSX2_DEBUG
|
2009-10-05 14:40:46 +00:00
|
|
|
IConsoleWriter DbgConWriter= _DefaultWriter_;
|
|
|
|
#endif
|
|
|
|
|