nxdk_pgraph_tests
A collection of tests for the Xbox nv2a graphics processor
 
Loading...
Searching...
No Matches
debug_output.h
1#ifndef NXDK_PGRAPH_TESTS_DEBUG_OUTPUT_H
2#define NXDK_PGRAPH_TESTS_DEBUG_OUTPUT_H
3
4#pragma clang diagnostic push
5#pragma clang diagnostic ignored "-Wmacro-redefined"
6#include <windows.h>
7#pragma clang diagnostic pop
8
9#include <string>
10
11#include "printf/printf.h"
12
13#define ASSERT(c) \
14 if (!(c)) { \
15 PrintAssertAndWaitForever(#c, __FILE__, __LINE__); \
16 }
17
18template <typename... VarArgs>
19inline void PrintMsg(const char *fmt, VarArgs &&...args) {
20 int string_length = snprintf_(nullptr, 0, fmt, args...);
21 std::string buf;
22 buf.resize(string_length);
23
24 snprintf_(&buf[0], string_length + 1, fmt, args...);
25 DbgPrint("%s", buf.c_str());
26}
27
28[[noreturn]] void PrintAssertAndWaitForever(const char *assert_code, const char *filename, uint32_t line);
29
30#endif // NXDK_PGRAPH_TESTS_DEBUG_OUTPUT_H