diff --git a/stage23/entry.s3.c b/stage23/entry.s3.c index 51c0aa77..637ef8f1 100644 --- a/stage23/entry.s3.c +++ b/stage23/entry.s3.c @@ -24,6 +24,7 @@ #include #include #include +#include void stage3_common(void); @@ -162,8 +163,11 @@ void stage3_common(void) { print("Boot partition: %d\n", boot_volume->partition); } + bool disable_timeout = false; + +menu_again:; char *cmdline; - char *config = menu(&cmdline); + char *config = menu(&cmdline, disable_timeout); char *proto = config_get_value(config, 0, "PROTOCOL"); if (proto == NULL) { @@ -199,6 +203,13 @@ autodetect: print("WARNING: Incorrect protocol specified for kernel.\n"); } - print(" Attempting autodetection.\n"); - goto autodetect; + print(" Press A to attempt autodetection or any other key to return to menu.\n"); + + int c = getchar(); + if (c == 'a' || c == 'A') { + goto autodetect; + } else { + disable_timeout = true; + goto menu_again; + } } diff --git a/stage23/menu.c b/stage23/menu.c index d0b6d3e1..aa4e67b8 100644 --- a/stage23/menu.c +++ b/stage23/menu.c @@ -513,7 +513,7 @@ static size_t print_tree(const char *shift, size_t level, size_t base_index, siz return max_entries; } -char *menu(char **cmdline) { +char *menu(char **cmdline, bool disable_timeout) { menu_branding = config_get_value(NULL, 0, "MENU_BRANDING"); if (menu_branding == NULL) menu_branding = "Limine " LIMINE_VERSION; @@ -544,6 +544,10 @@ char *menu(char **cmdline) { timeout = strtoui(timeout_config, NULL, 10); } + if (disable_timeout) { + skip_timeout = true; + } + bool editor_enabled = true; char *editor_enabled_config = config_get_value(NULL, 0, "EDITOR_ENABLED"); if (!strcmp(editor_enabled_config, "no")) editor_enabled = false; diff --git a/stage23/menu.h b/stage23/menu.h index 5c93301b..4d6b1376 100644 --- a/stage23/menu.h +++ b/stage23/menu.h @@ -1,6 +1,8 @@ #ifndef __MENU_H__ #define __MENU_H__ -char *menu(char **cmdline_ret); +#include + +char *menu(char **cmdline_ret, bool disable_timeout); #endif