diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-06-08 17:22:38 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-06-08 17:22:38 +0200 |
| commit | 9679f4d8676cb72feb80d95bca6ce26965f40042 (patch) | |
| tree | 40e7a667681d3d9a3b9a3cdc303479222b058387 /Boot/Sources | |
| parent | 00861fe008e33e6be0f538191683169f72e1f54f (diff) | |
MHR-23: GX builtin.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Boot/Sources')
| -rw-r--r-- | Boot/Sources/HEL/AMD64/BootMain.cxx | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/Boot/Sources/HEL/AMD64/BootMain.cxx b/Boot/Sources/HEL/AMD64/BootMain.cxx index 9df4cd0b..3050a8eb 100644 --- a/Boot/Sources/HEL/AMD64/BootMain.cxx +++ b/Boot/Sources/HEL/AMD64/BootMain.cxx @@ -6,7 +6,7 @@ #include <BootKit/BootKit.hxx> #include <BootKit/Rsrc/NewBoot.rsrc> -#include <Builtins/Toolbox/Toolbox.hxx> +#include <Builtins/GX/GX> #include <FirmwareKit/EFI.hxx> #include <FirmwareKit/EFI/API.hxx> #include <FirmwareKit/Handover.hxx> @@ -22,6 +22,14 @@ #define kMachineModel "NeWS HD" #endif // !kMachineModel +#ifndef cExpectedWidth +#define cExpectedWidth 436 +#endif + +#ifndef cExpectedHeight +#define cExpectedHeight 644 +#endif + /** Graphics related. */ STATIC EfiGraphicsOutputProtocol* kGop = nullptr; @@ -34,7 +42,7 @@ EXTERN_C Void hal_init_platform(HEL::HandoverInformationHeader* HIH); @brief Finds and stores the GOP. */ -STATIC Void CheckAndFindFramebuffer() noexcept +STATIC Void InitVideoFB() noexcept { kGopGuid = EfiGUID(EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID); kGop = nullptr; @@ -43,6 +51,18 @@ STATIC Void CheckAndFindFramebuffer() noexcept BS->LocateProtocol(&kGopGuid, nullptr, (VoidPtr*)&kGop); + for (size_t i = 0; i < kGop->Mode->MaxMode; ++i) + { + EfiGraphicsOutputProtocolModeInformation* infoPtr = nullptr; + + if (infoPtr->HorizontalResolution == cExpectedWidth && + infoPtr->VerticalResolution == cExpectedHeight) + { + kGop->SetMode(kGop, i); + break; + } + } + kStride = 4; } @@ -62,7 +82,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, EfiSystemTable* SystemTable) { InitEFI(SystemTable); ///! Init the EFI library. - CheckAndFindFramebuffer(); ///! Init the GOP. + InitVideoFB(); ///! Init the GOP. BTextWriter writer; @@ -123,18 +143,18 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, kHandoverHeader = handoverHdrPtr; - ToolboxInitRsrc(); + GXInit(); - ToolboxDrawZone(RGB(9d, 9d, 9d), handoverHdrPtr->f_GOP.f_Height, + GXDraw(RGB(9d, 9d, 9d), handoverHdrPtr->f_GOP.f_Height, handoverHdrPtr->f_GOP.f_Width, 0, 0); - ToolboxClearRsrc(); + GXFini(); - ToolboxDrawRsrc(NewBoot, NEWBOOT_HEIGHT, NEWBOOT_WIDTH, + GXDrawImg(NewBoot, NEWBOOT_HEIGHT, NEWBOOT_WIDTH, (handoverHdrPtr->f_GOP.f_Width - NEWBOOT_WIDTH) / 2, (handoverHdrPtr->f_GOP.f_Height - NEWBOOT_HEIGHT) / 2); - ToolboxClearRsrc(); + GXFini(); BS->GetMemoryMap(SizePtr, Descriptor, MapKey, SzDesc, RevDesc); |
