From b43832c285e4a1e9536f9501ad8d2054d57d8236 Mon Sep 17 00:00:00 2001 From: zicodxx Date: Fri, 26 Nov 2010 13:15:56 +0100 Subject: [PATCH] If -verbose or -debug is set, write gamelog.txt unbuffered for a higher chance to get messages there in case of a crash; Totally supress messages in stdout/err.txt on _WIN32 --- CHANGELOG.txt | 1 + main/console.c | 5 ++++- main/inferno.c | 9 ++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index aca53c553..abce06115 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ D2X-Rebirth Changelog 20101126 -------- include/physfsx.h, main/inferno.c, misc/physfsx.c: Implemented PHYSFSX_checkSupportedArchiveTypes to check if essential archive types are supported. Print warnings if not and stop program if necessary. Also added PHYSFSX_listSearchPAthContent to print out search path contents (figures) each time the function is called. Doing this before main HOG inits as well after sucessfully adding archives. Made PHYSFSX_addArchiveContent a bit more verbose as well. +main/console.c, main/inferno.c: If -verbose or -debug is set, write gamelog.txt unbuffered for a higher chance to get messages there in case of a crash; Totally supress messages in stdout/err.txt on _WIN32 20101125 -------- diff --git a/main/console.c b/main/console.c index 06f0c8f49..15206703b 100644 --- a/main/console.c +++ b/main/console.c @@ -209,6 +209,9 @@ void con_init(void) { memset(con_buffer,0,sizeof(con_buffer)); - gamelog_fp = PHYSFSX_openWriteBuffered("gamelog.txt"); + if (GameArg.DbgVerbose >= CON_VERBOSE) + gamelog_fp = PHYSFS_openWrite("gamelog.txt"); + else + gamelog_fp = PHYSFSX_openWriteBuffered("gamelog.txt"); atexit(con_close); } diff --git a/main/inferno.c b/main/inferno.c index b7001e656..d93b31caf 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -328,6 +328,10 @@ int main(int argc, char *argv[]) con_init(); // Initialise the console setbuf(stdout, NULL); // unbuffered output via printf +#ifdef _WIN32 + freopen( "CON", "w", stdout ); + freopen( "CON", "w", stderr ); +#endif if (GameArg.SysShowCmdHelp) { print_commandline_help(); @@ -390,11 +394,6 @@ int main(int argc, char *argv[]) arch_init(); -#ifdef _WIN32 - freopen( "CON", "w", stdout ); - freopen( "CON", "w", stderr ); -#endif - select_tmap(GameArg.DbgTexMap); Lighting_on = 1;