5.3 File Backend
Writes debug output to a file (on host via dcload or on VMU):
void d3tui_debug_file_init(const char *path) {
file_path = strdup(path);
file_handle = fopen(path, "w");
d3tui_debug_backend_t backend = {
.name = "file",
.write = d3tui_debug_file_write,
.flush = d3tui_debug_file_flush,
.userdata = file_handle
};
d3tui_debug_add_backend(&backend);
}
void d3tui_debug_file_write(const char *msg, size_t len) {
if (file_handle) {
fwrite(msg, 1, len, file_handle);
}
}
void d3tui_debug_file_flush(void) {
if (file_handle) {
fflush(file_handle);
}
}