blob: d2c32b261c89b84c4153b77fa86770e6fc1bfc3d (
plain)
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
|
#include <stdlib.h>
#include "errcatch.h"
#include "ui.h"
char *w2_err_format(w2_s_error *error) {
char *ret_str = malloc(32);
sprintf(ret_str, "hai, 0x%02x", error->code);
return ret_str;
}
void w2_ui_tab_errcatch(bool first) {
g_w2_ui_pad_body_scroll = 5 - g_w2_ui_height;
unsigned int line = 0;
for (unsigned int x = 0; x < W2_ERRCATCH_LOG_SIZE; x++) {
unsigned int i = (x + g_w2_error_log_index) % W2_ERRCATCH_LOG_SIZE;
if (g_w2_error_log[i] == NULL) continue;
wmove(g_w2_ui_pad_body, line, 0);
char *err_str = w2_err_format(g_w2_error_log[i]);
waddstr(g_w2_ui_pad_body, err_str);
free(err_str);
line++;
}
g_w2_ui_pad_body_scroll += line;
}
|