|
|
@ -19,11 +19,13 @@ GNU General Public License for more details. |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if !defined( _WIN32 ) && !defined( XASH_MOBILE_PLATFORM ) |
|
|
|
#if !defined( _WIN32 ) && !defined( XASH_MOBILE_PLATFORM ) |
|
|
|
#define COLORIZE_CONSOLE |
|
|
|
#define XASH_COLORIZE_CONSOLE |
|
|
|
#define USE_SELECT |
|
|
|
// use with caution, running engine in Qt Creator may cause a freeze in read() call
|
|
|
|
|
|
|
|
// I was never encountered this bug anywhere else, so still enable by default
|
|
|
|
|
|
|
|
#define XASH_USE_SELECT |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifdef USE_SELECT |
|
|
|
#ifdef XASH_USE_SELECT |
|
|
|
// non-blocking console input
|
|
|
|
// non-blocking console input
|
|
|
|
#include <sys/select.h> |
|
|
|
#include <sys/select.h> |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -40,7 +42,7 @@ static LogData s_ld; |
|
|
|
|
|
|
|
|
|
|
|
char *Sys_Input( void ) |
|
|
|
char *Sys_Input( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
#ifdef USE_SELECT |
|
|
|
#ifdef XASH_USE_SELECT |
|
|
|
{ |
|
|
|
{ |
|
|
|
fd_set rfds; |
|
|
|
fd_set rfds; |
|
|
|
static char line[1024]; |
|
|
|
static char line[1024]; |
|
|
@ -163,7 +165,7 @@ void Sys_PrintLog( const char *pMsg ) |
|
|
|
if( !lastchar || lastchar == '\n') |
|
|
|
if( !lastchar || lastchar == '\n') |
|
|
|
strftime( logtime, sizeof( logtime ), "[%H:%M:%S] ", crt_tm ); //short time
|
|
|
|
strftime( logtime, sizeof( logtime ), "[%H:%M:%S] ", crt_tm ); //short time
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef COLORIZE_CONSOLE |
|
|
|
#ifdef XASH_COLORIZE_CONSOLE |
|
|
|
{ |
|
|
|
{ |
|
|
|
char colored[4096]; |
|
|
|
char colored[4096]; |
|
|
|
const char *msg = pMsg; |
|
|
|
const char *msg = pMsg; |
|
|
|