From: Yaroslav Kibysh Date: Mon, 19 Aug 2019 23:52:25 +0000 (+0300) Subject: [NTOS:INBV] Refactor boot screen code and resources (#1649) X-Git-Tag: 0.4.14-dev~265 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=238ea69ca0cc1c01332ea9f6211bb2ce3ffb371a [NTOS:INBV] Refactor boot screen code and resources (#1649) * [NTOS:INBV] Move typedefs to the only single file where they are used. * [NTOS:INBV] Refactor code & resources Remove garbage * [NTOS:INBV] Reduce fade time and remove wait for animation. --- diff --git a/ntoskrnl/inbv/inbv.c b/ntoskrnl/inbv/inbv.c index 5e96c978c2b..f5cd5652493 100644 --- a/ntoskrnl/inbv/inbv.c +++ b/ntoskrnl/inbv/inbv.c @@ -32,6 +32,27 @@ */ // #define REACTOS_SKUS +typedef struct _INBV_PROGRESS_STATE +{ + ULONG Floor; + ULONG Ceiling; + ULONG Bias; +} INBV_PROGRESS_STATE; + +typedef struct _BT_PROGRESS_INDICATOR +{ + ULONG Count; + ULONG Expected; + ULONG Percentage; +} BT_PROGRESS_INDICATOR, *PBT_PROGRESS_INDICATOR; + +typedef enum _ROT_BAR_TYPE +{ + RB_UNSPECIFIED, + RB_SQUARE_CELLS, + RB_PROGRESS_BAR +} ROT_BAR_TYPE; + /* * Screen resolution (for default VGA) */ @@ -155,8 +176,8 @@ typedef struct tagRGBQUAD static RGBQUAD MainPalette[16]; -#define PALETTE_FADE_STEPS 15 -#define PALETTE_FADE_TIME (20 * 1000) /* 20 ms */ +#define PALETTE_FADE_STEPS 12 +#define PALETTE_FADE_TIME (15 * 1000) /* 15 ms */ /** From bootvid/precomp.h **/ // @@ -1062,7 +1083,7 @@ VOID NTAPI DisplayBootBitmap(IN BOOLEAN TextMode) { - PVOID Header = NULL, Footer = NULL, Screen = NULL; + PVOID BootCopy = NULL, BootProgress = NULL, BootLogo = NULL, Header = NULL, Footer = NULL; #ifdef INBV_ROTBAR_IMPLEMENTED UCHAR Buffer[24 * 9]; @@ -1155,8 +1176,8 @@ DisplayBootBitmap(IN BOOLEAN TextMode) */ MmChangeKernelResourceSectionProtection(MM_READWRITE); - /* Load the standard boot screen */ - Screen = InbvGetResourceAddress(IDB_BOOT_SCREEN); + /* Load boot screen logo */ + BootLogo = InbvGetResourceAddress(IDB_LOGO_DEFAULT); #ifdef REACTOS_SKUS Text = NULL; @@ -1197,15 +1218,19 @@ DisplayBootBitmap(IN BOOLEAN TextMode) #endif /* Make sure we have a logo */ - if (Screen) + if (BootLogo) { /* Save the main image palette for implementing the fade-in effect */ - PBITMAPINFOHEADER BitmapInfoHeader = Screen; - LPRGBQUAD Palette = (LPRGBQUAD)((PUCHAR)Screen + BitmapInfoHeader->biSize); + PBITMAPINFOHEADER BitmapInfoHeader = BootLogo; + LPRGBQUAD Palette = (LPRGBQUAD)((PUCHAR)BootLogo + BitmapInfoHeader->biSize); RtlCopyMemory(MainPalette, Palette, sizeof(MainPalette)); - /* Blit the background */ - BitBltPalette(Screen, TRUE, 0, 0); + /* Draw the logo at the center of the screen */ + BitBltAligned(BootLogo, + TRUE, + AL_HORIZONTAL_CENTER, + AL_VERTICAL_CENTER, + 0, 0, 0, 34); #ifdef INBV_ROTBAR_IMPLEMENTED /* Choose progress bar */ @@ -1230,6 +1255,22 @@ DisplayBootBitmap(IN BOOLEAN TextMode) #endif } + /* Load and draw progress bar bitmap */ + BootProgress = InbvGetResourceAddress(IDB_PROGRESS_BAR); + BitBltAligned(BootProgress, + TRUE, + AL_HORIZONTAL_CENTER, + AL_VERTICAL_CENTER, + 0, 118, 0, 0); + + /* Load and draw copyright text bitmap */ + BootCopy = InbvGetResourceAddress(IDB_COPYRIGHT); + BitBltAligned(BootCopy, + TRUE, + AL_HORIZONTAL_LEFT, + AL_VERTICAL_BOTTOM, + 22, 0, 0, 20); + #ifdef REACTOS_SKUS /* Draw the SKU text if it exits */ if (Text) BitBltPalette(Text, TRUE, 180, 121); @@ -1309,14 +1350,6 @@ DisplayBootBitmap(IN BOOLEAN TextMode) RotBarSelection = TempRotBarSelection; InbvRotBarInit(); InbvReleaseLock(); - - // FIXME: This was added to allow animation start before the processor hangs - if (TempRotBarSelection != RB_UNSPECIFIED) - { - LARGE_INTEGER Delay; - Delay.QuadPart = -3000000; // 300 ms - KeDelayExecutionThread(KernelMode, FALSE, &Delay); - } } #endif } diff --git a/ntoskrnl/inbv/logo/1.bmp b/ntoskrnl/inbv/logo/1.bmp deleted file mode 100644 index dcc0ae71a55..00000000000 Binary files a/ntoskrnl/inbv/logo/1.bmp and /dev/null differ diff --git a/ntoskrnl/inbv/logo/5.bmp b/ntoskrnl/inbv/logo/5.bmp deleted file mode 100644 index 94fb7a9dfde..00000000000 Binary files a/ntoskrnl/inbv/logo/5.bmp and /dev/null differ diff --git a/ntoskrnl/inbv/logo/4.bmp b/ntoskrnl/inbv/resources/barserver.bmp similarity index 100% rename from ntoskrnl/inbv/logo/4.bmp rename to ntoskrnl/inbv/resources/barserver.bmp diff --git a/ntoskrnl/inbv/logo/8.bmp b/ntoskrnl/inbv/resources/barwksta.bmp similarity index 100% rename from ntoskrnl/inbv/logo/8.bmp rename to ntoskrnl/inbv/resources/barwksta.bmp diff --git a/ntoskrnl/inbv/resources/copyright.bmp b/ntoskrnl/inbv/resources/copyright.bmp new file mode 100644 index 00000000000..080e462c659 Binary files /dev/null and b/ntoskrnl/inbv/resources/copyright.bmp differ diff --git a/ntoskrnl/inbv/logo/15.bmp b/ntoskrnl/inbv/resources/fserver.bmp similarity index 100% rename from ntoskrnl/inbv/logo/15.bmp rename to ntoskrnl/inbv/resources/fserver.bmp diff --git a/ntoskrnl/inbv/logo/7.bmp b/ntoskrnl/inbv/resources/fwksta.bmp similarity index 100% rename from ntoskrnl/inbv/logo/7.bmp rename to ntoskrnl/inbv/resources/fwksta.bmp diff --git a/ntoskrnl/inbv/logo/2.bmp b/ntoskrnl/inbv/resources/hibernate.bmp similarity index 100% rename from ntoskrnl/inbv/logo/2.bmp rename to ntoskrnl/inbv/resources/hibernate.bmp diff --git a/ntoskrnl/inbv/logo/14.bmp b/ntoskrnl/inbv/resources/hserver.bmp similarity index 100% rename from ntoskrnl/inbv/logo/14.bmp rename to ntoskrnl/inbv/resources/hserver.bmp diff --git a/ntoskrnl/inbv/logo/6.bmp b/ntoskrnl/inbv/resources/hwksta.bmp similarity index 100% rename from ntoskrnl/inbv/logo/6.bmp rename to ntoskrnl/inbv/resources/hwksta.bmp diff --git a/ntoskrnl/inbv/logo/line.bmp b/ntoskrnl/inbv/resources/line.bmp similarity index 100% rename from ntoskrnl/inbv/logo/line.bmp rename to ntoskrnl/inbv/resources/line.bmp diff --git a/ntoskrnl/inbv/resources/line_pal.bmp b/ntoskrnl/inbv/resources/line_pal.bmp new file mode 100644 index 00000000000..5209c246efb Binary files /dev/null and b/ntoskrnl/inbv/resources/line_pal.bmp differ diff --git a/ntoskrnl/inbv/resources/logo.bmp b/ntoskrnl/inbv/resources/logo.bmp new file mode 100644 index 00000000000..53ec10c20c4 Binary files /dev/null and b/ntoskrnl/inbv/resources/logo.bmp differ diff --git a/ntoskrnl/inbv/resources/progress.bmp b/ntoskrnl/inbv/resources/progress.bmp new file mode 100644 index 00000000000..35fd2066714 Binary files /dev/null and b/ntoskrnl/inbv/resources/progress.bmp differ diff --git a/ntoskrnl/inbv/logo/3.bmp b/ntoskrnl/inbv/resources/shutdown.bmp similarity index 100% rename from ntoskrnl/inbv/logo/3.bmp rename to ntoskrnl/inbv/resources/shutdown.bmp diff --git a/ntoskrnl/include/internal/inbv.h b/ntoskrnl/include/internal/inbv.h index 3fb6669a584..4f9903e2501 100644 --- a/ntoskrnl/include/internal/inbv.h +++ b/ntoskrnl/include/internal/inbv.h @@ -1,26 +1,5 @@ #pragma once -typedef struct _INBV_PROGRESS_STATE -{ - ULONG Floor; - ULONG Ceiling; - ULONG Bias; -} INBV_PROGRESS_STATE; - -typedef struct _BT_PROGRESS_INDICATOR -{ - ULONG Count; - ULONG Expected; - ULONG Percentage; -} BT_PROGRESS_INDICATOR, *PBT_PROGRESS_INDICATOR; - -typedef enum _ROT_BAR_TYPE -{ - RB_UNSPECIFIED, - RB_SQUARE_CELLS, - RB_PROGRESS_BAR -} ROT_BAR_TYPE; - INIT_FUNCTION VOID NTAPI diff --git a/ntoskrnl/include/resource.h b/ntoskrnl/include/resource.h index bb400bb3151..e2537b465f5 100644 --- a/ntoskrnl/include/resource.h +++ b/ntoskrnl/include/resource.h @@ -40,5 +40,7 @@ /* ReactOS additions */ #define IDB_ROTATING_LINE 19 +#define IDB_PROGRESS_BAR 20 +#define IDB_COPYRIGHT 21 -#define IDB_MAX_RESOURCE IDB_ROTATING_LINE +#define IDB_MAX_RESOURCE IDB_COPYRIGHT diff --git a/ntoskrnl/ntoskrnl.rc b/ntoskrnl/ntoskrnl.rc index 0a01fe32228..8f1888516ec 100644 --- a/ntoskrnl/ntoskrnl.rc +++ b/ntoskrnl/ntoskrnl.rc @@ -28,17 +28,18 @@ #include -IDB_BOOT_SCREEN BITMAP "inbv/logo/1.bmp" -IDB_HIBERNATE_BAR BITMAP "inbv/logo/2.bmp" -IDB_SHUTDOWN_MSG BITMAP "inbv/logo/3.bmp" -IDB_BAR_DEFAULT BITMAP "inbv/logo/4.bmp" -IDB_LOGO_DEFAULT BITMAP "inbv/logo/5.bmp" -IDB_WKSTA_HEADER BITMAP "inbv/logo/6.bmp" -IDB_WKSTA_FOOTER BITMAP "inbv/logo/7.bmp" -IDB_BAR_WKSTA BITMAP "inbv/logo/8.bmp" -IDB_SERVER_LOGO BITMAP "inbv/logo/5.bmp" -IDB_SERVER_HEADER BITMAP "inbv/logo/14.bmp" -IDB_SERVER_FOOTER BITMAP "inbv/logo/15.bmp" +IDB_HIBERNATE_BAR BITMAP "inbv/resources/hibernate.bmp" +IDB_SHUTDOWN_MSG BITMAP "inbv/resources/shutdown.bmp" +IDB_BAR_DEFAULT BITMAP "inbv/resources/barserver.bmp" +IDB_LOGO_DEFAULT BITMAP "inbv/resources/logo.bmp" +IDB_WKSTA_HEADER BITMAP "inbv/resources/hwksta.bmp" +IDB_WKSTA_FOOTER BITMAP "inbv/resources/fwksta.bmp" +IDB_BAR_WKSTA BITMAP "inbv/resources/barwksta.bmp" +IDB_SERVER_LOGO BITMAP "inbv/resources/logo.bmp" +IDB_SERVER_HEADER BITMAP "inbv/resources/hserver.bmp" +IDB_SERVER_FOOTER BITMAP "inbv/resources/fserver.bmp" /* ReactOS additions */ -IDB_ROTATING_LINE BITMAP "inbv/logo/line.bmp" +IDB_ROTATING_LINE BITMAP "inbv/resources/line.bmp" +IDB_PROGRESS_BAR BITMAP "inbv/resources/progress.bmp" +IDB_COPYRIGHT BITMAP "inbv/resources/copyright.bmp"