X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=petitboot.c;h=ee6893032e6d033be6ddd9d6e8cac16c68a2695c;hp=0b6828b55847e79d38a96c20ecf5a16393232844;hb=469642a52fc3f3f1ffd3f29ae16286876500ff9a;hpb=72fe1a737385d8f52c33fe237214c4e9cb3c7c93 diff --git a/petitboot.c b/petitboot.c index 0b6828b..ee68930 100644 --- a/petitboot.c +++ b/petitboot.c @@ -1,3 +1,6 @@ + +#define _GNU_SOURCE + #include #include #include @@ -457,6 +460,7 @@ static void pboot_choose_option(void) pboot_option_t *opt = &dev->options[pboot_rpane->focus_curindex]; LOG("Selected device %s\n", opt->title); + pboot_message("booting %s...", opt->title); /* Give user feedback, make sure errors and panics will be seen */ pboot_exec_option(opt->data); @@ -791,8 +795,8 @@ twin_bool_t pboot_event_filter(twin_screen_t *screen, /* Another gross hack for booting back to gameos */ case KEY_BACKSPACE: case KEY_DELETE: + pboot_message("booting to GameOS..."); system(BOOT_GAMEOS_BIN); - pboot_quit(); } case TwinEventKeyUp: twin_screen_set_cursor(pboot_screen, NULL, 0, 0); @@ -920,16 +924,24 @@ static void pboot_spane_draw(twin_window_t *window) twin_path_destroy(path); } -void pboot_message(const char *message) +void pboot_message(const char *fmt, ...) { + va_list ap; + char *msg; + if (pboot_spane->text) free(pboot_spane->text); - pboot_spane->text = strdup(message); + + va_start(ap, fmt); + vasprintf(&msg, fmt, ap); + va_end(ap); + + pboot_spane->text = msg; twin_window_damage(pboot_spane->window, 0, 0, pboot_spane->window->pixmap->width, pboot_spane->window->pixmap->height); - twin_window_queue_paint(pboot_spane->window); + twin_window_draw(pboot_spane->window); } static void pboot_create_spane(void)