From a4c22ab5e8ed5d97808507d81abe854accfbd629 Mon Sep 17 00:00:00 2001 From: Rafal Kupiec Date: Sat, 9 Mar 2024 15:07:33 +0100 Subject: [PATCH] Improvements to FrameBuffer support --- sdk/xtdk/hltypes.h | 2 +- xtldr/modules/xtos_o/xtos.c | 2 +- xtoskrnl/hl/efifb.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/xtdk/hltypes.h b/sdk/xtdk/hltypes.h index 2160f46..c80a2ef 100644 --- a/sdk/xtdk/hltypes.h +++ b/sdk/xtdk/hltypes.h @@ -146,7 +146,7 @@ typedef struct _CPPORT typedef struct _HAL_FRAMEBUFFER_DATA { BOOLEAN Initialized; - PULONG Address; + PVOID Address; ULONG_PTR BufferSize; UINT Width; UINT Height; diff --git a/xtldr/modules/xtos_o/xtos.c b/xtldr/modules/xtos_o/xtos.c index b7adbb9..e38c025 100644 --- a/xtldr/modules/xtos_o/xtos.c +++ b/xtldr/modules/xtos_o/xtos.c @@ -42,7 +42,7 @@ XtGetDisplayInformation(OUT PLOADER_GRAPHICS_INFORMATION_BLOCK InformationBlock, { InformationBlock->Initialized = FrameBufferInfo->Initialized; InformationBlock->Protocol = FrameBufferInfo->Protocol; - InformationBlock->Address = (PVOID)(ULONG_PTR)FrameBufferInfo->FrameBufferBase; + InformationBlock->Address = (PVOID)FrameBufferInfo->FrameBufferBase; InformationBlock->BufferSize = FrameBufferInfo->FrameBufferSize; InformationBlock->Width = FrameBufferInfo->Width; InformationBlock->Height = FrameBufferInfo->Height; diff --git a/xtoskrnl/hl/efifb.c b/xtoskrnl/hl/efifb.c index 98c162e..cb9f5ec 100644 --- a/xtoskrnl/hl/efifb.c +++ b/xtoskrnl/hl/efifb.c @@ -71,10 +71,10 @@ HlDrawPixel(IN ULONG PositionX, } /* Calculate the index of the pixel in the frame buffer memory using the provided x and y coordinates */ - FrameBufferIndex = PositionY * HlpFrameBufferData.PixelsPerScanLine + PositionX; + FrameBufferIndex = 4 * HlpFrameBufferData.PixelsPerScanLine * PositionY + 4 * PositionX; /* Set the color of the pixel by writing to the corresponding memory location */ - HlpFrameBufferData.Address[FrameBufferIndex] = Color; + *((PUINT)(HlpFrameBufferData.Address + FrameBufferIndex)) = Color; } /** @@ -104,7 +104,7 @@ HlInitializeFrameBuffer(VOID) } /* Save framebuffer information and mark display as initialized */ - HlpFrameBufferData.Address = (PULONG)KeInitializationBlock->LoaderInformation.FrameBuffer.Address; + HlpFrameBufferData.Address = KeInitializationBlock->LoaderInformation.FrameBuffer.Address; HlpFrameBufferData.Width = KeInitializationBlock->LoaderInformation.FrameBuffer.Width; HlpFrameBufferData.Height = KeInitializationBlock->LoaderInformation.FrameBuffer.Height; HlpFrameBufferData.BitsPerPixel = KeInitializationBlock->LoaderInformation.FrameBuffer.BitsPerPixel;