return EFI_SUCCESS;
}
-EFI_STATUS graphics_splash(EFI_FILE *root_dir, CHAR16 *path) {
+EFI_STATUS graphics_splash(EFI_FILE *root_dir, CHAR16 *path,
+ const EFI_GRAPHICS_OUTPUT_BLT_PIXEL *background) {
EFI_GUID GraphicsOutputProtocolGuid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput = NULL;
UINT8 *content;
err = LibLocateProtocol(&GraphicsOutputProtocolGuid, (VOID **)&GraphicsOutput);
if (EFI_ERROR(err))
- goto err;
+ return err;
len = file_read(root_dir, path, &content);
if (len < 0)
if(dib->y < GraphicsOutput->Mode->Info->VerticalResolution)
y_pos = (GraphicsOutput->Mode->Info->VerticalResolution - dib->y) / 2;
+ if (background)
+ uefi_call_wrapper(GraphicsOutput->Blt, 10, GraphicsOutput,
+ (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)background,
+ EfiBltVideoFill, 0, 0, 0, 0,
+ GraphicsOutput->Mode->Info->HorizontalResolution,
+ GraphicsOutput->Mode->Info->VerticalResolution, 0);
+
/* EFI buffer */
blt_size = dib->x * dib->y * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
blt = AllocatePool(blt_size);
CHAR8 *b;
UINTN size;
EFI_STATUS err;
+ UINTN color = 0;
+ const EFI_GRAPHICS_OUTPUT_BLT_PIXEL *pixel = NULL;
uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut, EFI_LIGHTGRAY|EFI_BACKGROUND_BLACK);
uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);
- err = EFI_NOT_FOUND;
- if (config->splash)
- err = graphics_splash(root_dir, config->splash);
- if (EFI_ERROR(err))
- err = graphics_splash(root_dir, L"\\EFI\\gummiboot\\splash.bmp");
- if (!EFI_ERROR(err)) {
- console_key_read(&key, TRUE);
+ for (;;) {
+
+ err = EFI_NOT_FOUND;
+ if (config->splash)
+ err = graphics_splash(root_dir, config->splash, pixel);
+ if (EFI_ERROR(err))
+ err = graphics_splash(root_dir, L"\\EFI\\gummiboot\\splash.bmp", pixel);
+ if (!EFI_ERROR(err)) {
+ static const EFI_GRAPHICS_OUTPUT_BLT_PIXEL colors[] = {
+ { .Red = 255, .Green = 255, .Blue = 255 },
+ { .Red = 255, .Green = 0, .Blue = 0 },
+ { .Red = 0, .Green = 255, .Blue = 0 },
+ { .Red = 0, .Green = 0, .Blue = 255 },
+ { .Red = 0, .Green = 0, .Blue = 0 },
+ };
+
+ console_key_read(&key, TRUE);
+
+ /* 'b' rotates through background colors */
+ if (key == KEYPRESS(0, 0, 'b')) {
+ pixel = &colors[color++];
+ if (color == ELEMENTSOF(colors))
+ color = 0;
+
+ continue;
+ }
+ }
+
graphics_mode(FALSE);
uefi_call_wrapper(ST->ConOut->EnableCursor, 2, ST->ConOut, FALSE);
+ break;
}
Print(L"gummiboot version: " VERSION "\n");
entry = config->entries[i];
if (entry->splash) {
- err = graphics_splash(root_dir, entry->splash);
+ err = graphics_splash(root_dir, entry->splash, NULL);
if (!EFI_ERROR(err)) {
console_key_read(&key, TRUE);
graphics_mode(FALSE);
if (entry->splash[0] == '\0')
err = EFI_SUCCESS;
else
- err = graphics_splash(root_dir, entry->splash);
+ err = graphics_splash(root_dir, entry->splash, NULL);
}
/* splash from config file */
if (EFI_ERROR(err) && config.splash)
- err = graphics_splash(root_dir, config.splash);
+ err = graphics_splash(root_dir, config.splash, NULL);
/* default splash */
if (EFI_ERROR(err))
- graphics_splash(root_dir, L"\\EFI\\gummiboot\\splash.bmp");
+ graphics_splash(root_dir, L"\\EFI\\gummiboot\\splash.bmp", NULL);
}
/* export the selected boot entry to the system */