- #include "gnu-efi/inc/efi.h"
- #include "gnu-efi/inc/efilib.h"
- #include "main.h"
- extern EFI_STATUS efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
- {
- EFI_STATUS Status;
- EFI_INPUT_KEY Key;
- EFI_BOOT_SERVICES* BS;
- /* Store the system table for future use in other functions */
- ST = SystemTable;
- BS = ST->BootServices;
- /* Say hi */
- Status = ST->ConOut->OutputString(ST->ConOut, L"Hello World\r\n"); // EFI Applications use Unicode and CRLF, a la Windows
- if (EFI_ERROR(Status))
- return Status;
- EFI_GUID gopGuid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *gop;
- Status = BS->LocateProtocol(&gopGuid, NULL, (void**)&gop);
- if(EFI_ERROR(Status))
- Status = ST->ConOut->OutputString(ST->ConOut, L"Unable To alocate gop");
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
- UINTN SizeOfInfo, numModes, nativeMode;
- Status = gop->QueryMode(gop, gop->Mode==NULL?0:gop->Mode->Mode, &SizeOfInfo, &info);
- // this is needed to get the current video mode
- if (Status == EFI_NOT_STARTED)
- Status = gop->SetMode(gop, 0);
- if(EFI_ERROR(Status)) {
- Status = ST->ConOut->OutputString(ST->ConOut, L"Unable to get native mode\n");
- } else {
- nativeMode = gop->Mode->Mode;
- numModes = gop->Mode->MaxMode;
- }
- for (int i = 0; i < numModes; i++) {
- char X[33];
- char B[1080];
- unsigned char HZR = (unsigned char)info->HorizontalResolution;
- unsigned char VRR = (unsigned char)info->VerticalResolution;
- Status = gop->QueryMode(gop, i, &SizeOfInfo, &info);
- Status = ST->ConOut->OutputString(ST->ConOut, L"mode");
- EndLine(Status);
- Status = ST->ConOut->OutputString(ST->ConOut, L"width");
- EndLine(Status);
- Status = ST->ConOut->OutputString(ST->ConOut, L"Height");
- EndLine(Status);
- Status = ST->ConOut->OutputString(ST->ConOut, L"Format");
- EndLine(Status);
- if(i == nativeMode)
- Status = ST->ConOut->OutputString(ST->ConOut, L"(Current)");
- else
- Status = ST->ConOut->OutputString(ST->ConOut, L"...");
- }
- while(1 == 1);
- }
Raw Paste