[NTOS:INBV] Refactor boot screen code and resources (#1649)
authorYaroslav Kibysh <yanet.prod@gmail.com>
Mon, 19 Aug 2019 23:52:25 +0000 (02:52 +0300)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Mon, 19 Aug 2019 23:52:25 +0000 (01:52 +0200)
* [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.

19 files changed:
ntoskrnl/inbv/inbv.c
ntoskrnl/inbv/logo/1.bmp [deleted file]
ntoskrnl/inbv/logo/5.bmp [deleted file]
ntoskrnl/inbv/resources/barserver.bmp [moved from ntoskrnl/inbv/logo/4.bmp with 100% similarity]
ntoskrnl/inbv/resources/barwksta.bmp [moved from ntoskrnl/inbv/logo/8.bmp with 100% similarity]
ntoskrnl/inbv/resources/copyright.bmp [new file with mode: 0644]
ntoskrnl/inbv/resources/fserver.bmp [moved from ntoskrnl/inbv/logo/15.bmp with 100% similarity]
ntoskrnl/inbv/resources/fwksta.bmp [moved from ntoskrnl/inbv/logo/7.bmp with 100% similarity]
ntoskrnl/inbv/resources/hibernate.bmp [moved from ntoskrnl/inbv/logo/2.bmp with 100% similarity]
ntoskrnl/inbv/resources/hserver.bmp [moved from ntoskrnl/inbv/logo/14.bmp with 100% similarity]
ntoskrnl/inbv/resources/hwksta.bmp [moved from ntoskrnl/inbv/logo/6.bmp with 100% similarity]
ntoskrnl/inbv/resources/line.bmp [moved from ntoskrnl/inbv/logo/line.bmp with 100% similarity]
ntoskrnl/inbv/resources/line_pal.bmp [new file with mode: 0644]
ntoskrnl/inbv/resources/logo.bmp [new file with mode: 0644]
ntoskrnl/inbv/resources/progress.bmp [new file with mode: 0644]
ntoskrnl/inbv/resources/shutdown.bmp [moved from ntoskrnl/inbv/logo/3.bmp with 100% similarity]
ntoskrnl/include/internal/inbv.h
ntoskrnl/include/resource.h
ntoskrnl/ntoskrnl.rc

index 5e96c97..f5cd565 100644 (file)
  */
 // #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 (file)
index dcc0ae7..0000000
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 (file)
index 94fb7a9..0000000
Binary files a/ntoskrnl/inbv/logo/5.bmp and /dev/null differ
diff --git a/ntoskrnl/inbv/resources/copyright.bmp b/ntoskrnl/inbv/resources/copyright.bmp
new file mode 100644 (file)
index 0000000..080e462
Binary files /dev/null and b/ntoskrnl/inbv/resources/copyright.bmp differ
diff --git a/ntoskrnl/inbv/resources/line_pal.bmp b/ntoskrnl/inbv/resources/line_pal.bmp
new file mode 100644 (file)
index 0000000..5209c24
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 (file)
index 0000000..53ec10c
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 (file)
index 0000000..35fd206
Binary files /dev/null and b/ntoskrnl/inbv/resources/progress.bmp differ
index 3fb6669..4f9903e 100644 (file)
@@ -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
index bb400bb..e2537b4 100644 (file)
@@ -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
index 0a01fe3..8f18885 100644 (file)
 
 #include <bugcodes.rc>
 
-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"