27
// MessageBox resolves to:
28
// MessageBoxA, if UNICODE is not defined
29
// MessageBoxW, if UNICODE is defined
31
// In all cases in the code, it is assumed that we have UNICODE and _UNICODE defined or not.
32
// We have no support for cases of (UNICODE, !_UNICODE) or (!UNICODE, _UNICODE)
34
// char, if _UNICODE is not defined
35
// wchar_t, if _UNICODE is defined
38
// Set to true to disable the popping of dialog box. The message will go to the log.
39
const t_bool GNoDialog = false;
41
/*-----------------------------------------------------------------------------
42
Formatted printing and messages.
43
-----------------------------------------------------------------------------*/
45
t_u32 GetVariableArgs( TCHAR* Dest, t_u32 Size, t_u32 Count, const TCHAR*& Fmt, va_list ArgPtr )
47
t_u32 Result = VSNTPRINTF_S(Dest, Size, Count, Fmt, ArgPtr);
51
t_u32 GetVariableArgsAnsi( ANSICHAR* Dest, t_u32 Size, t_u32 Count, const ANSICHAR*& Fmt, va_list ArgPtr)
53
t_u32 Result = VSNPRINTF_S(Dest, Size, Count, Fmt, ArgPtr);
58
// Formats the text for inlOutputDebugString.
59
// This function can be used to print anything before the other output are initialized.
60
void inlOutputDebugString( const TCHAR *Format, ... )
63
GET_VARARGS( TempStr, 4096, INL_ARRAY_COUNT(TempStr) - 1, Format );
66
OutputDebugString( TempStr );
68
printf("%s\n", TCHAR_TO_ANSI(TempStr));
72
void LogOutputAssertMessage( const ANSICHAR* File, int Line, const TCHAR* Format/*=TEXT("")*/, ... )
75
GET_VARARGS( TempStr, INL_ARRAY_COUNT(TempStr), INL_ARRAY_COUNT(TempStr) - 1, Format );
76
// Logged to a file... Put "\r\n" at the end of each line.
77
if(NOutputDeviceRedirector::Ready())
78
GLogDevice.LogFunction( TEXT("Assertion failed: %s\r\n [File:%s]\r\n [Line: %i]\r\n"), (const TCHAR*)TempStr, ANSI_TO_TCHAR(File), Line);
81
void LogOutputErrorMessage( const ANSICHAR* File, int Line, const TCHAR* Format/*=TEXT("")*/, ... )
84
GET_VARARGS( TempStr, INL_ARRAY_COUNT(TempStr), INL_ARRAY_COUNT(TempStr) - 1, Format );
85
if(NOutputDeviceRedirector::Ready())
86
GLogDevice.LogFunction( TEXT("Error: %s\r\n [File:%s]\r\n [Line: %d]\r\n"), (const TCHAR*)TempStr, ANSI_TO_TCHAR(File), Line);
89
void LogOutputDebugMessage(const TCHAR* Format/*=TEXT("")*/, ... )
92
GET_VARARGS( TempStr, INL_ARRAY_COUNT(TempStr), INL_ARRAY_COUNT(TempStr) - 1, Format );
93
if(NOutputDeviceRedirector::Ready())
94
GLogDevice.LogFunction(TempStr);
97
bool inlOutputRedirectorReady()
99
return NOutputDeviceRedirector::Ready();
27
// MessageBox resolves to:
28
// MessageBoxA, if UNICODE is not defined
29
// MessageBoxW, if UNICODE is defined
31
// In all cases in the code, it is assumed that we have UNICODE and _UNICODE defined or not.
32
// We have no support for cases of (UNICODE, !_UNICODE) or (!UNICODE, _UNICODE)
34
// char, if _UNICODE is not defined
35
// wchar_t, if _UNICODE is defined
38
// Set to true to disable the popping of dialog box. The message will go to the log.
39
const t_bool GNoDialog = false;
41
/*-----------------------------------------------------------------------------
42
Formatted printing and messages.
43
-----------------------------------------------------------------------------*/
45
t_u32 GetVariableArgs( TCHAR* Dest, t_u32 Size, t_u32 Count, const TCHAR*& Fmt, va_list ArgPtr )
47
t_u32 Result = VSNTPRINTF_S(Dest, Size, Count, Fmt, ArgPtr);
51
t_u32 GetVariableArgsAnsi( ANSICHAR* Dest, t_u32 Size, t_u32 Count, const ANSICHAR*& Fmt, va_list ArgPtr)
53
t_u32 Result = VSNPRINTF_S(Dest, Size, Count, Fmt, ArgPtr);
58
// Formats the text for inlOutputDebugString.
59
// This function can be used to print anything before the other output are initialized.
60
void inlOutputDebugString( const TCHAR *Format, ... )
63
GET_VARARGS( TempStr, 4096, INL_ARRAY_COUNT(TempStr) - 1, Format );
66
OutputDebugString( TempStr );
68
printf("%s\n", TCHAR_TO_ANSI(TempStr));
72
void LogOutputAssertMessage( const ANSICHAR* File, int Line, const TCHAR* Format/*=TEXT("")*/, ... )
75
GET_VARARGS( TempStr, INL_ARRAY_COUNT(TempStr), INL_ARRAY_COUNT(TempStr) - 1, Format );
76
// Logged to a file... Put "\r\n" at the end of each line.
77
if(NOutputDeviceRedirector::Ready())
78
GLogDevice.LogFunction( TEXT("Assertion failed: %s\r\n [File:%s]\r\n [Line: %i]\r\n"), (const TCHAR*)TempStr, ANSI_TO_TCHAR(File), Line);
81
void LogOutputErrorMessage( const ANSICHAR* File, int Line, const TCHAR* Format/*=TEXT("")*/, ... )
84
GET_VARARGS( TempStr, INL_ARRAY_COUNT(TempStr), INL_ARRAY_COUNT(TempStr) - 1, Format );
85
if(NOutputDeviceRedirector::Ready())
86
GLogDevice.LogFunction( TEXT("Error: %s\r\n [File:%s]\r\n [Line: %d]\r\n"), (const TCHAR*)TempStr, ANSI_TO_TCHAR(File), Line);
89
void LogOutputDebugMessage(const TCHAR* Format/*=TEXT("")*/, ... )
92
GET_VARARGS( TempStr, INL_ARRAY_COUNT(TempStr), INL_ARRAY_COUNT(TempStr) - 1, Format );
93
if(NOutputDeviceRedirector::Ready())
94
GLogDevice.LogFunction(TempStr);
97
bool inlOutputRedirectorReady()
99
return NOutputDeviceRedirector::Ready();