OpenBarnyard
 
Loading...
Searching...
No Matches
TDebug.h File Reference
#include "Toshi/Typedefs.h"

Go to the source code of this file.

Functions

TBOOL TDebug_IsValidAddress (const void *a_pPtr)
 
void TDebug_AcquireMutex ()
 
void TDebug_ReleaseMutex ()
 
void TDebug_FinalPrintf (const TCHAR *a_szFormat,...)
 
void TDebug_FinalVPrintf (const TCHAR *a_szFormat, va_list a_Args)
 
void TDebug_FinalSPrintf (const TCHAR *a_szFormat,...)
 
void TDebug_FinalVSPrintf (const TCHAR *a_szFormat, va_list a_Args)
 
void TDebug_OutputDebugString (const TCHAR *a_szString)
 
void TDebug_BroadcastDebugString (const TCHAR *a_szString)
 
TINT TDebug_AssertHandler (const TCHAR *a_szExpression, const TCHAR *a_szFileName, TUINT a_uiLineNumber, const TCHAR *a_szDescription="TASSERT")
 

Function Documentation

◆ TDebug_AcquireMutex()

void TDebug_AcquireMutex ( )

Definition at line 19 of file TDebug_Win.cpp.

20{
21 if ( TDebug_IsMutexCreated == FALSE )
22 {
23 TDebug_Mutex.Create();
25 }
26
27 TDebug_Mutex.Lock();
28}
BOOL TDebug_IsMutexCreated
T2Mutex TDebug_Mutex

◆ TDebug_AssertHandler()

TINT TDebug_AssertHandler ( const TCHAR * a_szExpression,
const TCHAR * a_szFileName,
TUINT a_uiLineNumber,
const TCHAR * a_szDescription = "TASSERT" )

Definition at line 141 of file TDebug_Win.cpp.

142{
143 TDebug_szAssertFilename = a_szFileName;
144 TDebug_szAssertExpression = a_szExpression;
145 TDebug_uiAssertLineNumber = a_uiLineNumber;
146
147 TERROR( "Assertion (%s) failed ('%s', at line %u)\n", a_szExpression, a_szFileName, a_uiLineNumber );
148
149 HWND hWnd = GetActiveWindow();
150
151 if ( hWnd != NULL )
152 hWnd = GetLastActivePopup( hWnd );
153
154 INT_PTR result = DialogBoxParamA(
155 GetModuleHandleA( NULL ),
156 MAKEINTRESOURCEA( IDD_ASSERT ),
157 hWnd,
159 NULL
160 );
161
162 return ( result != -1 ) ? result : 1;
163}
BOOL CALLBACK TDebug_AssertionDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
const TCHAR * TDebug_szAssertExpression
const TCHAR * TDebug_szAssertFilename
TUINT TDebug_uiAssertLineNumber
#define TERROR(...)
Definition Defines.h:153

◆ TDebug_BroadcastDebugString()

void TDebug_BroadcastDebugString ( const TCHAR * a_szString)

Definition at line 86 of file TDebug_Win.cpp.

87{
88 //TIMPLEMENT();
89}

◆ TDebug_FinalPrintf()

void TDebug_FinalPrintf ( const TCHAR * a_szFormat,
... )

Definition at line 49 of file TDebug_Win.cpp.

50{
51 va_list args;
52 va_start( args, a_szFormat );
53 TDebug_FinalVPrintf( a_szFormat, args );
54 va_end( args );
55}
void TDebug_FinalVPrintf(const TCHAR *a_szFormat, va_list a_Args)

◆ TDebug_FinalSPrintf()

void TDebug_FinalSPrintf ( const TCHAR * a_szFormat,
... )

Definition at line 63 of file TDebug_Win.cpp.

64{
65 va_list args;
66 va_start( args, a_szFormat );
67 TDebug_FinalVSPrintf( a_szFormat, args );
68 va_end( args );
69}
void TDebug_FinalVSPrintf(const TCHAR *a_szFormat, va_list a_Args)

◆ TDebug_FinalVPrintf()

void TDebug_FinalVPrintf ( const TCHAR * a_szFormat,
va_list a_Args )

Definition at line 57 of file TDebug_Win.cpp.

58{
59 TDebug_FinalVSPrintf( a_szFormat, a_Args );
61}
TCHAR TDebug_ScratchMem[4096]
void TDebug_OutputDebugString(const TCHAR *a_szString)

◆ TDebug_FinalVSPrintf()

void TDebug_FinalVSPrintf ( const TCHAR * a_szFormat,
va_list a_Args )

Definition at line 71 of file TDebug_Win.cpp.

72{
74 vsprintf( TDebug_ScratchMem, a_szFormat, a_Args );
76}
void TDebug_AcquireMutex()
void TDebug_ReleaseMutex()

◆ TDebug_IsValidAddress()

TBOOL TDebug_IsValidAddress ( const void * a_pPtr)

Definition at line 35 of file TDebug_Win.cpp.

36{
37 if ( a_pPtr != TNULL &&
38 a_pPtr != (void*)0xcdcdcdcd &&
39 a_pPtr != (void*)0xdeaddead &&
40 a_pPtr != (void*)0xbeefbeef &&
41 a_pPtr >= (void*)0x4f )
42 {
43 return TTRUE;
44 }
45
46 return TFALSE;
47}
#define TNULL
Definition Typedefs.h:23
#define TFALSE
Definition Typedefs.h:24
#define TTRUE
Definition Typedefs.h:25

◆ TDebug_OutputDebugString()

void TDebug_OutputDebugString ( const TCHAR * a_szString)

Definition at line 78 of file TDebug_Win.cpp.

79{
80 OutputDebugStringA( a_szString );
81 printf( "%s", a_szString );
82
83 TDebug_BroadcastDebugString( a_szString );
84}
void TDebug_BroadcastDebugString(const TCHAR *a_szString)

◆ TDebug_ReleaseMutex()

void TDebug_ReleaseMutex ( )

Definition at line 30 of file TDebug_Win.cpp.

31{
32 TDebug_Mutex.Unlock();
33}