:: commit d47ca6d34be826bb14baf842477718e385a537ea

mintsuki <mintsuki@protonmail.com> — 2024-08-03 06:59

parents: 491a2fe188

menu: Fix issue where there terminal wouldn't be initialised where necessary

diff --git a/common/menu.c b/common/menu.c
index f5251f3d..23916069 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -858,6 +858,7 @@ noreturn void _menu(bool first_run) {
         print_tree(0, 0, NULL, 0, 0, selected_entry, menu_tree, &selected_menu_entry, NULL, NULL);
         if (selected_menu_entry == NULL || selected_menu_entry->sub != NULL) {
             quiet = false;
+            menu_init_term();
             print("Default entry is not valid or directory, booting to menu.\n");
             skip_timeout = true;
         } else {
@@ -865,11 +866,11 @@ noreturn void _menu(bool first_run) {
         }
     }
 
-    menu_init_term();
-
     size_t tree_offset = 0;
 
     if (config_format_old) {
+        quiet = false;
+        menu_init_term();
         print("The format of the config file has changed in Limine version 8.x.\n");
         print("\n");
         print("If the config file is named limine.cfg, Limine will still support the old\n");
@@ -881,6 +882,8 @@ noreturn void _menu(bool first_run) {
         pit_sleep_and_quit_on_keypress(20);
     }
 
+    menu_init_term();
+
 refresh:
     if (selected_entry >= tree_offset + terms[0]->rows - 8) {
         tree_offset = selected_entry - (terms[0]->rows - 9);
@@ -1148,6 +1151,7 @@ noreturn void boot(char *config) {
     } else if (!strcmp(proto, "linux")) {
 #if defined (__loongarch64)
         quiet = false;
+        menu_init_term();
         print("TODO: Linux is not available on LoongArch64.\n\n");
 #else
         linux_load(config, cmdline);
@@ -1157,6 +1161,7 @@ noreturn void boot(char *config) {
         multiboot1_load(config, cmdline);
 #else
         quiet = false;
+        menu_init_term();
         print("Multiboot 1 is not available on non-x86 architectures.\n\n");
 #endif
     } else if (!strcmp(proto, "multiboot2")) {
@@ -1164,6 +1169,7 @@ noreturn void boot(char *config) {
         multiboot2_load(config, cmdline);
 #else
         quiet = false;
+        menu_init_term();
         print("Multiboot 2 is not available on non-x86 architectures.\n\n");
 #endif
     } else if (!strcmp(proto, "chainload_next")) {
tab: 248 wrap: offon