-
Notifications
You must be signed in to change notification settings - Fork 1
/
debug.cpp
40 lines (37 loc) · 870 Bytes
/
debug.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* Diablo Hacking Utility
*
* Copyright (C)1997 Trojan Consulting Ltd.
*
*
* $Header: /diabhack/debug.cpp 1 2/03/99 21:21 Andy $
*/
#include "diabhack.h"
void
MyTrace(LPCSTR pszFmt, ...)
{
#ifdef _DEBUG
char szBuffer[2048];
va_list va;
va_start(va, pszFmt);
wvsprintf(szBuffer, pszFmt, va);
va_end(va);
OutputDebugString(szBuffer);
#endif /* _DEBUG */
}
void
MyAssert(LPCSTR pszFile, unsigned uLine, LPCSTR pszExpr)
{
#ifdef _DEBUG
char szBuffer[2048];
MyTrace("Assertion \"%s\" failed at %s:%u\n", pszExpr, pszFile, uLine);
wsprintf(szBuffer,
"Assertion \"%s\"\nFailed at %s:%u\n\nPress Cancel to stop",
pszExpr, pszFile, uLine);
if (MessageBox(NULL, szBuffer, "Assertion failure", MB_OKCANCEL)
== IDCANCEL) {
DebugBreak();
}
#endif /* _DEBUG */
}