#include "libegint.h"
#include "../refind/screen.h"
-#include "refit_call_wrapper.h"
+#include "../include/refit_call_wrapper.h"
#include <efiUgaDraw.h>
#include <efiConsoleControl.h>
+#ifndef __MAKEWITH_GNUEFI
+#define LibLocateProtocol EfiLibLocateProtocol
+#endif
+
// Console defines and variables
static EFI_GUID ConsoleControlProtocolGuid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID;
}
}
+// // Returns current graphics mode number
+// UINT32 egGetGraphicsMode(VOID) {
+// UINT32 retval = 0;
+//
+// if (GraphicsOutput != NULL) {
+// retval = GraphicsOutput->Mode->Mode;
+// }
+//
+// return retval;
+// } // UINT32 egGetGraphicsMode()
+
// Sets the screen resolution to the specified value, if possible.
// If the specified value is not valid, displays a warning with the valid
// modes on UEFI systems, or silently fails on EFI 1.x systems. Note that
if ((Status == EFI_SUCCESS) && (Size >= sizeof(*Info)) &&
(Info->HorizontalResolution == ScreenWidth) && (Info->VerticalResolution == ScreenHeight)) {
Status = refit_call2_wrapper(GraphicsOutput->SetMode, GraphicsOutput, ModeNum);
+// if (Status == EFI_SUCCESS)
+// Status = refit_call2_wrapper(ST->ConOut->SetMode, ST->ConOut, ModeNum);
ModeSet = (Status == EFI_SUCCESS);
} // if
ModeNum++;
egScreenWidth = ScreenWidth;
egScreenHeight = ScreenHeight;
} else {// If unsuccessful, display an error message for the user....
+ SwitchToText(FALSE);
Print(L"Error setting mode %d x %d; using default mode!\nAvailable modes are:\n", ScreenWidth, ScreenHeight);
ModeNum = 0;
Status = EFI_SUCCESS;
ModeNum++;
} // while()
PauseForKey();
+ SwitchToGraphics();
} // if()
} else if (UgaDraw != NULL) { // UGA mode (EFI 1.x)
// Try to use current color depth & refresh rate for new mode. Maybe not the best choice
CHAR16 * egScreenDescription(VOID)
{
+ CHAR16 *Temp;
+
if (egHasGraphics) {
if (GraphicsOutput != NULL) {
- return PoolPrint(L"Graphics Output (UEFI), %dx%d",
- egScreenWidth, egScreenHeight);
+ Temp = AllocateZeroPool(256 * sizeof(CHAR16));
+ SPrint(Temp, 255, L"Graphics Output (UEFI), %dx%d", egScreenWidth, egScreenHeight);
+ return Temp;
} else if (UgaDraw != NULL) {
- return PoolPrint(L"UGA Draw (EFI 1.10), %dx%d",
- egScreenWidth, egScreenHeight);
+ Temp = AllocateZeroPool(256 * sizeof(CHAR16));
+ SPrint(Temp, 255, L"UGA Draw (EFI 1.10), %dx%d", egScreenWidth, egScreenHeight);
+ return Temp;
} else {
return L"Internal Error";
}