Only show bootsplash during boot menu.
When the bootsplash picture is shown, it's not possible to see text. So, only display the picture while prompting the user for the boot menu.
diff --git a/src/biosvar.h b/src/biosvar.h index 415f958..2b755e3 100644 --- a/src/biosvar.h +++ b/src/biosvar.h @@ -222,7 +222,6 @@ struct extended_bios_data_area_s { u8 other2[0xC4];
// 0x121 - Begin custom storage. - u8 bootsplash_active; u8 ps2ctr; struct usbkeyinfo usbkey_last;
diff --git a/src/boot.c b/src/boot.c index 44964a7..021b8ac 100644 --- a/src/boot.c +++ b/src/boot.c @@ -227,7 +227,9 @@ interactive_bootmenu(void)
printf("Press F12 for boot menu.\n\n");
+ enable_bootsplash(); int scan_code = get_keystroke(CONFIG_BOOTMENU_WAIT); + disable_bootsplash(); if (scan_code != 0x86) /* not F12 */ return; @@ -343,9 +345,6 @@ boot_prep(void) static void call_boot_entry(u16 bootseg, u16 bootip, u8 bootdrv) { - /* Go back to text, the OS might expect it... (Can't do this any later) */ - disable_bootsplash(); - dprintf(1, "Booting from %04x:%04x\n", bootseg, bootip); struct bregs br; memset(&br, 0, sizeof(br)); @@ -430,7 +429,6 @@ boot_cbfs(struct ipl_entry_s *ie) return; if (count--) continue; - disable_bootsplash(); cbfs_run_payload(file); } } diff --git a/src/bootsplash.c b/src/bootsplash.c index 14bdd4c..8f42dfd 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -92,8 +92,8 @@ call16_int10(struct bregs *br) * VGA text / graphics console ****************************************************************/
-static void -enable_vga_text_console(void) +void +enable_vga_console(void) { dprintf(1, "Turning on vga text mode console\n"); struct bregs br; @@ -141,29 +141,27 @@ find_videomode(struct vesa_info *vesa_info, struct vesa_mode_info *mode_info } }
+static int BootsplashActive; + void -enable_vga_console(void) +enable_bootsplash(void) { - struct vesa_info *vesa_info = NULL; - struct vesa_mode_info *mode_info = NULL; - struct jpeg_decdata *jpeg = NULL; - u8 *filedata = NULL, *picture = NULL; - if (!CONFIG_BOOTSPLASH) - goto gotext; + return; dprintf(3, "Checking for bootsplash\n"); u32 file = romfile_find("bootsplash.jpg"); if (!file) - goto gotext; + return; int filesize = romfile_size(file);
- filedata = malloc_tmphigh(filesize); - vesa_info = malloc_tmplow(sizeof(*vesa_info)); - mode_info = malloc_tmplow(sizeof(*mode_info)); - jpeg = jpeg_alloc(); + u8 *picture = NULL; + u8 *filedata = malloc_tmphigh(filesize); + struct vesa_info *vesa_info = malloc_tmplow(sizeof(*vesa_info)); + struct vesa_mode_info *mode_info = malloc_tmplow(sizeof(*mode_info)); + struct jpeg_decdata *jpeg = jpeg_alloc(); if (!filedata || !jpeg || !vesa_info || !mode_info) { warn_noalloc(); - goto gotext; + goto done; }
/* Check whether we have a VESA 2.0 compliant BIOS */ @@ -177,7 +175,7 @@ enable_vga_console(void) call16_int10(&br); if (vesa_info->vesa_signature != VESA_SIGNATURE) { dprintf(1,"No VBE2 found.\n"); - goto gotext; + goto done; }
/* Print some debugging information about our card. */ @@ -194,7 +192,7 @@ enable_vga_console(void) int ret = jpeg_decode(jpeg, filedata); if (ret) { dprintf(1, "jpeg_decode failed with return code %d...\n", ret); - goto gotext; + goto done; } int width, height; jpeg_get_size(jpeg, &width, &height); @@ -202,7 +200,7 @@ enable_vga_console(void) // Try to find a graphics mode with the corresponding dimensions. int videomode = find_videomode(vesa_info, mode_info, width, height); if (videomode < 0) - goto gotext; + goto done; void *framebuffer = mode_info->phys_base_ptr; int depth = mode_info->bits_per_pixel; dprintf(3, "mode: %04x\n", videomode); @@ -215,13 +213,13 @@ enable_vga_console(void) picture = malloc_tmphigh(imagesize); if (!picture) { warn_noalloc(); - goto gotext; + goto done; } dprintf(5, "Decompressing bootsplash.jpg\n"); ret = jpeg_show(jpeg, picture, width, height, depth); if (ret) { dprintf(1, "jpeg_show failed with return code %d...\n", ret); - goto gotext; + goto done; }
/* Switch to graphics mode */ @@ -232,32 +230,29 @@ enable_vga_console(void) call16_int10(&br); if (br.ax != 0x4f) { dprintf(1, "set_mode failed.\n"); - goto gotext; + goto done; }
/* Show the picture */ dprintf(5, "Showing bootsplash.jpg\n"); iomemcpy(framebuffer, picture, imagesize); dprintf(5, "Bootsplash copy complete\n"); - SET_EBDA(bootsplash_active, 1); + BootsplashActive = 1;
-cleanup: +done: free(filedata); free(picture); free(vesa_info); free(mode_info); free(jpeg); return; -gotext: - enable_vga_text_console(); - goto cleanup; }
void disable_bootsplash(void) { - if (!CONFIG_BOOTSPLASH || !GET_EBDA(bootsplash_active)) + if (!CONFIG_BOOTSPLASH || !BootsplashActive) return; - SET_EBDA(bootsplash_active, 0); - enable_vga_text_console(); + BootsplashActive = 0; + enable_vga_console(); } diff --git a/src/post.c b/src/post.c index 56e5eb5..5d0e2cb 100644 --- a/src/post.c +++ b/src/post.c @@ -265,10 +265,6 @@ _start(void) // Write protect bios memory. make_bios_readonly();
- // Disable bootsplash if something has hooked int19. - if (GET_IVT(0x19).segoff != FUNC16(entry_19_official).segoff) - disable_bootsplash(); - // Invoke int 19 to start boot process. dprintf(3, "Jump to int19\n"); struct bregs br; diff --git a/src/util.h b/src/util.h index 45896c6..3d68d45 100644 --- a/src/util.h +++ b/src/util.h @@ -383,6 +383,7 @@ extern u32 RomEnd;
// bootsplash.c void enable_vga_console(void); +void enable_bootsplash(void); void disable_bootsplash(void);
// resume.c