OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
GuiApp.c
Go to the documentation of this file.
1
8#include <Uefi.h>
9
12
13#include <Library/DebugLib.h>
14#include <Library/MemoryAllocationLib.h>
17#include <Library/UefiBootServicesTableLib.h>
18#include <Library/UefiRuntimeServicesTableLib.h>
19#include <Library/PrintLib.h>
20#include <Library/BaseLib.h>
21
22#include <Guid/AppleVariable.h>
24
25#include "OpenCanopy.h"
26#include "BmfLib.h"
27#include "GuiApp.h"
28
29GLOBAL_REMOVE_IF_UNREFERENCED BOOT_PICKER_GUI_CONTEXT mGuiContext;
30
31//
32// FIXME: Should not be global here.
33//
34STATIC EFI_GRAPHICS_OUTPUT_BLT_PIXEL mHighlightPixel = { 0xAF, 0xAF, 0xAF, 0x32 };
35
36STATIC
37CONST CHAR8 *
39 [LABEL_GENERIC_HDD] = "EFIBoot",
40 [LABEL_APPLE] = "Apple",
41 [LABEL_APPLE_RECOVERY] = "AppleRecv",
42 [LABEL_APPLE_TIME_MACHINE] = "AppleTM",
43 [LABEL_WINDOWS] = "Windows",
44 [LABEL_OTHER] = "Other",
45 [LABEL_TOOL] = "Tool",
46 [LABEL_RESET_NVRAM] = "ResetNVRAM",
47 [LABEL_SHELL] = "Shell",
48 [LABEL_SIP_IS_ENABLED] = "SIPEnabled",
49 [LABEL_SIP_IS_DISABLED] = "SIPDisabled",
50 [LABEL_FIRMWARE_SETTINGS] = "FirmwareSettings",
51 [LABEL_NETWORK_BOOT] = "NetworkBoot"
52};
53
54STATIC
55CONST CHAR8 *
57 [ICON_CURSOR] = "Cursor",
58 [ICON_SELECTED] = "Selected",
59 [ICON_SELECTOR] = "Selector",
60 [ICON_SET_DEFAULT] = "SetDefault",
61 [ICON_LEFT] = "Left",
62 [ICON_RIGHT] = "Right",
63 [ICON_SHUT_DOWN] = "ShutDown",
64 [ICON_RESTART] = "Restart",
65 [ICON_BUTTON_FOCUS] = "BtnFocus",
66 [ICON_PASSWORD] = "Password",
67 [ICON_DOT] = "Dot",
68 [ICON_ENTER] = "Enter",
69 [ICON_LOCK] = "Lock",
70 [ICON_GENERIC_HDD] = "HardDrive",
71 [ICON_APPLE] = "Apple",
72 [ICON_APPLE_RECOVERY] = "AppleRecv",
73 [ICON_APPLE_TIME_MACHINE] = "AppleTM",
74 [ICON_WINDOWS] = "Windows",
75 [ICON_OTHER] = "Other",
76 [ICON_TOOL] = "Tool",
77 [ICON_RESET_NVRAM] = "ResetNVRAM",
78 [ICON_SHELL] = "Shell"
79};
80
81STATIC
82VOID
84 IN CONST VOID *Memory
85 )
86{
87 if (Memory != NULL) {
88 FreePool ((VOID *)Memory);
89 }
90}
91
92STATIC
93VOID
95 IN OUT BOOT_PICKER_GUI_CONTEXT *Context
96 )
97{
98 UINT32 Index;
99 UINT32 Index2;
100
101 for (Index = 0; Index < ICON_NUM_TOTAL; ++Index) {
102 for (Index2 = 0; Index2 < ICON_TYPE_COUNT; ++Index2) {
103 InternalSafeFreePool (Context->Icons[Index][Index2].Buffer);
104 }
105 }
106
107 for (Index = 0; Index < LABEL_NUM_TOTAL; ++Index) {
108 InternalSafeFreePool (Context->Labels[Index].Buffer);
109 }
110
111 InternalSafeFreePool (Context->Background.Buffer);
112 InternalSafeFreePool (Context->FontContext.FontImage.Buffer);
113
114 /*
115 InternalSafeFreePool (Context->Poof[0].Buffer);
116 InternalSafeFreePool (Context->Poof[1].Buffer);
117 InternalSafeFreePool (Context->Poof[2].Buffer);
118 InternalSafeFreePool (Context->Poof[3].Buffer);
119 InternalSafeFreePool (Context->Poof[4].Buffer);
120 */
121}
122
123STATIC
124EFI_STATUS
126 OUT GUI_IMAGE *Images,
127 IN OC_STORAGE_CONTEXT *Storage,
128 IN CONST CHAR8 *ImageFilePath,
129 IN UINT8 Scale,
130 IN UINT32 MatchWidth,
131 IN UINT32 MatchHeight,
132 IN BOOLEAN Icon,
133 IN CONST CHAR8 *Prefix,
134 IN BOOLEAN AllowLessSize
135 )
136{
137 EFI_STATUS Status;
138 CHAR16 Path[OC_STORAGE_SAFE_PATH_MAX];
139 UINT8 *FileData;
140 UINT32 FileSize;
141 UINT32 ImageCount;
142 UINT32 Index;
143
144 ASSERT (ImageFilePath != NULL);
145 ASSERT (Scale == 1 || Scale == 2);
146
147 ImageCount = Icon ? ICON_TYPE_COUNT : 1;
148
149 for (Index = 0; Index < ImageCount; ++Index) {
150 Status = OcUnicodeSafeSPrint (
151 Path,
152 sizeof (Path),
153 OPEN_CORE_IMAGE_PATH L"%a\\%a%a.icns",
154 Prefix,
155 Index > 0 ? "Ext" : "",
156 ImageFilePath
157 );
158 if (EFI_ERROR (Status)) {
159 DEBUG ((DEBUG_WARN, "OCUI: Cannot fit %a\n", ImageFilePath));
160 return EFI_OUT_OF_RESOURCES;
161 }
162
163 UnicodeUefiSlashes (Path);
164 Status = EFI_NOT_FOUND;
165 if (OcStorageExistsFileUnicode (Storage, Path)) {
166 FileData = OcStorageReadFileUnicode (Storage, Path, &FileSize);
167 if ((FileData != NULL) && (FileSize > 0)) {
168 Status = GuiIcnsToImageIcon (
169 &Images[Index],
170 FileData,
171 FileSize,
172 Scale,
173 MatchWidth,
174 MatchHeight,
175 AllowLessSize
176 );
177 }
178
179 if (FileData != NULL) {
180 FreePool (FileData);
181 }
182 }
183
184 if (EFI_ERROR (Status)) {
185 DEBUG ((
186 DEBUG_INFO,
187 "OCUI: Failed to load image (%u/%u) %s prefix:%a icon:%d - %r\n",
188 Index+1,
189 ImageCount,
190 Path,
191 Prefix,
192 Icon,
193 Status
194 ));
195 if (Index == ICON_TYPE_BASE) {
197 ICON_TYPE_BASE == 0,
198 "Memory may be leaked due to previously loaded images."
199 );
200 return EFI_NOT_FOUND;
201 }
202
203 Images[Index].Width = 0;
204 Images[Index].Height = 0;
205 Images[Index].Buffer = NULL;
206 }
207 }
208
209 return EFI_SUCCESS;
210}
211
212STATIC
213EFI_STATUS
215 IN OC_STORAGE_CONTEXT *Storage,
216 IN CONST CHAR8 *LabelFilePath,
217 IN UINT8 Scale,
218 OUT VOID **FileData,
219 OUT UINT32 *FileSize
220 )
221{
222 EFI_STATUS Status;
223 CHAR16 Path[OC_STORAGE_SAFE_PATH_MAX];
224
225 ASSERT (Scale == 1 || Scale == 2);
226
227 Status = OcUnicodeSafeSPrint (
228 Path,
229 sizeof (Path),
230 OPEN_CORE_LABEL_PATH L"%a.%a",
231 LabelFilePath,
232 Scale == 2 ? "l2x" : "lbl"
233 );
234 if (EFI_ERROR (Status)) {
235 DEBUG ((DEBUG_WARN, "OCUI: Cannot fit %a\n", LabelFilePath));
236 return EFI_OUT_OF_RESOURCES;
237 }
238
239 *FileData = OcStorageReadFileUnicode (Storage, Path, FileSize);
240
241 if (*FileData == NULL) {
242 DEBUG ((DEBUG_WARN, "OCUI: Failed to load %s\n", Path));
243 return EFI_NOT_FOUND;
244 }
245
246 if (*FileSize == 0) {
247 FreePool (*FileData);
248 DEBUG ((DEBUG_WARN, "OCUI: Empty %s\n", Path));
249 return EFI_NOT_FOUND;
250 }
251
252 return EFI_SUCCESS;
253}
254
255EFI_STATUS
257 IN OC_STORAGE_CONTEXT *Storage,
258 IN CONST CHAR8 *ImageFilePath,
259 IN UINT8 Scale,
260 IN BOOLEAN Inverted,
261 OUT GUI_IMAGE *Image
262 )
263{
264 VOID *ImageData;
265 UINT32 ImageSize;
266 EFI_STATUS Status;
267
268 ASSERT (Scale == 1 || Scale == 2);
269
270 Status = LoadLabelFileFromStorageForScale (Storage, ImageFilePath, Scale, &ImageData, &ImageSize);
271 if (EFI_ERROR (Status)) {
272 return Status;
273 }
274
275 Status = GuiLabelToImage (Image, ImageData, ImageSize, Scale, Inverted);
276
277 FreePool (ImageData);
278
279 if (EFI_ERROR (Status)) {
280 DEBUG ((DEBUG_WARN, "OCUI: Failed to decode label %a - %r\n", ImageFilePath, Status));
281 }
282
283 return Status;
284}
285
286EFI_STATUS
288 IN BOOT_PICKER_GUI_CONTEXT *GuiContext,
289 IN OC_STORAGE_CONTEXT *Storage,
290 IN CHAR8 *FlavourName,
291 IN UINTN FlavourNameLen,
292 IN UINT32 IconTypeIndex,
293 IN BOOLEAN UseFlavourIcon,
294 OUT GUI_IMAGE *EntryIcon,
295 OUT BOOLEAN *CustomIcon
296 )
297{
298 EFI_STATUS Status;
299 CHAR16 Path[OC_STORAGE_SAFE_PATH_MAX];
300 CHAR8 ImageName[OC_MAX_CONTENT_FLAVOUR_SIZE];
301 UINT8 *FileData;
302 UINT32 FileSize;
303 UINTN Index;
304
305 ASSERT (EntryIcon != NULL);
306 ASSERT (CustomIcon != NULL);
307
308 if ((FlavourNameLen == 0) ||
309 (OcAsciiStrniCmp (FlavourName, OC_FLAVOUR_AUTO, FlavourNameLen) == 0)
310 )
311 {
312 return EFI_UNSUPPORTED;
313 }
314
315 //
316 // Look in preloaded icons
317 //
318 for (Index = ICON_NUM_SYS; Index < ICON_NUM_TOTAL; ++Index) {
319 if (OcAsciiStrniCmp (FlavourName, mIconNames[Index], FlavourNameLen) == 0) {
320 if (GuiContext->Icons[Index][IconTypeIndex].Buffer != NULL) {
321 CopyMem (EntryIcon, &GuiContext->Icons[Index][IconTypeIndex], sizeof (*EntryIcon));
322 *CustomIcon = FALSE;
323 return EFI_SUCCESS;
324 }
325
326 break;
327 }
328 }
329
330 //
331 // Look for custom icon
332 //
333 if (!UseFlavourIcon) {
334 return EFI_NOT_FOUND;
335 }
336
337 AsciiStrnCpyS (ImageName, OC_MAX_CONTENT_FLAVOUR_SIZE, FlavourName, FlavourNameLen);
338 Status = OcUnicodeSafeSPrint (
339 Path,
340 sizeof (Path),
341 OPEN_CORE_IMAGE_PATH L"%a\\%a%a.icns",
342 GuiContext->Prefix,
343 IconTypeIndex > 0 ? "Ext" : "",
344 ImageName
345 );
346
347 if (EFI_ERROR (Status)) {
348 DEBUG ((DEBUG_WARN, "OCUI: Cannot fit %a\n", ImageName));
349 return Status;
350 }
351
352 UnicodeUefiSlashes (Path);
353 DEBUG ((DEBUG_INFO, "OCUI: Trying flavour icon %s\n", Path));
354
355 Status = EFI_NOT_FOUND;
356 if (OcStorageExistsFileUnicode (Storage, Path)) {
357 FileData = OcStorageReadFileUnicode (Storage, Path, &FileSize);
358 if ((FileData != NULL) && (FileSize > 0)) {
359 Status = GuiIcnsToImageIcon (
360 EntryIcon,
361 FileData,
362 FileSize,
363 GuiContext->Scale,
366 FALSE
367 );
368 }
369
370 if (FileData != NULL) {
371 FreePool (FileData);
372 }
373
374 if (EFI_ERROR (Status)) {
375 DEBUG ((DEBUG_WARN, "OCUI: Invalid icon file\n"));
376 }
377 }
378
379 if (!EFI_ERROR (Status)) {
380 ASSERT (EntryIcon->Buffer != NULL);
381 *CustomIcon = TRUE;
382 return EFI_SUCCESS;
383 }
384
385 return EFI_NOT_FOUND;
386}
387
388EFI_STATUS
390 OUT BOOT_PICKER_GUI_CONTEXT *Context,
391 IN OC_STORAGE_CONTEXT *Storage,
392 IN OC_PICKER_CONTEXT *Picker
393 )
394{
395 EFI_STATUS Status;
397 VOID *FontImage;
398 VOID *FontData;
399 UINT32 FontImageSize;
400 UINT32 FontDataSize;
401 UINTN UiScaleSize;
402 UINT32 Index;
403 UINT32 ImageWidth;
404 UINT32 ImageHeight;
405 BOOLEAN Result;
406 BOOLEAN AllowLessSize;
407 BOOLEAN UseGenericLabel;
408
409 ASSERT (Context != NULL);
410
411 Context->Scale = 1;
412 UiScaleSize = sizeof (Context->Scale);
413
414 UseGenericLabel = (Picker->PickerAttributes & OC_ATTR_USE_GENERIC_LABEL_IMAGE) != 0;
415
416 Status = gRT->GetVariable (
419 NULL,
420 &UiScaleSize,
421 (VOID *)&Context->Scale
422 );
423
424 if (EFI_ERROR (Status) || (Context->Scale != 2)) {
425 Context->Scale = 1;
426 }
427
428 Status = gBS->LocateProtocol (
430 NULL,
431 (VOID **)&UiTheme
432 );
433 if (!EFI_ERROR (Status)) {
434 Status = UiTheme->GetBackgroundColor (&Context->BackgroundColor.Raw);
435 }
436
437 if (EFI_ERROR (Status)) {
438 Context->BackgroundColor.Raw = APPLE_COLOR_SYRAH_BLACK;
439 }
440
441 if (AsciiStrCmp (Picker->PickerVariant, "Auto") == 0) {
442 if (Context->BackgroundColor.Raw == APPLE_COLOR_LIGHT_GRAY) {
443 Context->Prefix = "Acidanthera\\Chardonnay";
444 } else {
445 Context->Prefix = "Acidanthera\\GoldenGate";
446 }
447 } else if (AsciiStrCmp (Picker->PickerVariant, "Default") == 0) {
448 Context->Prefix = "Acidanthera\\GoldenGate";
449 } else {
450 Context->Prefix = Picker->PickerVariant;
451 }
452
454 &Context->Background,
455 Storage,
456 "Background",
457 Context->Scale,
458 0,
459 0,
460 FALSE,
461 Context->Prefix,
462 FALSE
463 );
464
465 if (Context->BackgroundColor.Raw == APPLE_COLOR_SYRAH_BLACK) {
466 Context->LightBackground = FALSE;
467 } else if (Context->BackgroundColor.Raw == APPLE_COLOR_LIGHT_GRAY) {
468 Context->LightBackground = TRUE;
469 } else {
470 //
471 // FIXME: Support proper W3C formula.
472 //
473 Context->LightBackground = (Context->BackgroundColor.Pixel.Red * 299U
474 + Context->BackgroundColor.Pixel.Green * 587U
475 + Context->BackgroundColor.Pixel.Blue * 114U) >= 186000;
476 }
477
478 //
479 // Set background colour with full opacity.
480 //
481 Context->BackgroundColor.Pixel.Reserved = 0xFF;
482
483 for (Index = 0; Index < ICON_NUM_TOTAL; ++Index) {
484 AllowLessSize = FALSE;
485 if (Index == ICON_CURSOR) {
486 ImageWidth = MAX_CURSOR_DIMENSION;
487 ImageHeight = MAX_CURSOR_DIMENSION;
488 AllowLessSize = TRUE;
489 } else if (Index == ICON_SELECTED) {
492 } else if ((Index == ICON_SELECTOR) || (Index == ICON_SET_DEFAULT)) {
493 ImageWidth = BOOT_SELECTOR_BUTTON_WIDTH;
494 ImageHeight = BOOT_SELECTOR_BUTTON_HEIGHT;
495 AllowLessSize = TRUE;
496 } else if ((Index == ICON_LEFT) || (Index == ICON_RIGHT)) {
497 ImageWidth = BOOT_SCROLL_BUTTON_DIMENSION;
498 ImageHeight = BOOT_SCROLL_BUTTON_DIMENSION;
499 } else if ((Index == ICON_SHUT_DOWN) || (Index == ICON_RESTART)) {
500 ImageWidth = BOOT_ACTION_BUTTON_DIMENSION;
501 ImageHeight = BOOT_ACTION_BUTTON_DIMENSION;
502 AllowLessSize = TRUE;
503 } else if (Index == ICON_BUTTON_FOCUS) {
506 AllowLessSize = TRUE;
507 } else if (Index == ICON_PASSWORD) {
508 ImageWidth = PASSWORD_BOX_WIDTH;
509 ImageHeight = PASSWORD_BOX_HEIGHT;
510 AllowLessSize = TRUE;
511 } else if (Index == ICON_LOCK) {
512 ImageWidth = PASSWORD_LOCK_DIMENSION;
513 ImageHeight = PASSWORD_LOCK_DIMENSION;
514 AllowLessSize = TRUE;
515 } else if (Index == ICON_ENTER) {
516 ImageWidth = PASSWORD_ENTER_WIDTH;
517 ImageHeight = PASSWORD_ENTER_HEIGHT;
518 AllowLessSize = TRUE;
519 } else if (Index == ICON_DOT) {
520 ImageWidth = PASSWORD_DOT_DIMENSION;
521 ImageHeight = PASSWORD_DOT_DIMENSION;
522 AllowLessSize = TRUE;
523 } else {
524 ImageWidth = BOOT_ENTRY_ICON_DIMENSION;
525 ImageHeight = BOOT_ENTRY_ICON_DIMENSION;
526 }
527
528 Status = LoadImageFileFromStorage (
529 Context->Icons[Index],
530 Storage,
531 mIconNames[Index],
532 Context->Scale,
533 ImageWidth,
534 ImageHeight,
535 Index >= ICON_NUM_SYS,
536 Context->Prefix,
537 AllowLessSize
538 );
539 if (!EFI_ERROR (Status)) {
540 if ((Index == ICON_SELECTOR) || (Index == ICON_SET_DEFAULT) || (Index == ICON_LEFT) || (Index == ICON_RIGHT) || (Index == ICON_SHUT_DOWN) || (Index == ICON_RESTART) || (Index == ICON_ENTER)) {
542 &Context->Icons[Index][ICON_TYPE_HELD],
543 &Context->Icons[Index][ICON_TYPE_BASE],
545 );
546 if (Index == ICON_SET_DEFAULT) {
547 if (Context->Icons[Index]->Width != Context->Icons[ICON_SELECTOR]->Width) {
548 Status = EFI_UNSUPPORTED;
549 DEBUG ((
550 DEBUG_WARN,
551 "OCUI: %a width %upx != %a width %upx\n",
552 mIconNames[Index],
553 Context->Icons[Index]->Width,
555 Context->Icons[ICON_SELECTOR]->Width
556 ));
559 "Selector must be loaded before SetDefault."
560 );
561 }
562 }
563 } else if ( (Index == ICON_GENERIC_HDD)
564 && (Context->Icons[Index][ICON_TYPE_EXTERNAL].Buffer == NULL))
565 {
566 //
567 // For generic disk icon being able to distinguish internal and external
568 // disk icons is a security requirement. These icons are used whenever
569 // 'typed' external icons are not available.
570 //
571 Status = EFI_NOT_FOUND;
572 DEBUG ((DEBUG_WARN, "OCUI: Missing external disk icon\n"));
575 "The base icon should must be cleaned up explicitly."
576 );
577 } else if (Index == ICON_CURSOR) {
578 if ( (Context->Icons[ICON_CURSOR][ICON_TYPE_BASE].Width < MIN_CURSOR_DIMENSION * Context->Scale)
579 || (Context->Icons[ICON_CURSOR][ICON_TYPE_BASE].Height < MIN_CURSOR_DIMENSION * Context->Scale))
580 {
581 DEBUG ((
582 DEBUG_INFO,
583 "OCUI: Expected at least %dx%d for cursor, actual %dx%d\n",
584 MIN_CURSOR_DIMENSION * Context->Scale,
585 MIN_CURSOR_DIMENSION * Context->Scale,
586 Context->Icons[ICON_CURSOR][ICON_TYPE_BASE].Width,
587 Context->Icons[ICON_CURSOR][ICON_TYPE_BASE].Height
588 ));
589 Status = EFI_UNSUPPORTED;
590 }
591 }
592 } else {
593 ZeroMem (&Context->Icons[Index], sizeof (Context->Icons[Index]));
594 }
595
596 if (EFI_ERROR (Status) && (Index < ICON_NUM_MANDATORY)) {
597 DEBUG ((DEBUG_WARN, "OCUI: Failed to load images for %a\n", Context->Prefix));
598 InternalContextDestruct (Context);
599 return EFI_UNSUPPORTED;
600 }
601 }
602
603 for (Index = 0; Index < LABEL_NUM_TOTAL; ++Index) {
604 if (!UseGenericLabel) {
605 Context->Labels[Index].Buffer = NULL;
606 } else {
607 Status = LoadLabelFromStorage (
608 Storage,
609 mLabelNames[Index],
610 Context->Scale,
611 Context->LightBackground,
612 &Context->Labels[Index]
613 );
614 if (EFI_ERROR (Status)) {
615 Context->Labels[Index].Buffer = NULL;
616 DEBUG ((DEBUG_WARN, "OCUI: Failed to load images\n"));
617 InternalContextDestruct (Context);
618 return EFI_UNSUPPORTED;
619 }
620 }
621 }
622
623 if (Context->Scale == 2) {
624 FontImage = OcStorageReadFileUnicode (Storage, OPEN_CORE_FONT_PATH L"Font_2x.png", &FontImageSize);
625 FontData = OcStorageReadFileUnicode (Storage, OPEN_CORE_FONT_PATH L"Font_2x.bin", &FontDataSize);
626 } else {
627 FontImage = OcStorageReadFileUnicode (Storage, OPEN_CORE_FONT_PATH L"Font_1x.png", &FontImageSize);
628 FontData = OcStorageReadFileUnicode (Storage, OPEN_CORE_FONT_PATH L"Font_1x.bin", &FontDataSize);
629 }
630
631 if ((FontImage != NULL) && (FontData != NULL)) {
632 Result = GuiFontConstruct (
633 &Context->FontContext,
634 FontImage,
635 FontImageSize,
636 FontData,
637 FontDataSize,
638 Context->Scale
639 );
640 if (Context->FontContext.BmfContext.Height != (BOOT_ENTRY_LABEL_HEIGHT - BOOT_ENTRY_LABEL_TEXT_OFFSET) * Context->Scale) {
641 DEBUG ((
642 DEBUG_WARN,
643 "OCUI: Font has height %d instead of %d\n",
644 Context->FontContext.BmfContext.Height,
646 ));
647 Result = FALSE;
648 }
649 } else {
650 Result = FALSE;
651 }
652
653 if (!Result) {
654 DEBUG ((DEBUG_WARN, "OCUI: Font init failed\n"));
655 InternalContextDestruct (Context);
656 return EFI_UNSUPPORTED;
657 }
658
659 return EFI_SUCCESS;
660}
661
662CONST GUI_IMAGE *
664 IN BOOT_PICKER_GUI_CONTEXT *Context
665 )
666{
667 ASSERT (Context != NULL);
668 //
669 // ATTENTION: All images must have the same dimensions.
670 //
671 return &Context->Icons[ICON_CURSOR][ICON_TYPE_BASE];
672}
EFI_GUID gAppleVendorVariableGuid
#define APPLE_UI_SCALE_VARIABLE_NAME
BOOLEAN GuiFontConstruct(OUT GUI_FONT_CONTEXT *Context, IN VOID *FontImage, IN UINTN FontImageSize, IN VOID *FileBuffer, IN UINT32 FileSize, IN UINT8 Scale)
Definition BitmapFont.c:718
GLOBAL_REMOVE_IF_UNREFERENCED BOOT_PICKER_GUI_CONTEXT mGuiContext
Definition GuiApp.c:29
STATIC EFI_GRAPHICS_OUTPUT_BLT_PIXEL mHighlightPixel
Definition GuiApp.c:34
STATIC EFI_STATUS LoadLabelFileFromStorageForScale(IN OC_STORAGE_CONTEXT *Storage, IN CONST CHAR8 *LabelFilePath, IN UINT8 Scale, OUT VOID **FileData, OUT UINT32 *FileSize)
Definition GuiApp.c:214
STATIC CONST CHAR8 * mLabelNames[LABEL_NUM_TOTAL]
Definition GuiApp.c:38
STATIC CONST CHAR8 * mIconNames[ICON_NUM_TOTAL]
Definition GuiApp.c:56
CONST GUI_IMAGE * InternalGetCursorImage(IN BOOT_PICKER_GUI_CONTEXT *Context)
Definition GuiApp.c:663
STATIC VOID InternalContextDestruct(IN OUT BOOT_PICKER_GUI_CONTEXT *Context)
Definition GuiApp.c:94
EFI_STATUS InternalGetFlavourIcon(IN BOOT_PICKER_GUI_CONTEXT *GuiContext, IN OC_STORAGE_CONTEXT *Storage, IN CHAR8 *FlavourName, IN UINTN FlavourNameLen, IN UINT32 IconTypeIndex, IN BOOLEAN UseFlavourIcon, OUT GUI_IMAGE *EntryIcon, OUT BOOLEAN *CustomIcon)
Definition GuiApp.c:287
EFI_STATUS InternalContextConstruct(OUT BOOT_PICKER_GUI_CONTEXT *Context, IN OC_STORAGE_CONTEXT *Storage, IN OC_PICKER_CONTEXT *Picker)
Definition GuiApp.c:389
STATIC VOID InternalSafeFreePool(IN CONST VOID *Memory)
Definition GuiApp.c:83
EFI_STATUS LoadLabelFromStorage(IN OC_STORAGE_CONTEXT *Storage, IN CONST CHAR8 *ImageFilePath, IN UINT8 Scale, IN BOOLEAN Inverted, OUT GUI_IMAGE *Image)
Definition GuiApp.c:256
STATIC EFI_STATUS LoadImageFileFromStorage(OUT GUI_IMAGE *Images, IN OC_STORAGE_CONTEXT *Storage, IN CONST CHAR8 *ImageFilePath, IN UINT8 Scale, IN UINT32 MatchWidth, IN UINT32 MatchHeight, IN BOOLEAN Icon, IN CONST CHAR8 *Prefix, IN BOOLEAN AllowLessSize)
Definition GuiApp.c:125
#define MAX_CURSOR_DIMENSION
Definition GuiApp.h:18
#define PASSWORD_ENTER_WIDTH
Definition GuiApp.h:49
#define PASSWORD_DOT_DIMENSION
Definition GuiApp.h:55
#define BOOT_ACTION_BUTTON_FOCUS_DIMENSION
Definition GuiApp.h:44
#define BOOT_ENTRY_LABEL_HEIGHT
Definition GuiApp.h:25
#define BOOT_ACTION_BUTTON_DIMENSION
Definition GuiApp.h:43
@ LABEL_RESET_NVRAM
Definition GuiApp.h:65
@ LABEL_SHELL
Definition GuiApp.h:66
@ LABEL_APPLE
Definition GuiApp.h:59
@ LABEL_NUM_TOTAL
Definition GuiApp.h:71
@ LABEL_TOOL
Definition GuiApp.h:64
@ LABEL_OTHER
Definition GuiApp.h:63
@ LABEL_FIRMWARE_SETTINGS
Definition GuiApp.h:69
@ LABEL_SIP_IS_DISABLED
Definition GuiApp.h:68
@ LABEL_NETWORK_BOOT
Definition GuiApp.h:70
@ LABEL_GENERIC_HDD
Definition GuiApp.h:58
@ LABEL_APPLE_RECOVERY
Definition GuiApp.h:60
@ LABEL_APPLE_TIME_MACHINE
Definition GuiApp.h:61
@ LABEL_WINDOWS
Definition GuiApp.h:62
@ LABEL_SIP_IS_ENABLED
Definition GuiApp.h:67
#define PASSWORD_BOX_HEIGHT
Definition GuiApp.h:53
#define BOOT_SELECTOR_BUTTON_HEIGHT
Definition GuiApp.h:33
@ ICON_TYPE_BASE
Definition GuiApp.h:103
@ ICON_TYPE_EXTERNAL
Definition GuiApp.h:104
@ ICON_TYPE_HELD
Definition GuiApp.h:105
@ ICON_TYPE_COUNT
Definition GuiApp.h:106
#define BOOT_SELECTOR_BUTTON_WIDTH
Definition GuiApp.h:32
#define BOOT_ENTRY_LABEL_TEXT_OFFSET
Definition GuiApp.h:26
@ ICON_APPLE_RECOVERY
Definition GuiApp.h:92
@ ICON_ENTER
Definition GuiApp.h:86
@ ICON_NUM_TOTAL
Definition GuiApp.h:99
@ ICON_SET_DEFAULT
Definition GuiApp.h:78
@ ICON_LOCK
Definition GuiApp.h:87
@ ICON_TOOL
Definition GuiApp.h:96
@ ICON_NUM_MANDATORY
Definition GuiApp.h:90
@ ICON_OTHER
Definition GuiApp.h:95
@ ICON_CURSOR
Definition GuiApp.h:75
@ ICON_APPLE
Definition GuiApp.h:91
@ ICON_DOT
Definition GuiApp.h:85
@ ICON_SELECTOR
Definition GuiApp.h:77
@ ICON_NUM_SYS
Definition GuiApp.h:88
@ ICON_GENERIC_HDD
Definition GuiApp.h:89
@ ICON_LEFT
Definition GuiApp.h:79
@ ICON_BUTTON_FOCUS
Definition GuiApp.h:83
@ ICON_RESTART
Definition GuiApp.h:82
@ ICON_WINDOWS
Definition GuiApp.h:94
@ ICON_APPLE_TIME_MACHINE
Definition GuiApp.h:93
@ ICON_SHELL
Definition GuiApp.h:98
@ ICON_RESET_NVRAM
Definition GuiApp.h:97
@ ICON_RIGHT
Definition GuiApp.h:80
@ ICON_SELECTED
Definition GuiApp.h:76
@ ICON_SHUT_DOWN
Definition GuiApp.h:81
@ ICON_PASSWORD
Definition GuiApp.h:84
#define BOOT_ENTRY_ICON_DIMENSION
Definition GuiApp.h:22
#define MIN_CURSOR_DIMENSION
Definition GuiApp.h:19
#define PASSWORD_BOX_WIDTH
Definition GuiApp.h:52
#define PASSWORD_LOCK_DIMENSION
Definition GuiApp.h:47
#define PASSWORD_ENTER_HEIGHT
Definition GuiApp.h:50
#define BOOT_SCROLL_BUTTON_DIMENSION
Definition GuiApp.h:40
#define BOOT_SELECTOR_BACKGROUND_DIMENSION
Definition GuiApp.h:31
EFI_STATUS GuiLabelToImage(OUT GUI_IMAGE *Image, IN VOID *RawData, IN UINT32 DataLength, IN UINT8 Scale, IN BOOLEAN Inverted)
Definition Images.c:180
EFI_STATUS GuiIcnsToImageIcon(OUT GUI_IMAGE *Image, IN VOID *IcnsImage, IN UINT32 IcnsImageSize, IN UINT8 Scale, IN UINT32 MatchWidth, IN UINT32 MatchHeight, IN BOOLEAN AllowLess)
Definition Images.c:46
EFI_STATUS GuiCreateHighlightedImage(OUT GUI_IMAGE *SelectedImage, IN CONST GUI_IMAGE *SourceImage, IN CONST EFI_GRAPHICS_OUTPUT_BLT_PIXEL *HighlightPixel)
Definition Images.c:279
STATIC_ASSERT(BYTES_PER_PIXEL==sizeof(UINT32), "Non 4-byte pixels are unsupported!")
#define OC_ATTR_USE_GENERIC_LABEL_IMAGE
#define OC_FLAVOUR_AUTO
#define OPEN_CORE_IMAGE_PATH
#define OPEN_CORE_FONT_PATH
#define OPEN_CORE_LABEL_PATH
EFI_BOOT_SERVICES * gBS
#define OC_MAX_CONTENT_FLAVOUR_SIZE
Definition OcFileLib.h:37
BOOLEAN OcStorageExistsFileUnicode(IN OC_STORAGE_CONTEXT *Context, IN CONST CHAR16 *FilePath)
VOID * OcStorageReadFileUnicode(IN OC_STORAGE_CONTEXT *Context, IN CONST CHAR16 *FilePath, OUT UINT32 *FileSize OPTIONAL)
#define OC_STORAGE_SAFE_PATH_MAX
VOID UnicodeUefiSlashes(IN OUT CHAR16 *String)
INTN EFIAPI OcAsciiStrniCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString, IN UINTN Length)
Definition OcAsciiLib.c:226
EFI_STATUS EFIAPI OcUnicodeSafeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_RUNTIME_SERVICES * gRT
#define APPLE_COLOR_SYRAH_BLACK
#define APPLE_COLOR_LIGHT_GRAY
EFI_GUID gEfiUserInterfaceThemeProtocolGuid
#define ASSERT(x)
Definition coder.h:55
UI_THEME_GET_BACKGROUND_COLOR GetBackgroundColor
Present as of Revision 1.