debug to messagebox rather than file

This commit is contained in:
itsmattkc 2023-10-30 20:42:29 -07:00
parent ce2f1334ef
commit e7a9014f86
2 changed files with 12 additions and 4 deletions

View file

@ -4,21 +4,23 @@
#include <stdio.h>
#include <windows.h>
#define DEBUG_MINIMUM_LEVEL TRACE_IMPLEMENTED
#define DEBUG_MINIMUM_LEVEL TRACE_UNIMPLEMENTED
#undef Trace
void Trace(int level, const char *s, ...)
{
va_list args;
FILE *fptr;
//FILE *fptr;
char buf[1024];
DWORD le = GetLastError();
DWORD le;
if (level < DEBUG_MINIMUM_LEVEL) {
return;
}
va_start(args, s);
le = GetLastError();
/*va_start(args, s);
_vsnprintf(buf, 1024, s, args);
@ -26,7 +28,12 @@ void Trace(int level, const char *s, ...)
fprintf(fptr, "%s\n", buf);
fclose(fptr);
va_end(args);*/
va_start(args, s);
_vsnprintf(buf, 1024, s, args);
va_end(args);
MessageBoxA(0, buf, 0, 0);
SetLastError(le);
}

View file

@ -4,6 +4,7 @@
#define TRACE_FORCE_DONT_PRINT -1
#define TRACE_PASSTHROUGH 0
#define TRACE_IMPLEMENTED 1
#define TRACE_POTENTIAL_ERROR 1
#define TRACE_UNIMPLEMENTED 2
#define TRACE_UNEXPECTED_ERROR 3
#define TRACE_FORCE_PRINT 99