diff --git a/common/drivers/vga_textmode.c b/common/drivers/vga_textmode.c index 501d9006..9cabef49 100644 --- a/common/drivers/vga_textmode.c +++ b/common/drivers/vga_textmode.c @@ -255,7 +255,7 @@ static void text_deinit(struct term_context *_ctx, void (*_free)(void *, size_t) static struct textmode_context term_local_struct; void vga_textmode_init(bool managed) { - if (quiet || allocations_disallowed) { + if (quiet) { return; } diff --git a/common/lib/gterm.c b/common/lib/gterm.c index 6b9165c5..d61ace4c 100644 --- a/common/lib/gterm.c +++ b/common/lib/gterm.c @@ -536,14 +536,12 @@ static bool last_serial = false; static char *last_config = NULL; bool gterm_init(char *config, size_t width, size_t height) { - if (quiet || allocations_disallowed) { + if (quiet) { return false; } - if (current_video_mode >= 0 -#if defined (BIOS) - && current_video_mode != 0x03 -#endif + if (term != NULL + && term_backend == GTERM && fbinfo.default_res == true && width == 0 && height == 0 @@ -554,10 +552,8 @@ bool gterm_init(char *config, size_t width, size_t height) { return true; } - if (current_video_mode >= 0 -#if defined (BIOS) - && current_video_mode != 0x03 -#endif + if (term != NULL + && term_backend == GTERM && fbinfo.framebuffer_width == width && fbinfo.framebuffer_height == height && fbinfo.framebuffer_bpp == 32 diff --git a/common/menu.c b/common/menu.c index 5d993de3..c0aabb64 100644 --- a/common/menu.c +++ b/common/menu.c @@ -564,7 +564,13 @@ static void menu_init_term(void) { if (menu_resolution != NULL) parse_resolution(&req_width, &req_height, &req_bpp, menu_resolution); - gterm_init(NULL, req_width, req_height); + if (!gterm_init(NULL, req_width, req_height)) { +#if defined (BIOS) + vga_textmode_init(true); +#elif defined (UEFI) + panic(true, "menu: Failed to initialise terminal"); +#endif + } } else { #if defined (BIOS) vga_textmode_init(true); @@ -844,11 +850,13 @@ timeout_aborted: } if (term_backend == FALLBACK) { gterm_init(NULL, 0, 0); + if (term == NULL) { #if defined (BIOS) - if (term_backend == FALLBACK) { vga_textmode_init(true); - } +#elif defined (UEFI) + panic(true, "menu: Failed to initialise terminal"); #endif + } } else { reset_term(); } diff --git a/common/protos/limine.c b/common/protos/limine.c index 659f2579..3144c176 100644 --- a/common/protos/limine.c +++ b/common/protos/limine.c @@ -689,7 +689,7 @@ FEAT_START gterm_init(NULL, req_width, req_height); } - if (current_video_mode < 0) { + if (term == NULL) { panic(true, "limine: Failed to initialise terminal"); }