Rushed my prev commit. Here's some basic thing, only much less broken and crappy. (fixes double-spaced emuLog.txt file contents)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1099 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-05-01 02:53:09 +00:00
parent e24851927a
commit 17caa515ac
3 changed files with 31 additions and 13 deletions

View File

@ -168,16 +168,24 @@ void hwWrite8(u32 mem, u8 value) {
case RCNT3_TARGET: rcntWtarget(3, value); break; case RCNT3_TARGET: rcntWtarget(3, value); break;
case 0x1000f180: case 0x1000f180:
if (value == '\n') { {
bool flush = false;
// Terminate lines on CR or full buffers, and ignore \n's if the string contents
// are empty (otherwise terminate on \n too!)
if( ( value == '\r' ) || ( sio_count == 1023 ) ||
( value == '\n' && sio_count != 0 ) )
{
sio_buffer[sio_count] = 0; sio_buffer[sio_count] = 0;
Console::WriteLn( Color_Cyan, sio_buffer ); Console::WriteLn( Color_Cyan, sio_buffer );
sio_count = 0; sio_count = 0;
} else {
if (sio_count < 1023) {
sio_buffer[sio_count++] = value;
}
} }
break; else if( value != '\n' )
{
sio_buffer[sio_count++] = value;
}
}
break;
//case 0x10003c02: //Tony Hawks Project 8 uses this //case 0x10003c02: //Tony Hawks Project 8 uses this
// vif1Write32(mem & ~0x2, value << 16); // vif1Write32(mem & ~0x2, value << 16);

View File

@ -666,14 +666,24 @@ void psxHwWrite8(u32 add, u8 value) {
case 0x1f801803: cdrWrite3(value); break; case 0x1f801803: cdrWrite3(value); break;
case 0x1f80380c: case 0x1f80380c:
if (value == '\r') break; {
if (value == '\n' || g_pbufi >= 1023) { // A line break, or the buffer is about to overflow. bool flush = false;
g_pbuf[g_pbufi++] = 0;
g_pbufi = 0; // Terminate lines on CR or full buffers, and ignore \n's if the string contents
// are empty (otherwise terminate on \n too!)
if( ( value == '\r' ) || ( g_pbufi == 1023 ) ||
( value == '\n' && g_pbufi != 0 ) )
{
g_pbuf[g_pbufi] = 0;
DevCon::WriteLn( Color_Cyan, g_pbuf ); DevCon::WriteLn( Color_Cyan, g_pbuf );
g_pbufi = 0;
}
else if( value != '\n' )
{
g_pbuf[g_pbufi++] = value;
} }
else g_pbuf[g_pbufi++] = value;
psxHu8(add) = value; psxHu8(add) = value;
}
return; return;
case 0x1F808260: case 0x1F808260:

View File

@ -95,7 +95,7 @@ namespace Console
if (emuLog != NULL) if (emuLog != NULL)
{ {
fputs("", emuLog); fputs("\n", emuLog);
fflush( emuLog ); fflush( emuLog );
} }
@ -114,7 +114,7 @@ namespace Console
// No flushing here -- only flush after newlines. // No flushing here -- only flush after newlines.
if (emuLog != NULL) if (emuLog != NULL)
fprintf( emuLog, fmt ); fputs( fmt, emuLog );
return false; return false;
} }