From 0c5f2d18b67f66ef2652299a2b62fadccb11fd94 Mon Sep 17 00:00:00 2001 From: Rafal Kupiec Date: Sat, 23 Dec 2023 10:14:42 +0100 Subject: [PATCH] Quick fixes and improvements to BlDisplayBootMenu() --- xtldr2/textui.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/xtldr2/textui.c b/xtldr2/textui.c index fa2fb93..14dd121 100644 --- a/xtldr2/textui.c +++ b/xtldr2/textui.c @@ -1063,8 +1063,7 @@ BlDisplayBootMenu() EfiSystemTable->BootServices->SetTimer(TimerEvent, TimerCancel, 0); /* Remove the timer message */ - BlSetCursorPosition(4, Handle.PosY + Handle.Height + 4); - BlConsolePrint(L" ", TimeOut); + BlClearConsoleLine(Handle.PosY + Handle.Height + 4); } /* Read key stroke */ @@ -1073,6 +1072,12 @@ BlDisplayBootMenu() if(Key.ScanCode == 0x03 || Key.UnicodeChar == 0x0D) { /* ENTER or RightArrow key pressed, boot the highlighted OS */ + BlSetConsoleAttributes(Handle.DialogColor | Handle.TextColor); + BlClearConsoleLine(Handle.PosY + Handle.Height + 4); + BlSetCursorPosition(4, Handle.PosY + Handle.Height + 4); + BlConsolePrint(L"Booting '%S' now...", MenuEntries[HighligtedEntryId].EntryName); + + /* Boot the highlighted (chosen) OS */ BlDisplayInfoDialog(L"XTLDR", L"Booting highlighted OS ..."); /* Break from boot menu event loop to redraw whole boot menu */ @@ -1150,16 +1155,17 @@ BlDisplayBootMenu() if(TimeOut > 0) { /* Update a message and decrease timeout value */ + BlClearConsoleLine(Handle.PosY + Handle.Height + 4); BlSetCursorPosition(4, Handle.PosY + Handle.Height + 4); - BlConsolePrint(L"The highlighted position will be booted automatically in %ld seconds. ", TimeOut); + BlConsolePrint(L"The highlighted position will be booted automatically in %ld seconds.", TimeOut); TimeOut--; } else if(TimeOut == 0) { /* Time out expired, update a message */ + BlClearConsoleLine(Handle.PosY + Handle.Height + 4); BlSetCursorPosition(4, Handle.PosY + Handle.Height + 4); - BlConsolePrint(L"Booting '%S' now... ", - MenuEntries[HighligtedEntryId].EntryName); + BlConsolePrint(L"Booting '%S' now...", MenuEntries[HighligtedEntryId].EntryName); /* Disable the timer just in case booting OS fails */ TimeOut = -1;