From 25c4daa1648cce2b7dd87de9700d079fced5e1f0 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Thu, 16 Dec 2004 07:09:33 +0000 Subject: [PATCH] Freeldr will not load a UI if Timeout = 0, and will instead immediately load the default OS. svn path=/trunk/; revision=12149 --- freeldr/freeldr/bootmgr.c | 15 +++++++++++---- freeldr/freeldr/include/ui.h | 2 +- freeldr/freeldr/ui/ui.c | 18 +++++++++++++++++- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/freeldr/freeldr/bootmgr.c b/freeldr/freeldr/bootmgr.c index ffdbde98932..23fc12ed148 100644 --- a/freeldr/freeldr/bootmgr.c +++ b/freeldr/freeldr/bootmgr.c @@ -37,7 +37,6 @@ #include #include - VOID RunLoader(VOID) { UCHAR SettingName[80]; @@ -63,13 +62,15 @@ VOID RunLoader(VOID) MachConsGetCh(); return; } + TimeOut = GetTimeOut(); - if (!UiInitialize()) + if (!UiInitialize(TimeOut)) { printf("Press any key to reboot.\n"); MachConsGetCh(); return; } + if (!InitOperatingSystemList(&OperatingSystemSectionNames, &OperatingSystemDisplayNames, &OperatingSystemCount)) { @@ -84,7 +85,6 @@ VOID RunLoader(VOID) } DefaultOperatingSystem = GetDefaultOperatingSystem(OperatingSystemSectionNames, OperatingSystemCount); - TimeOut = GetTimeOut(); // // Find all the message box settings and run them @@ -93,6 +93,12 @@ VOID RunLoader(VOID) for (;;) { + + /* If Timeout is 0, don't even bother loading any gui */ + if (!UserInterfaceUp) { + goto NoGui; + } + // Redraw the backdrop UiDrawBackdrop(); @@ -102,6 +108,8 @@ VOID RunLoader(VOID) UiMessageBox("Press ENTER to reboot.\n"); goto reboot; } + +NoGui: TimeOut = -1; DefaultOperatingSystem = SelectedOperatingSystem; @@ -123,7 +131,6 @@ VOID RunLoader(VOID) // Install the drive mapper according to this sections drive mappings DriveMapMapDrivesInSection(OperatingSystemSectionNames[SelectedOperatingSystem]); - if (stricmp(SettingValue, "ReactOS") == 0) { LoadAndBootReactOS(OperatingSystemSectionNames[SelectedOperatingSystem]); diff --git a/freeldr/freeldr/include/ui.h b/freeldr/freeldr/include/ui.h index c8b0a58922d..34c7016c878 100644 --- a/freeldr/freeldr/include/ui.h +++ b/freeldr/freeldr/include/ui.h @@ -54,7 +54,7 @@ extern UCHAR UiMonthNames[12][15]; // User Interface Functions // /////////////////////////////////////////////////////////////////////////////////////// -BOOL UiInitialize(VOID); // Initialize User-Interface +BOOL UiInitialize(BOOLEAN ShowGui); // Initialize User-Interface VOID UiUnInitialize(PUCHAR BootText); // Un-initialize User-Interface VOID UiDrawBackdrop(VOID); // Fills the entire screen with a backdrop VOID UiFillArea(U32 Left, U32 Top, U32 Right, U32 Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr diff --git a/freeldr/freeldr/ui/ui.c b/freeldr/freeldr/ui/ui.c index 8767d04bf9a..b930e7f9174 100644 --- a/freeldr/freeldr/ui/ui.c +++ b/freeldr/freeldr/ui/ui.c @@ -59,13 +59,23 @@ BOOL UiUseSpecialEffects = FALSE; // Tells us if we should use fade effects UCHAR UiMonthNames[12][15] = { "January ", "February ", "March ", "April ", "May ", "June ", "July ", "August ", "September ", "October ", "November ", "December " }; -BOOL UiInitialize(VOID) +BOOL UiInitialize(BOOLEAN ShowGui) { U32 SectionId; UCHAR DisplayModeText[260]; UCHAR SettingText[260]; U32 Depth; + if (!ShowGui) { + if (!TuiInitialize()) + { + MachVideoSetDisplayMode(NULL, FALSE); + return FALSE; + } + UserInterfaceUp = FALSE; + return TRUE; + } + DbgPrint((DPRINT_UI, "Initializing User Interface.\n")); DbgPrint((DPRINT_UI, "Reading in UI settings from [Display] section.\n")); @@ -210,6 +220,8 @@ VOID UiUnInitialize(PUCHAR BootText) VOID UiDrawBackdrop(VOID) { + if (!UserInterfaceUp) return; + if (VideoTextMode == UiDisplayMode) { TuiDrawBackdrop(); @@ -288,6 +300,8 @@ VOID UiDrawCenteredText(U32 Left, U32 Top, U32 Right, U32 Bottom, PUCHAR TextStr VOID UiDrawStatusText(PUCHAR StatusText) { + if (!UserInterfaceUp) return; + if (VideoTextMode == UiDisplayMode) { TuiDrawStatusText(StatusText); @@ -453,6 +467,8 @@ UCHAR UiTextToFillStyle(PUCHAR FillStyleText) VOID UiDrawProgressBarCenter(U32 Position, U32 Range, PUCHAR ProgressText) { + if (!UserInterfaceUp) return; + if (VideoTextMode == UiDisplayMode) { TuiDrawProgressBarCenter(Position, Range, ProgressText);