mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-15 16:51:31 +00:00
Make console text to appear in Windows debug output
This works in Debug configuration only Color escape sequences are stripped from text before output
This commit is contained in:
parent
e9a3f7f5fc
commit
c743b19e6d
1 changed files with 24 additions and 0 deletions
|
@ -1053,6 +1053,30 @@ static TArray<FString> bufferedConsoleStuff;
|
|||
|
||||
void I_PrintStr(const char *cp)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
// Strip out any color escape sequences before writing to debug output
|
||||
char * copy = new char[strlen(cp)+1];
|
||||
const char * srcp = cp;
|
||||
char * dstp = copy;
|
||||
|
||||
while (*srcp != 0)
|
||||
{
|
||||
if (*srcp!=0x1c && *srcp!=0x1d && *srcp!=0x1e && *srcp!=0x1f)
|
||||
{
|
||||
*dstp++=*srcp++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (srcp[1]!=0) srcp+=2;
|
||||
else break;
|
||||
}
|
||||
}
|
||||
*dstp=0;
|
||||
|
||||
OutputDebugStringA(copy);
|
||||
delete [] copy;
|
||||
#endif // _DEBUG
|
||||
|
||||
if (ConWindowHidden)
|
||||
{
|
||||
bufferedConsoleStuff.Push(cp);
|
||||
|
|
Loading…
Reference in a new issue