/* Debug menu commands */
static d3tui_debug_command_t debug_commands[] = {
    {"dump_memory", d3tui_cmd_dump_memory, "Dump memory statistics"},
    {"screenshot", d3tui_cmd_screenshot, "Capture screenshot"},
    {"toggle_profiler", d3tui_cmd_toggle_profiler, "Toggle profiler overlay"},
    {"exit", d3tui_cmd_exit_menu, "Exit debug menu"},
    {NULL, NULL, NULL}
};

void d3tui_debug_menu_init(void) {
    for (int i = 0; debug_commands[i].name != NULL; i++) {
        d3tui_debug_menu_add_command(debug_commands[i]);
    }
}

void d3tui_cmd_dump_memory(void) {
    size_t total, current, peak, count;
    d3tui_mem_get_stats(&total, &current, &peak, &count);
    d3tui_log_info("Memory Stats: total=%zu, current=%zu, peak=%zu, count=%zu",
                  total, current, peak, count);
}

void d3tui_cmd_screenshot(void) {
    char path[64];
    snprintf(path, sizeof(path), "/pc/d3tui-%08X.png", timer_ms_gettime64());
    d3tui_screenshot_capture(path);
    d3tui_log_info("Screenshot saved to %s", path);
}