From 267d964126ff51abea63227ef5c5038981acb6ca Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sun, 22 Mar 2009 09:14:53 +0000 Subject: [PATCH] Linux: Fix up console logging so it both doesn't insert newlines every time the color is changed, and doesn't log the color change codes in logs, as unless you are using a console based text editor, it's harder to read. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@832 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Linux/LnxConsole.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pcsx2/Linux/LnxConsole.cpp b/pcsx2/Linux/LnxConsole.cpp index c399b9ec4b..c7dda945d9 100644 --- a/pcsx2/Linux/LnxConsole.cpp +++ b/pcsx2/Linux/LnxConsole.cpp @@ -55,11 +55,11 @@ void Close() __forceinline bool __fastcall Newline() { if (Config.PsxOut) - puts("\n"); + printf("\n"); if (emuLog != NULL) { - fputs("\n", emuLog); + fprintf(emuLog,"\n"); fflush(emuLog); } @@ -68,23 +68,25 @@ __forceinline bool __fastcall Newline() __forceinline bool __fastcall Write(const char* fmt) { - if (Config.PsxOut) - fputs(fmt, stdout); + // By using fputs, append a newline automatically. + if (Config.PsxOut) fputs(fmt, stdout); - if (emuLog != NULL) - fputs(fmt, emuLog); + // Color changing should not use this function, as we don't want the color codes logged, or new lines inserted. + if (emuLog != NULL) fputs(fmt, emuLog); return false; } void __fastcall SetColor(Colors color) { - Write(tbl_color_codes[color]); + // Don't log the color change, and don't insert a new line afterwards. + printf(tbl_color_codes[color]); } void ClearColor() { - Write(COLOR_RESET); + // Don't log the color change, and don't insert a new line afterwards. + printf(COLOR_RESET); } }