From 44e47816004c2c857ef2caadf95dfc9970d47690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Wed, 24 Dec 2025 23:06:13 +0100 Subject: [PATCH] [BOOTVID] Split common.c into graphics-specific and console (in console.c) parts (#8547) In addition: - move back common function prototypes to precomp.h; - const-ify `VidpFontData` and adjust its usages; - improve SAL annotations for `InitPaletteWithTable()`; - rename the (Vid)ResetDisplay() parameter to "SetMode". --- drivers/base/bootvid/CMakeLists.txt | 1 + drivers/base/bootvid/arm/arm.h | 20 +- drivers/base/bootvid/arm/bootvid.c | 23 +-- drivers/base/bootvid/common.c | 153 --------------- drivers/base/bootvid/console.c | 181 ++++++++++++++++++ drivers/base/bootvid/fontdata.c | 2 +- drivers/base/bootvid/i386/pc/bootvid.c | 23 +-- drivers/base/bootvid/i386/pc/pc.h | 20 +- drivers/base/bootvid/i386/pc/vga.c | 7 +- drivers/base/bootvid/i386/pc98/bootvid.c | 19 +- drivers/base/bootvid/i386/pc98/pc98.h | 24 +-- drivers/base/bootvid/i386/xbox/bootvid.c | 22 +-- drivers/base/bootvid/i386/xbox/xbox.h | 25 +-- drivers/base/bootvid/precomp.h | 32 +++- sdk/include/reactos/drivers/bootvid/bootvid.h | 2 +- 15 files changed, 248 insertions(+), 306 deletions(-) create mode 100644 drivers/base/bootvid/console.c diff --git a/drivers/base/bootvid/CMakeLists.txt b/drivers/base/bootvid/CMakeLists.txt index 6900b31fb33..bf1ae30dc56 100644 --- a/drivers/base/bootvid/CMakeLists.txt +++ b/drivers/base/bootvid/CMakeLists.txt @@ -27,6 +27,7 @@ endif() list(APPEND SOURCE common.c + console.c fontdata.c precomp.h) diff --git a/drivers/base/bootvid/arm/arm.h b/drivers/base/bootvid/arm/arm.h index 0eb86681796..621f77bd6cf 100644 --- a/drivers/base/bootvid/arm/arm.h +++ b/drivers/base/bootvid/arm/arm.h @@ -31,7 +31,7 @@ extern PUSHORT VgaArmBase; VOID InitPaletteWithTable( - _In_ PULONG Table, + _In_reads_(Count) const ULONG* Table, _In_ ULONG Count); VOID @@ -42,21 +42,3 @@ SetPixel( _In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color); - -VOID -PreserveRow( - _In_ ULONG CurrentTop, - _In_ ULONG TopDelta, - _In_ BOOLEAN Restore); - -VOID -DoScroll( - _In_ ULONG Scroll); - -VOID -DisplayCharacter( - _In_ CHAR Character, - _In_ ULONG Left, - _In_ ULONG Top, - _In_ ULONG TextColor, - _In_ ULONG BackColor); diff --git a/drivers/base/bootvid/arm/bootvid.c b/drivers/base/bootvid/arm/bootvid.c index 88ffe00a19e..178696e9fe7 100644 --- a/drivers/base/bootvid/arm/bootvid.c +++ b/drivers/base/bootvid/arm/bootvid.c @@ -62,7 +62,7 @@ DisplayCharacter( _In_ ULONG TextColor, _In_ ULONG BackColor) { - PUCHAR FontChar; + const UCHAR* FontChar; ULONG i, j, XOffset; /* Get the font line for this character */ @@ -209,7 +209,7 @@ VidpInitializeDisplay(VOID) VOID InitPaletteWithTable( - _In_ PULONG Table, + _In_reads_(Count) const ULONG* Table, _In_ ULONG Count) { UNIMPLEMENTED; @@ -251,24 +251,13 @@ VidInitialize( } VOID -NTAPI -VidResetDisplay( - _In_ BOOLEAN HalReset) +ResetDisplay( + _In_ BOOLEAN SetMode) { - // - // Clear the current position - // - VidpCurrentX = 0; - VidpCurrentY = 0; - - // - // Re-initialize the VGA Display - // + /* Re-initialize the display */ VidpInitializeDisplay(); - // - // Re-initialize the palette and fill the screen black - // + /* Re-initialize the palette and fill the screen black */ InitializePalette(); VidSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, BV_COLOR_BLACK); } diff --git a/drivers/base/bootvid/common.c b/drivers/base/bootvid/common.c index 9a58081a5d0..0e6a4ed1dde 100644 --- a/drivers/base/bootvid/common.c +++ b/drivers/base/bootvid/common.c @@ -11,19 +11,6 @@ /* GLOBALS ********************************************************************/ -UCHAR VidpTextColor = BV_COLOR_WHITE; - -ULONG VidpCurrentX = 0; -ULONG VidpCurrentY = 0; - -ULONG VidpScrollRegion[4] = -{ - 0, - 0, - SCREEN_WIDTH - 1, - SCREEN_HEIGHT - 1 -}; - /* * Boot video driver default palette is similar to the standard 16-color * CGA palette, but it has Red and Blue channels swapped, and also dark @@ -49,8 +36,6 @@ const RGBQUAD VidpDefaultPalette[BV_MAX_COLORS] = RGB(255, 255, 255), /* White */ }; -static BOOLEAN ClearRow = FALSE; - /* PRIVATE FUNCTIONS **********************************************************/ static VOID @@ -310,144 +295,6 @@ RleBitBlt( /* PUBLIC FUNCTIONS ***********************************************************/ -ULONG -NTAPI -VidSetTextColor( - _In_ ULONG Color) -{ - ULONG OldColor; - - /* Save the old color and set the new one */ - OldColor = VidpTextColor; - VidpTextColor = Color; - return OldColor; -} - -VOID -NTAPI -VidDisplayStringXY( - _In_z_ PUCHAR String, - _In_ ULONG Left, - _In_ ULONG Top, - _In_ BOOLEAN Transparent) -{ - ULONG BackColor; - - /* - * If the caller wanted transparent, then send the special value (16), - * else use our default and call the helper routine. - */ - BackColor = Transparent ? BV_COLOR_NONE : BV_COLOR_LIGHT_CYAN; - - /* Loop every character and adjust the position */ - for (; *String; ++String, Left += BOOTCHAR_WIDTH) - { - /* Display a character */ - DisplayCharacter(*String, Left, Top, BV_COLOR_LIGHT_BLUE, BackColor); - } -} - -VOID -NTAPI -VidSetScrollRegion( - _In_ ULONG Left, - _In_ ULONG Top, - _In_ ULONG Right, - _In_ ULONG Bottom) -{ - /* Assert alignment */ - ASSERT((Left % BOOTCHAR_WIDTH) == 0); - ASSERT((Right % BOOTCHAR_WIDTH) == BOOTCHAR_WIDTH - 1); - - /* Set Scroll Region */ - VidpScrollRegion[0] = Left; - VidpScrollRegion[1] = Top; - VidpScrollRegion[2] = Right; - VidpScrollRegion[3] = Bottom; - - /* Set current X and Y */ - VidpCurrentX = Left; - VidpCurrentY = Top; -} - -VOID -NTAPI -VidDisplayString( - _In_z_ PUCHAR String) -{ - /* Start looping the string */ - for (; *String; ++String) - { - /* Treat new-line separately */ - if (*String == '\n') - { - /* Modify Y position */ - VidpCurrentY += BOOTCHAR_HEIGHT + 1; - if (VidpCurrentY + BOOTCHAR_HEIGHT > VidpScrollRegion[3]) - { - /* Scroll the view and clear the current row */ - DoScroll(BOOTCHAR_HEIGHT + 1); - VidpCurrentY -= BOOTCHAR_HEIGHT + 1; - PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, TRUE); - } - else - { - /* Preserve the current row */ - PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, FALSE); - } - - /* Update current X */ - VidpCurrentX = VidpScrollRegion[0]; - - /* No need to clear this row */ - ClearRow = FALSE; - } - else if (*String == '\r') - { - /* Update current X */ - VidpCurrentX = VidpScrollRegion[0]; - - /* If a new-line does not follow we will clear the current row */ - if (String[1] != '\n') ClearRow = TRUE; - } - else - { - /* Clear the current row if we had a return-carriage without a new-line */ - if (ClearRow) - { - PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, TRUE); - ClearRow = FALSE; - } - - /* Display this character */ - DisplayCharacter(*String, VidpCurrentX, VidpCurrentY, VidpTextColor, BV_COLOR_NONE); - VidpCurrentX += BOOTCHAR_WIDTH; - - /* Check if we should scroll */ - if (VidpCurrentX + BOOTCHAR_WIDTH - 1 > VidpScrollRegion[2]) - { - /* Update Y position and check if we should scroll it */ - VidpCurrentY += BOOTCHAR_HEIGHT + 1; - if (VidpCurrentY + BOOTCHAR_HEIGHT > VidpScrollRegion[3]) - { - /* Scroll the view and clear the current row */ - DoScroll(BOOTCHAR_HEIGHT + 1); - VidpCurrentY -= BOOTCHAR_HEIGHT + 1; - PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, TRUE); - } - else - { - /* Preserve the current row */ - PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, FALSE); - } - - /* Update current X */ - VidpCurrentX = VidpScrollRegion[0]; - } - } - } -} - VOID NTAPI VidBufferToScreenBlt( diff --git a/drivers/base/bootvid/console.c b/drivers/base/bootvid/console.c new file mode 100644 index 00000000000..51b514330bc --- /dev/null +++ b/drivers/base/bootvid/console.c @@ -0,0 +1,181 @@ +/* + * PROJECT: ReactOS Boot Video Driver + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) + * PURPOSE: Platform-independent console functionality + * COPYRIGHT: Copyright 2010 Gregor Schneider + * Copyright 2011 Rafal Harabien + * Copyright 2020 Stanislav Motylkov + */ + +#include "precomp.h" + +/* GLOBALS ********************************************************************/ + +UCHAR VidpTextColor = BV_COLOR_WHITE; + +ULONG VidpCurrentX = 0; +ULONG VidpCurrentY = 0; + +ULONG VidpScrollRegion[4] = +{ + 0, + 0, + SCREEN_WIDTH - 1, + SCREEN_HEIGHT - 1 +}; + +static BOOLEAN ClearRow = FALSE; + +/* PUBLIC FUNCTIONS ***********************************************************/ + +VOID +NTAPI +VidResetDisplay( + _In_ BOOLEAN SetMode) +{ + /* Clear the current position */ + VidpCurrentX = 0; + VidpCurrentY = 0; + + /* Invoke the hardware-specific routine */ + ResetDisplay(SetMode); +} + +ULONG +NTAPI +VidSetTextColor( + _In_ ULONG Color) +{ + ULONG OldColor; + + /* Save the old color and set the new one */ + OldColor = VidpTextColor; + VidpTextColor = Color; + return OldColor; +} + +VOID +NTAPI +VidSetScrollRegion( + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG Right, + _In_ ULONG Bottom) +{ + /* Assert alignment */ + ASSERT((Left % BOOTCHAR_WIDTH) == 0); + ASSERT((Right % BOOTCHAR_WIDTH) == BOOTCHAR_WIDTH - 1); + + /* Set Scroll Region */ + VidpScrollRegion[0] = Left; + VidpScrollRegion[1] = Top; + VidpScrollRegion[2] = Right; + VidpScrollRegion[3] = Bottom; + + /* Set current X and Y */ + VidpCurrentX = Left; + VidpCurrentY = Top; +} + +VOID +NTAPI +VidDisplayStringXY( + _In_z_ PUCHAR String, + _In_ ULONG Left, + _In_ ULONG Top, + _In_ BOOLEAN Transparent) +{ + ULONG BackColor; + + /* + * If the caller wanted transparent, then send the special value (16), + * else use our default and call the helper routine. + */ + BackColor = Transparent ? BV_COLOR_NONE : BV_COLOR_LIGHT_CYAN; + + /* Loop every character and adjust the position */ + for (; *String; ++String, Left += BOOTCHAR_WIDTH) + { + /* Display a character */ + DisplayCharacter(*String, Left, Top, BV_COLOR_LIGHT_BLUE, BackColor); + } +} + +VOID +NTAPI +VidDisplayString( + _In_z_ PUCHAR String) +{ + /* Start looping the string */ + for (; *String; ++String) + { + /* Treat new-line separately */ + if (*String == '\n') + { + /* Modify Y position */ + VidpCurrentY += BOOTCHAR_HEIGHT + 1; + if (VidpCurrentY + BOOTCHAR_HEIGHT > VidpScrollRegion[3]) + { + /* Scroll the view and clear the current row */ + DoScroll(BOOTCHAR_HEIGHT + 1); + VidpCurrentY -= BOOTCHAR_HEIGHT + 1; + PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, TRUE); + } + else + { + /* Preserve the current row */ + PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, FALSE); + } + + /* Update current X */ + VidpCurrentX = VidpScrollRegion[0]; + + /* No need to clear this row */ + ClearRow = FALSE; + } + else if (*String == '\r') + { + /* Update current X */ + VidpCurrentX = VidpScrollRegion[0]; + + /* If a new-line does not follow we will clear the current row */ + if (String[1] != '\n') + ClearRow = TRUE; + } + else + { + /* Clear the current row if we had a return-carriage without a new-line */ + if (ClearRow) + { + PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, TRUE); + ClearRow = FALSE; + } + + /* Display this character */ + DisplayCharacter(*String, VidpCurrentX, VidpCurrentY, VidpTextColor, BV_COLOR_NONE); + VidpCurrentX += BOOTCHAR_WIDTH; + + /* Check if we should scroll */ + if (VidpCurrentX + BOOTCHAR_WIDTH - 1 > VidpScrollRegion[2]) + { + /* Update Y position and check if we should scroll it */ + VidpCurrentY += BOOTCHAR_HEIGHT + 1; + if (VidpCurrentY + BOOTCHAR_HEIGHT > VidpScrollRegion[3]) + { + /* Scroll the view and clear the current row */ + DoScroll(BOOTCHAR_HEIGHT + 1); + VidpCurrentY -= BOOTCHAR_HEIGHT + 1; + PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, TRUE); + } + else + { + /* Preserve the current row */ + PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, FALSE); + } + + /* Update current X */ + VidpCurrentX = VidpScrollRegion[0]; + } + } + } +} diff --git a/drivers/base/bootvid/fontdata.c b/drivers/base/bootvid/fontdata.c index c258394ea43..dfde7a461b8 100644 --- a/drivers/base/bootvid/fontdata.c +++ b/drivers/base/bootvid/fontdata.c @@ -13,7 +13,7 @@ // Available from https://web.archive.org/web/20210510052051/http://mirtchovski.com/p9/fonts/ // FontData Array generated by bootvid_font_generator. // -UCHAR VidpFontData[256 * BOOTCHAR_HEIGHT] = +const UCHAR VidpFontData[256 * BOOTCHAR_HEIGHT] = { 0x00, 0x00, 0x00, 0x00, 0xFE, 0x82, 0x82, 0x82, 0x82, 0x82, 0xFE, 0x00, 0x00, // 0 0x00, 0x00, 0x00, 0x00, 0xFE, 0x82, 0x82, 0x82, 0x82, 0x82, 0xFE, 0x00, 0x00, // 13 diff --git a/drivers/base/bootvid/i386/pc/bootvid.c b/drivers/base/bootvid/i386/pc/bootvid.c index f1ab0603102..aab53ee3308 100644 --- a/drivers/base/bootvid/i386/pc/bootvid.c +++ b/drivers/base/bootvid/i386/pc/bootvid.c @@ -440,7 +440,7 @@ VidInitialize( /* Set the VGA Memory Base */ VgaBase = Base; - /* Now check if we have to set the mode */ + /* Check whether we have to set the video mode */ if (SetMode) { /* Clear the current position */ @@ -460,27 +460,18 @@ VidInitialize( } } - /* VGA is ready */ return TRUE; } VOID -NTAPI -VidResetDisplay( - _In_ BOOLEAN HalReset) +ResetDisplay( + _In_ BOOLEAN SetMode) { - /* Clear the current position */ - VidpCurrentX = 0; - VidpCurrentY = 0; - - /* Clear the screen with HAL if we were asked to */ - if (HalReset) + /* Reset the video mode with HAL if requested */ + if (SetMode && !HalResetDisplay()) { - if (!HalResetDisplay()) - { - /* The HAL didn't handle the display, fully re-initialize the VGA */ - VgaInterpretCmdStream(VGA_640x480); - } + /* The HAL didn't handle the display, fully re-initialize the VGA */ + VgaInterpretCmdStream(VGA_640x480); } /* Always re-initialize the AC registers */ diff --git a/drivers/base/bootvid/i386/pc/pc.h b/drivers/base/bootvid/i386/pc/pc.h index 814552714db..0576511eb24 100644 --- a/drivers/base/bootvid/i386/pc/pc.h +++ b/drivers/base/bootvid/i386/pc/pc.h @@ -27,7 +27,7 @@ extern UCHAR PixelMask[8]; VOID InitPaletteWithTable( - _In_ PULONG Table, + _In_reads_(Count) const ULONG* Table, _In_ ULONG Count); VOID @@ -54,21 +54,3 @@ SetPixel( /* Set the new color */ WRITE_REGISTER_UCHAR(PixelPosition, Color); } - -VOID -PreserveRow( - _In_ ULONG CurrentTop, - _In_ ULONG TopDelta, - _In_ BOOLEAN Restore); - -VOID -DoScroll( - _In_ ULONG Scroll); - -VOID -DisplayCharacter( - _In_ CHAR Character, - _In_ ULONG Left, - _In_ ULONG Top, - _In_ ULONG TextColor, - _In_ ULONG BackColor); diff --git a/drivers/base/bootvid/i386/pc/vga.c b/drivers/base/bootvid/i386/pc/vga.c index d4b54f636c3..658870d7443 100644 --- a/drivers/base/bootvid/i386/pc/vga.c +++ b/drivers/base/bootvid/i386/pc/vga.c @@ -117,7 +117,8 @@ DisplayCharacter( _In_ ULONG TextColor, _In_ ULONG BackColor) { - PUCHAR FontChar, PixelPtr; + const UCHAR* FontChar; + PUCHAR PixelPtr; ULONG Height; UCHAR Shift; @@ -215,11 +216,11 @@ SetPaletteEntryRGB( VOID InitPaletteWithTable( - _In_ PULONG Table, + _In_reads_(Count) const ULONG* Table, _In_ ULONG Count) { + const ULONG* Entry = Table; ULONG i; - PULONG Entry = Table; for (i = 0; i < Count; i++, Entry++) { diff --git a/drivers/base/bootvid/i386/pc98/bootvid.c b/drivers/base/bootvid/i386/pc98/bootvid.c index d592d5e7b9d..68f6c9fb419 100644 --- a/drivers/base/bootvid/i386/pc98/bootvid.c +++ b/drivers/base/bootvid/i386/pc98/bootvid.c @@ -252,11 +252,11 @@ SetPaletteEntryRGB( VOID InitPaletteWithTable( - _In_ PULONG Table, + _In_reads_(Count) const ULONG* Table, _In_ ULONG Count) { + const ULONG* Entry = Table; ULONG i; - PULONG Entry = Table; for (i = 0; i < Count; i++) SetPaletteEntryRGB(i, *Entry++); @@ -273,8 +273,8 @@ DisplayCharacter( _In_ ULONG TextColor, _In_ ULONG BackColor) { + const UCHAR* FontChar = GetFontPtr(Character); ULONG X, Y, PixelMask; - PUCHAR FontChar = GetFontPtr(Character); for (Y = Top; Y < Top + BOOTCHAR_HEIGHT; @@ -394,19 +394,14 @@ VidCleanUp(VOID) } VOID -NTAPI -VidResetDisplay( - _In_ BOOLEAN HalReset) +ResetDisplay( + _In_ BOOLEAN SetMode) { PULONG PixelsPosition = (PULONG)(FrameBuffer + FB_OFFSET(0, 0)); ULONG PixelCount = ((SCREEN_WIDTH * SCREEN_HEIGHT) / sizeof(ULONG)) + 1; - /* Clear the current position */ - VidpCurrentX = 0; - VidpCurrentY = 0; - - /* Clear the screen with HAL if we were asked to */ - if (HalReset) + /* Reset the video mode with HAL if requested */ + if (SetMode) HalResetDisplay(); WRITE_PORT_UCHAR((PUCHAR)GDC1_IO_o_MODE_FLIPFLOP1, GRAPH_MODE_DISPLAY_DISABLE); diff --git a/drivers/base/bootvid/i386/pc98/pc98.h b/drivers/base/bootvid/i386/pc98/pc98.h index 520b94b36a0..a4091cdd2cc 100644 --- a/drivers/base/bootvid/i386/pc98/pc98.h +++ b/drivers/base/bootvid/i386/pc98/pc98.h @@ -18,36 +18,16 @@ extern ULONG_PTR FrameBuffer; -/* PROTOTYPES *****************************************************************/ - -VOID -DisplayCharacter( - _In_ CHAR Character, - _In_ ULONG Left, - _In_ ULONG Top, - _In_ ULONG TextColor, - _In_ ULONG BackColor); - -VOID -DoScroll( - _In_ ULONG Scroll); +/* FUNCTIONS ******************************************************************/ VOID InitPaletteWithTable( - _In_ PULONG Table, + _In_reads_(Count) const ULONG* Table, _In_ ULONG Count); -VOID -PreserveRow( - _In_ ULONG CurrentTop, - _In_ ULONG TopDelta, - _In_ BOOLEAN Restore); - VOID PrepareForSetPixel(VOID); -/* FUNCTIONS ******************************************************************/ - FORCEINLINE VOID SetPixel( diff --git a/drivers/base/bootvid/i386/xbox/bootvid.c b/drivers/base/bootvid/i386/xbox/bootvid.c index 3444f7bdee4..089c7d0fec1 100644 --- a/drivers/base/bootvid/i386/xbox/bootvid.c +++ b/drivers/base/bootvid/i386/xbox/bootvid.c @@ -10,6 +10,7 @@ #include "precomp.h" #include +#define NDEBUG #include /* GLOBALS ********************************************************************/ @@ -199,7 +200,7 @@ VidInitialize( /* Place backbuffer in the hidden part of framebuffer */ BackBuffer = (PUCHAR)(FrameBufferStart + NV2A_VIDEO_MEMORY_SIZE - BackBufferSize); - /* Now check if we have to set the mode */ + /* Check whether we have to set the video mode */ if (SetMode) VidResetDisplay(TRUE); @@ -220,16 +221,11 @@ VidCleanUp(VOID) } VOID -NTAPI -VidResetDisplay( - _In_ BOOLEAN HalReset) +ResetDisplay( + _In_ BOOLEAN SetMode) { - /* Clear the current position */ - VidpCurrentX = 0; - VidpCurrentY = 0; - - /* Clear the screen with HAL if we were asked to */ - if (HalReset) + /* Reset the video mode with HAL if requested */ + if (SetMode) HalResetDisplay(); /* Re-initialize the palette and fill the screen black */ @@ -240,10 +236,10 @@ VidResetDisplay( VOID InitPaletteWithTable( - _In_ PULONG Table, + _In_reads_(Count) const ULONG* Table, _In_ ULONG Count) { - PULONG Entry = Table; + const ULONG* Entry = Table; for (ULONG i = 0; i < Count; i++, Entry++) { @@ -354,7 +350,7 @@ DisplayCharacter( _In_ ULONG BackColor) { /* Get the font and pixel pointer */ - PUCHAR FontChar = GetFontPtr(Character); + const UCHAR* FontChar = GetFontPtr(Character); /* Loop each pixel height */ for (ULONG y = Top; y < Top + BOOTCHAR_HEIGHT; y++, FontChar += FONT_PTR_DELTA) diff --git a/drivers/base/bootvid/i386/xbox/xbox.h b/drivers/base/bootvid/i386/xbox/xbox.h index 49e52c58e1b..f2dcc282acc 100644 --- a/drivers/base/bootvid/i386/xbox/xbox.h +++ b/drivers/base/bootvid/i386/xbox/xbox.h @@ -7,9 +7,6 @@ * Copyright 2020 Stanislav Motylkov */ -#ifndef _BOOTVID_XBOX_H_ -#define _BOOTVID_XBOX_H_ - #pragma once #define BB_OFFSET(x, y) ((y) * SCREEN_WIDTH + (x)) @@ -17,7 +14,7 @@ VOID InitPaletteWithTable( - _In_ PULONG Table, + _In_reads_(Count) const ULONG* Table, _In_ ULONG Count); VOID @@ -28,23 +25,3 @@ SetPixel( _In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color); - -VOID -PreserveRow( - _In_ ULONG CurrentTop, - _In_ ULONG TopDelta, - _In_ BOOLEAN Restore); - -VOID -DoScroll( - _In_ ULONG Scroll); - -VOID -DisplayCharacter( - _In_ CHAR Character, - _In_ ULONG Left, - _In_ ULONG Top, - _In_ ULONG TextColor, - _In_ ULONG BackColor); - -#endif /* _BOOTVID_XBOX_H_ */ diff --git a/drivers/base/bootvid/precomp.h b/drivers/base/bootvid/precomp.h index 3722885cd2a..f62c5fb1e1c 100644 --- a/drivers/base/bootvid/precomp.h +++ b/drivers/base/bootvid/precomp.h @@ -7,14 +7,13 @@ * Copyright 2020 Stanislav Motylkov */ -#ifndef _BOOTVID_PCH_ -#define _BOOTVID_PCH_ +#pragma once #include #include #include -/* Arch specific includes */ +/* Arch-specific includes */ #if defined(_M_IX86) || defined(_M_AMD64) #if defined(SARCH_PC98) #include "i386/pc98/pc98.h" @@ -30,7 +29,7 @@ #error Unknown architecture #endif -/* Define if FontData has upside down characters */ +/* Define if FontData has upside-down characters */ #undef CHAR_GEN_UPSIDE_DOWN #define BOOTCHAR_HEIGHT 13 @@ -65,7 +64,7 @@ extern UCHAR VidpTextColor; extern ULONG VidpCurrentX; extern ULONG VidpCurrentY; extern ULONG VidpScrollRegion[4]; -extern UCHAR VidpFontData[256 * BOOTCHAR_HEIGHT]; +extern const UCHAR VidpFontData[256 * BOOTCHAR_HEIGHT]; extern const RGBQUAD VidpDefaultPalette[BV_MAX_COLORS]; #define RGB(r, g, b) ((RGBQUAD)(((UCHAR)(b) | ((USHORT)((UCHAR)(g))<<8)) | (((ULONG)(UCHAR)(r))<<16))) @@ -84,4 +83,25 @@ extern const RGBQUAD VidpDefaultPalette[BV_MAX_COLORS]; # define FONT_PTR_DELTA (1) #endif -#endif /* _BOOTVID_PCH_ */ + +VOID +PreserveRow( + _In_ ULONG CurrentTop, + _In_ ULONG TopDelta, + _In_ BOOLEAN Restore); + +VOID +DoScroll( + _In_ ULONG Scroll); + +VOID +DisplayCharacter( + _In_ CHAR Character, + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG TextColor, + _In_ ULONG BackColor); + +VOID +ResetDisplay( + _In_ BOOLEAN SetMode); diff --git a/sdk/include/reactos/drivers/bootvid/bootvid.h b/sdk/include/reactos/drivers/bootvid/bootvid.h index 6747fd415b4..4f2afde7aa0 100644 --- a/sdk/include/reactos/drivers/bootvid/bootvid.h +++ b/sdk/include/reactos/drivers/bootvid/bootvid.h @@ -20,7 +20,7 @@ VidInitialize( VOID NTAPI VidResetDisplay( - _In_ BOOLEAN HalReset); + _In_ BOOLEAN SetMode); ULONG NTAPI