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
41
42
43
44
45
46
47
48
49
50
51
|
#include "util.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef __3DS__
#include <3ds.h>
static void panic_begin(void) { consoleInit(GFX_TOP, NULL); }
static noreturn void panic(void) {
printf("\nPress Start to exit.\n");
while (aptMainLoop()) {
hidScanInput();
u32 keys = hidKeysDown();
if (keys & KEY_START)
break;
gfxFlushBuffers();
gfxSwapBuffers();
gspWaitForVBlank();
}
gfxExit();
exit(1);
}
#else
static void panic_begin(void) {}
static noreturn void panic(void) { abort(); }
#endif
noreturn void assume__failed(const char *file, int line, const char *expr) {
panic_begin();
fprintf(stderr, "%s:%d: assertion failed: %s\n", file, line, expr);
panic();
}
noreturn void todo__impl(const char *file, int line, const char *fmt, ...) {
panic_begin();
printf("%s:%d: TODO: ", file, line);
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
panic();
}
|