From e311cad8f7d8c6de210acbad43351b90bf34eeaa Mon Sep 17 00:00:00 2001 From: Rafal Kupiec Date: Sun, 12 May 2024 22:43:06 +0200 Subject: [PATCH] Allow to clear framebuffer screen with any, custom background color --- sdk/xtdk/hltypes.h | 11 +++++++++++ xtoskrnl/hl/efifb.c | 19 +++++++++++++++---- xtoskrnl/includes/hli.h | 2 +- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/sdk/xtdk/hltypes.h b/sdk/xtdk/hltypes.h index 60764ee..e6c907c 100644 --- a/sdk/xtdk/hltypes.h +++ b/sdk/xtdk/hltypes.h @@ -154,6 +154,17 @@ typedef struct _HAL_FRAMEBUFFER_DATA UINT BitsPerPixel; UINT Pitch; PVOID Font; + struct + { + USHORT BlueShift; + USHORT BlueSize; + USHORT GreenShift; + USHORT GreenSize; + USHORT RedShift; + USHORT RedSize; + USHORT ReservedShift; + USHORT ReservedSize; + } Pixels; } HAL_FRAMEBUFFER_DATA, *PHAL_FRAMEBUFFER_DATA; /* SMBIOS table header structure */ diff --git a/xtoskrnl/hl/efifb.c b/xtoskrnl/hl/efifb.c index 5b87b19..62398f2 100644 --- a/xtoskrnl/hl/efifb.c +++ b/xtoskrnl/hl/efifb.c @@ -11,7 +11,10 @@ /** - * Clears the screen by drawing a filled black box. + * Clears the screen by drawing a box filled with specified color. + * + * @param Color + * Specifies the color of the box used to fill the screen. * * @return This routine does not return any value. * @@ -19,7 +22,7 @@ */ XTAPI VOID -HlClearScreen(VOID) +HlClearScreen(IN ULONG Color) { SIZE_T Line, PositionX, PositionY; PULONG FrameBuf; @@ -33,7 +36,7 @@ HlClearScreen(VOID) Line = PositionY * HlpFrameBufferData.PixelsPerScanLine; for(PositionX = 0; PositionX < HlpFrameBufferData.Width; PositionX++) { - FrameBuf[Line + PositionX] = 0x00000000; + FrameBuf[Line + PositionX] = Color; } } } @@ -128,10 +131,18 @@ HlInitializeFrameBuffer(VOID) HlpFrameBufferData.BitsPerPixel = KeInitializationBlock->LoaderInformation.FrameBuffer.BitsPerPixel; HlpFrameBufferData.PixelsPerScanLine = KeInitializationBlock->LoaderInformation.FrameBuffer.PixelsPerScanLine; HlpFrameBufferData.Pitch = KeInitializationBlock->LoaderInformation.FrameBuffer.Pitch; + HlpFrameBufferData.Pixels.BlueShift = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.BlueShift; + HlpFrameBufferData.Pixels.BlueSize = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.BlueSize; + HlpFrameBufferData.Pixels.GreenShift = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.GreenShift; + HlpFrameBufferData.Pixels.GreenSize = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.GreenSize; + HlpFrameBufferData.Pixels.RedShift = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.RedShift; + HlpFrameBufferData.Pixels.RedSize = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.RedSize; + HlpFrameBufferData.Pixels.ReservedShift = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.ReservedShift; + HlpFrameBufferData.Pixels.ReservedSize = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.ReservedSize; HlpFrameBufferData.Initialized = TRUE; /* Clear screen */ - HlClearScreen(); + HlClearScreen(0x00000000); /* Return success */ return STATUS_SUCCESS; diff --git a/xtoskrnl/includes/hli.h b/xtoskrnl/includes/hli.h index d62d75d..a5eb389 100644 --- a/xtoskrnl/includes/hli.h +++ b/xtoskrnl/includes/hli.h @@ -14,7 +14,7 @@ /* HAL library routines forward references */ XTAPI VOID -HlClearScreen(VOID); +HlClearScreen(IN ULONG Color); XTCDECL XTSTATUS