X-Git-Url: https://code.delx.au/refind/blobdiff_plain/8b9e6b44d9e996a65cc4b81a71e8e6fdc054ea27..4c9f41e161bd197922912efbcf4cc676077d5c00:/refind/screen.c diff --git a/refind/screen.c b/refind/screen.c index a5628c0..3b98586 100644 --- a/refind/screen.c +++ b/refind/screen.c @@ -1,5 +1,5 @@ /* - * refit/screen.c + * refind/screen.c * Screen handling functions * * Copyright (c) 2006 Christoph Pfisterer @@ -38,9 +38,9 @@ #include "screen.h" #include "config.h" #include "libegint.h" -#include "refit_call_wrapper.h" +#include "../include/refit_call_wrapper.h" -#include "egemb_refind_banner.h" +#include "../include/egemb_refind_banner.h" // Console defines and variables @@ -177,10 +177,11 @@ VOID BeginExternalScreen(IN BOOLEAN UseGraphicsMode, IN CHAR16 *Title) BltClearScreen(FALSE); } else { egClearScreen(&DarkBackgroundPixel); + DrawScreenHeader(Title); } // if/else // show the header - DrawScreenHeader(Title); +// DrawScreenHeader(Title); if (!UseGraphicsMode) SwitchToText(TRUE); @@ -208,7 +209,7 @@ VOID TerminateScreen(VOID) // clear text screen refit_call2_wrapper(ST->ConOut->SetAttribute, ST->ConOut, ATTR_BASIC); refit_call1_wrapper(ST->ConOut->ClearScreen, ST->ConOut); - + // enable cursor refit_call2_wrapper(ST->ConOut->EnableCursor, ST->ConOut, TRUE); } @@ -262,9 +263,9 @@ static BOOLEAN ReadAllKeyStrokes(VOID) VOID PauseForKey(VOID) { UINTN index; - + Print(L"\n* Hit any key to continue *"); - + if (ReadAllKeyStrokes()) { // remove buffered key strokes refit_call1_wrapper(BS->Stall, 5000000); // 5 seconds delay ReadAllKeyStrokes(); // empty the buffer again @@ -302,6 +303,7 @@ VOID EndlessIdleLoop(VOID) // Error handling // +#ifdef __MAKEWITH_GNUEFI BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CHAR16 *where) { CHAR16 ErrorName[64]; @@ -335,6 +337,41 @@ BOOLEAN CheckError(IN EFI_STATUS Status, IN CHAR16 *where) return TRUE; } +#else +BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CHAR16 *where) +{ +// CHAR16 ErrorName[64]; + + if (!EFI_ERROR(Status)) + return FALSE; + +// StatusToString(ErrorName, Status); + gST->ConOut->SetAttribute (gST->ConOut, ATTR_ERROR); + Print(L"Fatal Error: %r %s\n", Status, where); + gST->ConOut->SetAttribute (gST->ConOut, ATTR_BASIC); + haveError = TRUE; + + //gBS->Exit(ImageHandle, ExitStatus, ExitDataSize, ExitData); + + return TRUE; +} + +BOOLEAN CheckError(IN EFI_STATUS Status, IN CHAR16 *where) +{ +// CHAR16 ErrorName[64]; + + if (!EFI_ERROR(Status)) + return FALSE; + +// StatusToString(ErrorName, Status); + gST->ConOut->SetAttribute (gST->ConOut, ATTR_ERROR); + Print(L"Error: %r %s\n", Status, where); + gST->ConOut->SetAttribute (gST->ConOut, ATTR_BASIC); + haveError = TRUE; + + return TRUE; +} +#endif // // Graphics functions @@ -385,11 +422,11 @@ VOID BltImage(IN EG_IMAGE *Image, IN UINTN XPos, IN UINTN YPos) VOID BltImageAlpha(IN EG_IMAGE *Image, IN UINTN XPos, IN UINTN YPos, IN EG_PIXEL *BackgroundPixel) { EG_IMAGE *CompImage; - + // compose on background CompImage = egCreateFilledImage(Image->Width, Image->Height, FALSE, BackgroundPixel); egComposeImage(CompImage, Image, 0, 0); - + // blit to screen and clean up egDrawImage(CompImage, XPos, YPos); egFreeImage(CompImage); @@ -416,7 +453,7 @@ VOID BltImageAlpha(IN EG_IMAGE *Image, IN UINTN XPos, IN UINTN YPos, IN EG_PIXEL // CompHeight = TotalHeight; // OffsetY = (TotalHeight - CompHeight) >> 1; // egComposeImage(CompImage, TopImage, OffsetX, OffsetY); -// +// // // blit to screen and clean up // egDrawImage(CompImage, XPos, YPos); // egFreeImage(CompImage); @@ -425,7 +462,7 @@ VOID BltImageAlpha(IN EG_IMAGE *Image, IN UINTN XPos, IN UINTN YPos, IN EG_PIXEL VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG_IMAGE *BadgeImage, IN UINTN XPos, IN UINTN YPos) { - UINTN TotalWidth, TotalHeight, CompWidth = 0, CompHeight = 0, OffsetX = 0, OffsetY = 0; + UINTN TotalWidth = 0, TotalHeight = 0, CompWidth = 0, CompHeight = 0, OffsetX = 0, OffsetY = 0; EG_IMAGE *CompImage = NULL; // initialize buffer with base image @@ -447,7 +484,7 @@ VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG OffsetY = (TotalHeight - CompHeight) >> 1; egComposeImage(CompImage, TopImage, OffsetX, OffsetY); } - + // place the badge image if (BadgeImage != NULL && CompImage != NULL && (BadgeImage->Width + 8) < CompWidth && (BadgeImage->Height + 8) < CompHeight) { OffsetX += CompWidth - 8 - BadgeImage->Width;