From 562f54935714ee0fdfa5ad31a34774304391433b Mon Sep 17 00:00:00 2001 From: Spoike Date: Sun, 23 Jan 2011 03:33:33 +0000 Subject: [PATCH] Added a -outputdebugstring option for dumping console to debugger's output window (because msvc is unable to see standard out). git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3715 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/console.c | 1 - engine/client/sys_win.c | 12 ++++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/engine/client/console.c b/engine/client/console.c index ef982fa16..1f4d0efa7 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -676,7 +676,6 @@ void VARGS Con_Printf (const char *fmt, ...) #endif // also echo to debugging console -// OutputDebugString(msg); //msvc debug output Sys_Printf ("%s", msg); // also echo to debugging console // log all messages to file diff --git a/engine/client/sys_win.c b/engine/client/sys_win.c index fb5076de1..49fefa482 100644 --- a/engine/client/sys_win.c +++ b/engine/client/sys_win.c @@ -43,6 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #if !defined(CLIENTONLY) && !defined(SERVERONLY) qboolean isDedicated = false; #endif +qboolean debugout; HWND sys_parentwindow; unsigned int sys_parentwidth; //valid if sys_parentwindow is set @@ -732,14 +733,19 @@ void VARGS Sys_Printf (char *fmt, ...) char text[1024]; DWORD dummy; - if (!houtput) + if (!houtput && !debugout) return; va_start (argptr,fmt); vsnprintf (text, sizeof(text), fmt, argptr); va_end (argptr); - WriteFile (houtput, text, strlen(text), &dummy, NULL); +#ifdef _DEBUG + if (debugout) + OutputDebugString(text); //msvc debug output +#endif + if (houtput) + WriteFile (houtput, text, strlen(text), &dummy, NULL); } void Sys_Quit (void) @@ -1548,6 +1554,8 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin printf("version " DISTRIBUTION " " __TIME__ " " __DATE__ "\n"); return true; } + if (COM_CheckParm("-outputdebugstring")) + debugout = true; if (!GetCurrentDirectory (sizeof(cwd), cwd)) Sys_Error ("Couldn't determine current directory");