OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
BootPicker.c
Go to the documentation of this file.
1
8#include <Uefi.h>
9
11
12#include <Library/UefiBootServicesTableLib.h>
13#include <Library/UefiRuntimeServicesTableLib.h>
14
15#include <Library/BaseLib.h>
16#include <Library/BaseMemoryLib.h>
17#include <Library/DebugLib.h>
18#include <Library/MemoryAllocationLib.h>
20#include <Library/OcPngLib.h>
22#include <Library/OcMiscLib.h>
23
24#include "../OpenCanopy.h"
25#include "../BmfLib.h"
26#include "../GuiApp.h"
27#include "../GuiIo.h"
28#include "BootPicker.h"
29
30#include "Common.h"
31#include "../Blending.h"
32
33#define BOOT_LABEL_WRAPAROUND_PADDING 30U
34#define BOOT_LABEL_SCROLLING_HOLD_TIME 180U
35
36#define BOOT_LABEL_SHADOW_WIDTH 8U
37#define BOOT_LABEL_SHADOW_HEIGHT BOOT_ENTRY_LABEL_HEIGHT
38
40
48extern CONST GUI_IMAGE mBackgroundImage;
49
50// STATIC UINT8 mBootPickerImageIndex = 0;
51
52extern INT64 mBackgroundImageOffsetX;
53extern INT64 mBackgroundImageOffsetY;
54
56
62
68
72
73STATIC
76 IN UINT32 Index
77 )
78{
80 return (GUI_VOLUME_ENTRY *)(
82 );
83}
84
85STATIC
86VOID
88 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
89 IN CONST GUI_VOLUME_ENTRY *Entry
90 )
91{
93 DrawContext,
94 mBootPickerContainer.Obj.OffsetX + mBootPicker.Hdr.Obj.OffsetX + Entry->Hdr.Obj.OffsetX,
95 (mBootPickerContainer.Obj.OffsetY + mBootPicker.Hdr.Obj.OffsetY + Entry->Hdr.Obj.OffsetY + Entry->Hdr.Obj.Height - Entry->Label.Height),
96 Entry->Hdr.Obj.Width,
97 Entry->Label.Height
98 );
99}
100
101BOOLEAN
103 IN BOOT_PICKER_GUI_CONTEXT *Context,
104 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
105 IN UINT64 CurrentTime
106 )
107{
108 GUI_VOLUME_ENTRY *Entry;
109
110 ASSERT (DrawContext != NULL);
111
114 return FALSE;
115 }
116
118 if (Entry->Label.Width <= Entry->Hdr.Obj.Width) {
119 return FALSE;
120 }
121
122 Entry->ShowLeftShadow = TRUE;
123 Entry->LabelOffset -= DrawContext->Scale;
124
125 if (Entry->LabelOffset <= -(INT16)Entry->Label.Width) {
126 //
127 // Hide the left shadow once the first label is hidden.
128 //
129 Entry->ShowLeftShadow = FALSE;
130 //
131 // If the second drawn label reaches the front, switch back to the first.
132 //
133 if (Entry->LabelOffset <= -(INT16)(Entry->Label.Width + BOOT_LABEL_WRAPAROUND_PADDING * DrawContext->Scale)) {
134 Entry->LabelOffset = 0;
136 }
137 }
138
139 InternalRedrawVolumeLabel (DrawContext, Entry);
140
141 return FALSE;
142}
143
145 { NULL, NULL },
146 NULL,
148};
149
150VOID
152 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
153 IN CONST GUI_VOLUME_ENTRY *Entry
154 )
155{
156 ASSERT (!IsNodeInList (&DrawContext->Animations, &mBootPickerLabelAnimation.Link));
157 //
158 // Reset the boot entry label scrolling timer.
159 //
161
162 if (Entry->Label.Width > Entry->Hdr.Obj.Width) {
163 //
164 // Add the animation if the next entry needs scrolling.
165 //
166 InsertHeadList (&DrawContext->Animations, &mBootPickerLabelAnimation.Link);
167 }
168}
169
170VOID
172 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
173 IN OUT GUI_VOLUME_ENTRY *Entry
174 )
175{
176 if (Entry->Label.Width > Entry->Hdr.Obj.Width) {
177 //
178 // Reset the label of the old entry back to its default position.
179 //
180 if (Entry->LabelOffset != 0) {
181 Entry->ShowLeftShadow = FALSE;
182 Entry->LabelOffset = 0;
183 InternalRedrawVolumeLabel (DrawContext, Entry);
184 }
185
186 RemoveEntryList (&mBootPickerLabelAnimation.Link);
187 InitializeListHead (&mBootPickerLabelAnimation.Link);
188 }
189}
190
191VOID
193 IN OUT GUI_VOLUME_PICKER *This,
194 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
195 IN UINT32 NewIndex
196 )
197{
198 GUI_VOLUME_ENTRY *OldEntry;
199 CONST GUI_VOLUME_ENTRY *NewEntry;
200
201 ASSERT (This != NULL);
202 ASSERT (NewIndex < mBootPicker.Hdr.Obj.NumChildren);
203
204 OldEntry = InternalGetVolumeEntry (This->SelectedIndex);
205 This->SelectedIndex = NewIndex;
206 NewEntry = InternalGetVolumeEntry (NewIndex);
207
208 ASSERT (NewEntry->Hdr.Obj.Width <= mBootPickerSelectorContainer.Obj.Width);
210
211 mBootPickerSelectorContainer.Obj.OffsetX = mBootPicker.Hdr.Obj.OffsetX + NewEntry->Hdr.Obj.OffsetX - (mBootPickerSelectorContainer.Obj.Width - NewEntry->Hdr.Obj.Width) / 2;
212
213 if (DrawContext != NULL) {
214 if (OldEntry->Label.Width > OldEntry->Hdr.Obj.Width) {
215 ASSERT (IsNodeInList (&DrawContext->Animations, &mBootPickerLabelAnimation.Link));
216 }
217
218 InternalStopAnimateLabel (DrawContext, OldEntry);
219 InternalStartAnimateLabel (DrawContext, NewEntry);
220 //
221 // Set voice timeout to N frames from now.
222 //
223 DrawContext->GuiContext->AudioPlaybackTimeout = OC_VOICE_OVER_IDLE_TIMEOUT_MS;
224 DrawContext->GuiContext->VoAction = CanopyVoSelectedEntry;
225 DrawContext->GuiContext->BootEntry = NewEntry->Context;
226 }
227}
228
229INT64
231 VOID
232 )
233{
234 CONST GUI_VOLUME_ENTRY *SelectedEntry;
235 INT64 EntryOffsetX;
236 UINT32 EntryWidth;
237
239
240 //
241 // No scroll required if nothing off screen
242 //
244 return 0;
245 }
246
247 //
248 // If the selected entry is outside of the view, scroll it accordingly.
249 //
251 EntryOffsetX = mBootPicker.Hdr.Obj.OffsetX + SelectedEntry->Hdr.Obj.OffsetX - (mBootPickerSelectorContainer.Obj.Width - SelectedEntry->Hdr.Obj.Width) / 2;
252 EntryWidth = SelectedEntry->Hdr.Obj.Width + (mBootPickerSelectorContainer.Obj.Width - SelectedEntry->Hdr.Obj.Width);
253
254 if (EntryOffsetX < 0) {
255 return -EntryOffsetX;
256 }
257
258 if (EntryOffsetX + EntryWidth > mBootPickerContainer.Obj.Width) {
259 return -((EntryOffsetX + EntryWidth) - mBootPickerContainer.Obj.Width);
260 }
261
262 return 0;
263}
264
265VOID
282
283VOID
285 IN OUT GUI_VOLUME_PICKER *This,
286 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
287 IN INT64 BaseX,
288 IN INT64 BaseY,
289 IN INT64 ScrollOffset
290 )
291{
292 INT64 ScrollX;
293 INT64 ScrollY;
294
295 mBootPicker.Hdr.Obj.OffsetX += ScrollOffset;
298 //
299 // The entry list has been scrolled, the entire horizontal space to also cover
300 // the scroll buttons.
301 //
302 DEBUG_CODE_BEGIN ();
305 DrawContext,
306 &ScrollX,
307 &ScrollY
308 );
309 ASSERT (ScrollY >= BaseY);
310 ASSERT (ScrollY + mBootPickerLeftScroll.Hdr.Obj.Height <= BaseY + This->Hdr.Obj.Height);
311
314 DrawContext,
315 &ScrollX,
316 &ScrollY
317 );
318 ASSERT (ScrollY >= BaseY);
319 ASSERT (ScrollY + mBootPickerRightScroll.Hdr.Obj.Height <= BaseY + This->Hdr.Obj.Height);
320 DEBUG_CODE_END ();
321 //
322 // The container is constructed such that it is always fully visible.
323 //
324 ASSERT (This->Hdr.Obj.Height <= mBootPickerContainer.Obj.Height);
325 ASSERT (BaseY + This->Hdr.Obj.Height <= DrawContext->Screen.Height);
326
328 0,
329 (UINT32)BaseY,
330 DrawContext->Screen.Width,
331 This->Hdr.Obj.Height
332 );
333}
334
335VOID
337 IN OUT GUI_VOLUME_PICKER *This,
338 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
339 IN INT64 BaseX,
340 IN INT64 BaseY,
341 IN UINT32 NewIndex
342 )
343{
344 INT64 ScrollOffset;
345 INT64 OldSelectorOffsetX;
346
347 ASSERT (This != NULL);
348 ASSERT (DrawContext != NULL);
349 ASSERT (NewIndex < This->Hdr.Obj.NumChildren);
350 //
351 // The caller must guarantee the entry is actually new for performance
352 // reasons.
353 //
354 ASSERT (This->SelectedIndex != NewIndex);
355
356 OldSelectorOffsetX = mBootPickerSelectorContainer.Obj.OffsetX;
357 InternalBootPickerSelectEntry (This, DrawContext, NewIndex);
358
359 ScrollOffset = InternelBootPickerScrollSelected ();
360 if (ScrollOffset == 0) {
362 DrawContext,
363 mBootPickerContainer.Obj.OffsetX + OldSelectorOffsetX,
367 );
368
370 DrawContext,
375 );
376 } else {
378 This,
379 DrawContext,
380 BaseX,
381 BaseY,
382 ScrollOffset
383 );
384 }
385}
386
387VOID
389 IN OUT GUI_OBJ *This,
390 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
391 IN BOOT_PICKER_GUI_CONTEXT *GuiContext,
392 IN CONST GUI_KEY_EVENT *KeyEvent
393 )
394{
395 GUI_VOLUME_PICKER *Picker;
396 INT64 BaseX;
397 INT64 BaseY;
398 CONST GUI_VOLUME_ENTRY *SelectedEntry;
399 UINT8 ImageId;
400
401 ASSERT (This != NULL);
402 ASSERT (GuiContext != NULL);
403 ASSERT (DrawContext != NULL);
404
405 if ((KeyEvent->OcModifiers & OC_MODIFIERS_SET_DEFAULT) == 0) {
406 ImageId = ICON_SELECTOR;
407 } else {
408 ImageId = ICON_SET_DEFAULT;
409 }
410
411 if (mBootPickerSelectorButton.ImageId != ImageId) {
418 );
419 }
420
421 Picker = BASE_CR (This, GUI_VOLUME_PICKER, Hdr.Obj);
422
425
426 if (KeyEvent->OcKeyCode == OC_INPUT_RIGHT) {
427 if (mBootPicker.Hdr.Obj.NumChildren > 1) {
429 Picker,
430 DrawContext,
431 BaseX,
432 BaseY,
435 : 0
436 );
437 }
438 } else if (KeyEvent->OcKeyCode == OC_INPUT_LEFT) {
440 if (mBootPicker.Hdr.Obj.NumChildren > 1) {
442 Picker,
443 DrawContext,
444 BaseX,
445 BaseY,
449 );
450 }
451 } else if (KeyEvent->OcKeyCode == OC_INPUT_CONTINUE) {
452 if (mBootPicker.Hdr.Obj.NumChildren > 0) {
454 SelectedEntry->Context->SetDefault = (KeyEvent->OcModifiers & OC_MODIFIERS_SET_DEFAULT) != 0;
455 GuiContext->ReadyToBoot = TRUE;
456 ASSERT (GuiContext->BootEntry == SelectedEntry->Context);
457 }
458 } else if ( GuiContext->PickerContext->PickerAudioAssist
459 && (KeyEvent->OcKeyCode >= 0)
460 && ((UINTN)KeyEvent->OcKeyCode < mBootPicker.Hdr.Obj.NumChildren)
461 )
462 {
464 Picker,
465 DrawContext,
466 BaseX,
467 BaseY,
468 (UINT32)KeyEvent->OcKeyCode
469 );
471 SelectedEntry->Context->SetDefault = (KeyEvent->OcModifiers & OC_MODIFIERS_SET_DEFAULT) != 0;
472 GuiContext->ReadyToBoot = TRUE;
473 ASSERT (GuiContext->BootEntry == SelectedEntry->Context);
474 } else if (mBootPickerContainer.Obj.Opacity != 0xFF) {
475 //
476 // FIXME: Other keys are not allowed when boot picker is partially transparent.
477 //
478 return;
479 }
480
481 if (KeyEvent->OcKeyCode == OC_INPUT_MORE) {
482 //
483 // Match Builtin picker logic here: only refresh if the keypress makes a change
484 //
485 if (GuiContext->HideAuxiliary) {
486 GuiContext->HideAuxiliary = FALSE;
487 GuiContext->Refresh = TRUE;
488 DrawContext->GuiContext->PickerContext->PlayAudioFile (
489 DrawContext->GuiContext->PickerContext,
492 FALSE
493 );
494 }
495 } else if (KeyEvent->OcKeyCode == OC_INPUT_ABORTED) {
496 GuiContext->Refresh = TRUE;
497 DrawContext->GuiContext->PickerContext->PlayAudioFile (
498 DrawContext->GuiContext->PickerContext,
501 FALSE
502 );
503 }
504}
505
506STATIC
507VOID
509 IN OUT GUI_OBJ *This,
510 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
511 IN BOOT_PICKER_GUI_CONTEXT *Context,
512 IN INT64 BaseX,
513 IN INT64 BaseY,
514 IN UINT32 OffsetX,
515 IN UINT32 OffsetY,
516 IN UINT32 Width,
517 IN UINT32 Height,
518 IN UINT8 Opacity
519 )
520{
521 UINT32 ShadowWidth;
522 UINT32 ShadowStart;
523 UINT32 ShadowEnd;
524 UINT32 LeftShadowSize;
525 UINT32 RightShadowSize1;
526 UINT32 RightShadowSize2;
527 UINT32 LabelWidth;
528 UINT32 ColumnOffset;
529 UINT8 ShadowOpacity;
530 INT64 LabelOffset;
531
532 CONST GUI_VOLUME_ENTRY *Entry;
533 CONST GUI_IMAGE *EntryIcon;
534 CONST GUI_IMAGE *Label;
535
536 ASSERT (This != NULL);
537 ASSERT (DrawContext != NULL);
538 ASSERT (Context != NULL);
539
540 Entry = BASE_CR (This, GUI_VOLUME_ENTRY, Hdr.Obj);
541
542 /*if (mBootPickerImageIndex < 5) {
543 EntryIcon = &((BOOT_PICKER_GUI_CONTEXT *) DrawContext->GuiContext)->Poof[mBootPickerImageIndex];
544 } else */{
545 EntryIcon = &Entry->EntryIcon;
546 }
547 Label = &Entry->Label;
548 //
549 // Draw the icon horizontally centered.
550 //
551 ASSERT (EntryIcon != NULL);
552 ASSERT_EQUALS (EntryIcon->Width, This->Width);
553
554 if (OffsetY < EntryIcon->Height) {
556 EntryIcon,
557 Opacity,
558 DrawContext,
559 BaseX,
560 BaseY,
561 OffsetX,
562 OffsetY,
563 Width,
564 Height
565 );
566 }
567
568 ASSERT (Label->Height <= BOOT_ENTRY_LABEL_HEIGHT * DrawContext->Scale);
569
570 if (Entry->Label.Width <= This->Width) {
571 //
572 // Draw the label horizontally centered.
573 //
575 Label,
576 Opacity,
577 DrawContext,
578 BaseX,
579 BaseY,
580 Entry->LabelOffset,
581 This->Height - Label->Height,
582 OffsetX,
583 OffsetY,
584 Width,
585 Height
586 );
587 } else {
588 //
589 // Draw scrolling label with fade-in and fade-out.
590 //
591 ShadowWidth = BOOT_LABEL_SHADOW_WIDTH * DrawContext->Scale;
592
593 if (!Entry->ShowLeftShadow) {
594 LeftShadowSize = 0;
595 } else {
596 //
597 // Draw left shadow one column at a time.
598 //
599 ShadowStart = OffsetX; // <- No left clip, unsigned
600
601 if (OffsetX + Width > ShadowWidth) {
602 ShadowEnd = ShadowWidth;
603 } else {
604 ShadowEnd = OffsetX + Width;
605 }
606
607 if (ShadowEnd <= ShadowStart) {
608 LeftShadowSize = 0;
609 } else {
610 LeftShadowSize = ShadowEnd - ShadowStart;
611
612 for (ColumnOffset = ShadowStart; ColumnOffset < ShadowEnd; ++ColumnOffset) {
613 ShadowOpacity = (UINT8)(((ColumnOffset + 1) * 0xFF) / (ShadowWidth + 1));
614
615 ShadowOpacity = RGB_APPLY_OPACITY (
616 Opacity,
617 ShadowOpacity
618 );
619
621 Label,
622 ShadowOpacity,
623 DrawContext,
624 BaseX,
625 BaseY,
626 Entry->LabelOffset,
627 This->Height - Label->Height,
628 ColumnOffset,
629 OffsetY,
630 1,
631 Height
632 );
633 }
634 }
635 }
636
637 //
638 // If the label needs scrolling, draw a second one to get a wraparound effect.
639 //
640
641 //
642 // Draw right shadow one column at a time.
643 //
644 if (OffsetX < This->Width - ShadowWidth) {
645 ShadowStart = This->Width - ShadowWidth;
646 } else {
647 ShadowStart = OffsetX;
648 }
649
650 if (OffsetX + Width > This->Width) {
651 ShadowEnd = This->Width;
652 } else {
653 ShadowEnd = OffsetX + Width;
654 }
655
656 if (ShadowEnd <= ShadowStart) {
657 RightShadowSize1 = 0;
658 RightShadowSize2 = 0;
659 } else {
660 //
661 // Right shadow needs to be drawn on first or second label depending on
662 // position of scroll, but never on both because of the padding between them.
663 //
664 STATIC_ASSERT (BOOT_LABEL_WRAPAROUND_PADDING >= BOOT_LABEL_SHADOW_WIDTH, "additional code required for wraparound padding < shadow width");
665
666 LabelOffset = Entry->LabelOffset + Entry->Label.Width + BOOT_LABEL_WRAPAROUND_PADDING * DrawContext->Scale;
667 if (LabelOffset > This->Width) {
668 LabelOffset = Entry->LabelOffset;
669 RightShadowSize1 = ShadowEnd - ShadowStart;
670 RightShadowSize2 = 0;
671 } else {
672 RightShadowSize1 = 0;
673 RightShadowSize2 = ShadowEnd - ShadowStart;
674 }
675
676 for (ColumnOffset = ShadowStart; ColumnOffset < ShadowEnd; ++ColumnOffset) {
677 ShadowOpacity = (UINT8)(((ColumnOffset - (This->Width - ShadowWidth) + 1) * 0xFF) / (ShadowWidth + 1));
678
679 ShadowOpacity = RGB_APPLY_OPACITY (
680 Opacity,
681 0xFF - ShadowOpacity
682 );
683
685 Label,
686 ShadowOpacity,
687 DrawContext,
688 BaseX,
689 BaseY,
690 LabelOffset,
691 This->Height - Label->Height,
692 ColumnOffset,
693 OffsetY,
694 1,
695 Height
696 );
697 }
698 }
699
700 //
701 // Draw non-shaded part of first label.
702 //
703 LabelWidth = Width - MIN (Width, LeftShadowSize);
704 LabelWidth = LabelWidth - MIN (LabelWidth, RightShadowSize1);
705 if (LabelWidth > 0) {
707 Label,
708 Opacity,
709 DrawContext,
710 BaseX,
711 BaseY,
712 Entry->LabelOffset,
713 This->Height - Label->Height,
714 OffsetX + LeftShadowSize,
715 OffsetY,
716 LabelWidth,
717 Height
718 );
719 }
720
721 //
722 // Draw non-shaded part of second label.
723 //
724 LabelWidth = Width - MIN (Width, RightShadowSize2);
725 if (LabelWidth > 0) {
727 Label,
728 Opacity,
729 DrawContext,
730 BaseX,
731 BaseY,
732 (INT64)Entry->LabelOffset + Entry->Label.Width + BOOT_LABEL_WRAPAROUND_PADDING * DrawContext->Scale,
733 This->Height - Label->Height,
734 OffsetX,
735 OffsetY,
736 LabelWidth,
737 Height
738 );
739 }
740 }
741
742 //
743 // There should be no children.
744 //
745 ASSERT (This->NumChildren == 0);
746}
747
748STATIC
749GUI_OBJ *
751 IN OUT GUI_OBJ *This,
752 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
753 IN BOOT_PICKER_GUI_CONTEXT *Context,
754 IN INT64 BaseX,
755 IN INT64 BaseY,
756 IN CONST GUI_PTR_EVENT *Event
757 )
758{
759 GUI_VOLUME_ENTRY *Entry;
760 BOOLEAN IsHit;
761 UINT32 OffsetX;
762 UINT32 OffsetY;
763
764 OffsetX = (UINT32)(Event->Pos.Pos.X - BaseX);
765 OffsetY = (UINT32)(Event->Pos.Pos.Y - BaseY);
766
767 ASSERT (
768 Event->Type == GuiPointerPrimaryDown
769 || Event->Type == GuiPointerPrimaryUp
770 || Event->Type == GuiPointerPrimaryDoubleClick
771 );
772
773 Entry = BASE_CR (This, GUI_VOLUME_ENTRY, Hdr.Obj);
774
775 IsHit = GuiClickableIsHit (
776 &Entry->EntryIcon,
777 OffsetX,
778 OffsetY
779 );
780 if (!IsHit) {
781 return This;
782 }
783
784 if (Event->Type == GuiPointerPrimaryDown) {
785 if (mBootPicker.SelectedIndex != Entry->Index) {
786 ASSERT (Entry->Hdr.Parent == &mBootPicker.Hdr.Obj);
789 DrawContext,
790 BaseX - This->OffsetX,
791 BaseY - This->OffsetY,
792 Entry->Index
793 );
794 }
795 } else if (Event->Type == GuiPointerPrimaryDoubleClick) {
796 //
797 // This must be ensured because the UI directs Move/Up events to the object
798 // Down had been sent to.
799 //
801 Context->ReadyToBoot = TRUE;
802 }
803
804 //
805 // There should be no children.
806 //
807 ASSERT (This->NumChildren == 0);
808 return This;
809}
810
811VOID
813 IN OUT GUI_OBJ *This,
814 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
815 IN BOOT_PICKER_GUI_CONTEXT *Context,
816 IN INT64 BaseX,
817 IN INT64 BaseY,
818 IN UINT32 OffsetX,
819 IN UINT32 OffsetY,
820 IN UINT32 Width,
821 IN UINT32 Height,
822 IN UINT8 Opacity
823 )
824{
825 CONST GUI_IMAGE *BackgroundImage;
826
827 ASSERT (This != NULL);
828 ASSERT (DrawContext != NULL);
829 ASSERT (Context != NULL);
830
831 BackgroundImage = &Context->Icons[ICON_SELECTED][ICON_TYPE_BASE];
832
833 ASSERT_EQUALS (This->Width, BackgroundImage->Width);
834 ASSERT_EQUALS (This->Height, BackgroundImage->Height);
835
837 BackgroundImage,
838 Opacity,
839 DrawContext,
840 BaseX,
841 BaseY,
842 OffsetX,
843 OffsetY,
844 Width,
845 Height
846 );
847 //
848 // There should be no children.
849 //
850 ASSERT (This->NumChildren == 0);
851}
852
853GUI_OBJ *
855 IN OUT GUI_OBJ *This,
856 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
857 IN BOOT_PICKER_GUI_CONTEXT *Context,
858 IN INT64 BaseX,
859 IN INT64 BaseY,
860 IN CONST GUI_PTR_EVENT *Event
861 )
862{
863 UINT8 Result;
864
866 This,
867 DrawContext,
868 Context,
869 BaseX,
870 BaseY,
871 Event
872 );
873 switch (Result) {
874 case CommonPtrNotHit:
875 {
876 return NULL;
877 }
878
879 case CommonPtrAction:
880 {
881 Context->ReadyToBoot = TRUE;
882 //
883 // Falthrough to 'hit' case.
884 //
885 }
886
887 case CommonPtrHit:
888 {
889 break;
890 }
891 }
892
893 return This;
894}
895
896GUI_OBJ *
898 IN OUT GUI_OBJ *This,
899 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
900 IN BOOT_PICKER_GUI_CONTEXT *Context,
901 IN INT64 BaseX,
902 IN INT64 BaseY,
903 IN CONST GUI_PTR_EVENT *Event
904 )
905{
906 UINT8 Result;
907
908 INT64 BootPickerX;
909 INT64 BootPickerY;
910 CONST GUI_VOLUME_ENTRY *SelectedEntry;
911
912 if (This->Opacity == 0) {
913 return NULL;
914 }
915
917 This,
918 DrawContext,
919 Context,
920 BaseX,
921 BaseY,
922 Event
923 );
924 switch (Result) {
925 case CommonPtrNotHit:
926 {
927 return NULL;
928 }
929
930 case CommonPtrAction:
931 {
932 //
933 // The view can only be scrolled when there are off-screen entries.
934 //
937 DrawContext,
938 &BootPickerX,
939 &BootPickerY
940 );
941 //
942 // Scroll the boot entry view by one spot.
943 //
946 DrawContext,
947 BootPickerX,
948 BootPickerY,
949 (BOOT_ENTRY_WIDTH + BOOT_ENTRY_SPACE) * Context->Scale
950 );
951 //
952 // If the selected entry is pushed off-screen by scrolling, select the
953 // appropriate neighbour entry.
954 //
956 if (mBootPicker.Hdr.Obj.OffsetX + SelectedEntry->Hdr.Obj.OffsetX + SelectedEntry->Hdr.Obj.Width > mBootPickerContainer.Obj.Width) {
957 //
958 // The internal design ensures a selected entry cannot be off-screen,
959 // scrolling offsets it by at most one spot.
960 //
963 DrawContext,
967 );
968
970 ASSERT (!(mBootPicker.Hdr.Obj.OffsetX + SelectedEntry->Hdr.Obj.OffsetX + SelectedEntry->Hdr.Obj.Width > mBootPickerContainer.Obj.Width));
971 }
972
973 //
974 // Falthrough to 'hit' case.
975 //
976 }
977
978 case CommonPtrHit:
979 {
980 break;
981 }
982 }
983
984 return This;
985}
986
987GUI_OBJ *
989 IN OUT GUI_OBJ *This,
990 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
991 IN BOOT_PICKER_GUI_CONTEXT *Context,
992 IN INT64 BaseX,
993 IN INT64 BaseY,
994 IN CONST GUI_PTR_EVENT *Event
995 )
996{
997 UINT8 Result;
998
999 INT64 BootPickerX;
1000 INT64 BootPickerY;
1001 GUI_VOLUME_ENTRY *SelectedEntry;
1002
1003 if (This->Opacity == 0) {
1004 return NULL;
1005 }
1006
1008 This,
1009 DrawContext,
1010 Context,
1011 BaseX,
1012 BaseY,
1013 Event
1014 );
1015 switch (Result) {
1016 case CommonPtrNotHit:
1017 {
1018 return NULL;
1019 }
1020
1021 case CommonPtrAction:
1022 {
1023 //
1024 // The view can only be scrolled when there are off-screen entries.
1025 //
1028 DrawContext,
1029 &BootPickerX,
1030 &BootPickerY
1031 );
1032 //
1033 // Scroll the boot entry view by one spot.
1034 //
1036 &mBootPicker,
1037 DrawContext,
1038 BootPickerX,
1039 BootPickerY,
1040 -(INT64)(BOOT_ENTRY_WIDTH + BOOT_ENTRY_SPACE) * Context->Scale
1041 );
1042 //
1043 // If the selected entry is pushed off-screen by scrolling, select the
1044 // appropriate neighbour entry.
1045 //
1047 if (mBootPicker.Hdr.Obj.OffsetX + SelectedEntry->Hdr.Obj.OffsetX < 0) {
1048 //
1049 // The internal design ensures a selected entry cannot be off-screen,
1050 // scrolling offsets it by at most one spot.
1051 //
1053 &mBootPicker,
1054 DrawContext,
1057 : 0
1058 );
1059
1061 ASSERT (!(mBootPicker.Hdr.Obj.OffsetX + SelectedEntry->Hdr.Obj.OffsetX < 0));
1062 }
1063
1064 //
1065 // Falthrough to 'hit' case.
1066 //
1067 }
1068
1069 case CommonPtrHit:
1070 {
1071 break;
1072 }
1073 }
1074
1075 return This;
1076}
1077
1079
1080VOID
1082 IN OUT GUI_OBJ *This,
1083 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
1084 IN BOOT_PICKER_GUI_CONTEXT *Context,
1085 IN INT64 BaseX,
1086 IN INT64 BaseY,
1087 IN UINT32 OffsetX,
1088 IN UINT32 OffsetY,
1089 IN UINT32 Width,
1090 IN UINT32 Height,
1091 IN UINT8 Opacity
1092 )
1093{
1094 if (mVersionLabelImage.Buffer != NULL) {
1097 Opacity,
1098 DrawContext,
1099 BaseX,
1100 BaseY,
1101 OffsetX,
1102 OffsetY,
1103 Width,
1104 Height
1105 );
1106 }
1107}
1108
1109VOID
1111 IN OUT GUI_OBJ *This,
1112 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
1113 IN BOOT_PICKER_GUI_CONTEXT *Context,
1114 IN CONST GUI_KEY_EVENT *KeyEvent
1115 )
1116{
1117 GUI_OBJ *FocusChangedObj;
1118 GUI_VOLUME_ENTRY *Entry;
1119
1120 ASSERT (This != NULL);
1121 ASSERT (DrawContext != NULL);
1122
1123 if (KeyEvent->OcKeyCode == OC_INPUT_VOICE_OVER) {
1124 DrawContext->GuiContext->PickerContext->ToggleVoiceOver (
1125 DrawContext->GuiContext->PickerContext,
1126 NULL,
1127 NULL
1128 );
1129 return;
1130 }
1131
1133
1134 FocusChangedObj = InternalFocusKeyHandler (
1135 DrawContext,
1136 Context,
1137 KeyEvent
1138 );
1139 if (FocusChangedObj == &mBootPicker.Hdr.Obj) {
1140 InternalStartAnimateLabel (DrawContext, Entry);
1141 } else if (FocusChangedObj != NULL) {
1142 if (!IsListEmpty (&mBootPickerLabelAnimation.Link)) {
1143 InternalStopAnimateLabel (DrawContext, Entry);
1144 }
1145 }
1146}
1147
1148VOID
1150 IN CONST GUI_OBJ *This,
1151 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
1152 IN BOOLEAN Focus
1153 )
1154{
1155 if (!Focus) {
1157 } else {
1159
1160 DrawContext->GuiContext->AudioPlaybackTimeout = 0;
1161 DrawContext->GuiContext->VoAction = CanopyVoSelectedEntry;
1162 }
1163
1169 );
1170}
1171
1172BOOLEAN
1174 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
1175 IN BOOT_PICKER_GUI_CONTEXT *Context
1176 )
1177{
1178 ASSERT (Context != NULL);
1179
1180 if (Context->ReadyToBoot) {
1182 }
1183
1184 return Context->ReadyToBoot || Context->Refresh;
1185}
1186
1187GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CHILD mBootPickerSelectorBackground = {
1188 {
1189 0, 0, 0, 0, 0xFF,
1191 NULL,
1193 NULL,
1194 0,
1195 NULL
1196 },
1198};
1199
1200GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerSelectorButton = {
1201 {
1202 {
1203 0, 0, 0, 0, 0xFF,
1205 NULL,
1207 NULL,
1208 0,
1209 NULL
1210 },
1212 },
1213 0,
1214 0
1215};
1216
1221
1222GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CHILD mBootPickerSelectorContainer = {
1223 {
1224 0, 0, 0, 0, 0xFF,
1226 NULL,
1228 NULL,
1231 },
1233};
1234
1239
1240GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CHILD mBootPickerContainer = {
1241 {
1242 0, 0, 0, 0, 0xFF,
1244 NULL,
1246 NULL,
1249 },
1250 NULL
1251};
1252
1253GLOBAL_REMOVE_IF_UNREFERENCED GUI_VOLUME_PICKER mBootPicker = {
1254 {
1255 {
1256 0, 0, 0, 0, 0xFF,
1261 0,
1262 NULL
1263 },
1265 },
1266 1
1267};
1268
1269GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerLeftScroll = {
1270 {
1271 {
1272 0, 0, 0, 0, 0xFF,
1274 NULL,
1276 NULL,
1277 0,
1278 NULL
1279 },
1280 NULL
1281 },
1282 0,
1283 0
1284};
1285
1286GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerRightScroll = {
1287 {
1288 {
1289 0, 0, 0, 0, 0xFF,
1291 NULL,
1293 NULL,
1294 0,
1295 NULL
1296 },
1297 NULL
1298 },
1299 0,
1300 0
1301};
1302
1303GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CHILD mBootPickerVersionLabel = {
1304 {
1305 0, 0, 0, 0, 0xFF,
1307 NULL,
1309 NULL,
1310 0,
1311 NULL
1312 },
1313 NULL
1314};
1315
1323
1330
1342
1354
1366
1367STATIC
1368EFI_STATUS
1370 OUT GUI_IMAGE *Destination,
1371 IN CONST GUI_IMAGE *Source
1372 )
1373{
1374 if (Source->Buffer == NULL) {
1375 ASSERT (FALSE);
1376 return EFI_UNSUPPORTED;
1377 }
1378
1379 Destination->Width = Source->Width;
1380 Destination->Height = Source->Height;
1381 Destination->Buffer = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)AllocateCopyPool (
1382 sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * Source->Width * Source->Height,
1383 Source->Buffer
1384 );
1385
1386 if (Destination->Buffer == NULL) {
1387 return EFI_OUT_OF_RESOURCES;
1388 }
1389
1390 return EFI_SUCCESS;
1391}
1392
1393EFI_STATUS
1395 IN OC_PICKER_CONTEXT *Context,
1396 IN BOOT_PICKER_GUI_CONTEXT *GuiContext,
1397 IN OC_BOOT_ENTRY *Entry,
1398 IN UINT8 EntryIndex
1399 )
1400{
1401 EFI_STATUS Status;
1402 GUI_VOLUME_ENTRY *VolumeEntry;
1403 CONST GUI_IMAGE *SuggestedIcon;
1404 CONST GUI_VOLUME_ENTRY *PrevEntry;
1405 UINT32 IconFileSize;
1406 UINT32 IconTypeIndex;
1407 VOID *IconFileData;
1408 BOOLEAN UseVolumeIcon;
1409 BOOLEAN UseFlavourIcon;
1410 BOOLEAN UseDiskLabel;
1411 BOOLEAN UseGenericLabel;
1412 BOOLEAN Result;
1413 CHAR16 *EntryName;
1414 UINTN EntryNameLength;
1415 CHAR8 *FlavourNameStart;
1416 CHAR8 *FlavourNameEnd;
1417
1418 ASSERT (GuiContext != NULL);
1419 ASSERT (Entry != NULL);
1420 ASSERT (EntryIndex < mBootPicker.Hdr.Obj.NumChildren);
1421
1422 DEBUG ((DEBUG_INFO, "OCUI: Console attributes: %d\n", Context->ConsoleAttributes));
1423
1424 UseVolumeIcon = (Context->PickerAttributes & OC_ATTR_USE_VOLUME_ICON) != 0;
1425 UseFlavourIcon = (Context->PickerAttributes & OC_ATTR_USE_FLAVOUR_ICON) != 0;
1426 UseDiskLabel = (Context->PickerAttributes & OC_ATTR_USE_DISK_LABEL_FILE) != 0;
1427 UseGenericLabel = (Context->PickerAttributes & OC_ATTR_USE_GENERIC_LABEL_IMAGE) != 0;
1428
1429 DEBUG ((DEBUG_INFO, "OCUI: UseDiskLabel: %d, UseGenericLabel: %d\n", UseDiskLabel, UseGenericLabel));
1430
1431 VolumeEntry = AllocateZeroPool (sizeof (*VolumeEntry));
1432 if (VolumeEntry == NULL) {
1433 return EFI_OUT_OF_RESOURCES;
1434 }
1435
1436 if (UseDiskLabel) {
1437 Status = Context->GetEntryLabelImage (
1438 Context,
1439 Entry,
1440 GuiContext->Scale,
1441 &IconFileData,
1442 &IconFileSize
1443 );
1444 if (!EFI_ERROR (Status)) {
1445 Status = GuiLabelToImage (
1446 &VolumeEntry->Label,
1447 IconFileData,
1448 IconFileSize,
1449 GuiContext->Scale,
1450 GuiContext->LightBackground
1451 );
1452 }
1453 } else {
1454 Status = EFI_UNSUPPORTED;
1455 }
1456
1457 if (EFI_ERROR (Status) && UseGenericLabel) {
1458 switch (Entry->Type) {
1459 case OC_BOOT_APPLE_OS:
1460 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_APPLE]);
1461 break;
1464 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_APPLE_RECOVERY]);
1465 break;
1467 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_APPLE_TIME_MACHINE]);
1468 break;
1469 case OC_BOOT_WINDOWS:
1470 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_WINDOWS]);
1471 break;
1473 if (OcAsciiStriStr (Entry->Flavour, OC_FLAVOUR_ID_NETWORK_BOOT) != NULL) {
1474 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_NETWORK_BOOT]);
1475 } else {
1476 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_OTHER]);
1477 }
1478
1479 break;
1480 //
1481 // Use flavour-based labels for system entries (e.g. from boot entry protocol).
1482 //
1483 case OC_BOOT_SYSTEM:
1485 if (OcAsciiStriStr (Entry->Flavour, OC_FLAVOUR_ID_RESET_NVRAM) != NULL) {
1486 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_RESET_NVRAM]);
1487 } else if (OcAsciiStriStr (Entry->Flavour, OC_FLAVOUR_ID_TOGGLE_SIP_ENABLED) != NULL) {
1488 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_SIP_IS_ENABLED]);
1489 } else if (OcAsciiStriStr (Entry->Flavour, OC_FLAVOUR_ID_TOGGLE_SIP_DISABLED) != NULL) {
1490 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_SIP_IS_DISABLED]);
1491 } else if (OcAsciiStriStr (Entry->Flavour, OC_FLAVOUR_ID_UEFI_SHELL) != NULL) {
1492 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_SHELL]);
1493 } else if (OcAsciiStriStr (Entry->Flavour, OC_FLAVOUR_ID_FIRMWARE_SETTINGS) != NULL) {
1494 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_FIRMWARE_SETTINGS]);
1495 } else if (Entry->Type == OC_BOOT_EXTERNAL_TOOL) {
1496 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_TOOL]);
1497 } else {
1498 DEBUG ((DEBUG_WARN, "OCUI: System entry flavour %a unsupported for label\n", Entry->Flavour));
1499 Status = EFI_UNSUPPORTED;
1500 }
1501
1502 break;
1503 case OC_BOOT_UNMANAGED:
1504 if (OcAsciiStriStr (Entry->Flavour, OC_FLAVOUR_WINDOWS) != NULL) {
1505 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_WINDOWS]);
1506 } else {
1507 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_OTHER]);
1508 }
1509
1510 break;
1511 case OC_BOOT_UNKNOWN:
1512 Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_GENERIC_HDD]);
1513 break;
1514 default:
1515 DEBUG ((DEBUG_WARN, "OCUI: Entry kind %d unsupported for label\n", Entry->Type));
1516 Status = EFI_UNSUPPORTED;
1517 }
1518 }
1519
1520 if (EFI_ERROR (Status)) {
1521 EntryName = Entry->Name;
1522 EntryNameLength = StrLen (Entry->Name);
1523 if (Entry->IsFolder) {
1524 EntryName = AllocatePool (EntryNameLength * sizeof (CHAR16) + L_STR_SIZE (OC_MENU_DISK_IMAGE));
1525 if (EntryName != NULL) {
1526 CopyMem (EntryName, Entry->Name, EntryNameLength * sizeof (CHAR16));
1528 EntryNameLength += L_STR_LEN (OC_MENU_DISK_IMAGE);
1529 } else {
1530 EntryName = Entry->Name;
1531 }
1532 }
1533
1534 ASSERT (StrLen (EntryName) == EntryNameLength);
1535
1536 Result = GuiGetLabel (
1537 &VolumeEntry->Label,
1538 &GuiContext->FontContext,
1539 EntryName,
1540 EntryNameLength,
1541 GuiContext->LightBackground
1542 );
1543
1544 if (EntryName != Entry->Name) {
1545 FreePool (EntryName);
1546 }
1547
1548 if (!Result) {
1549 DEBUG ((DEBUG_WARN, "OCUI: label failed\n"));
1550 return EFI_UNSUPPORTED;
1551 }
1552 }
1553
1554 VolumeEntry->Context = Entry;
1555
1556 //
1557 // Load volume icons when allowed.
1558 // Do not load volume icons for Time Machine entries unless explicitly enabled.
1559 // This works around Time Machine icon style incompatibilities.
1560 //
1561 if ( UseVolumeIcon
1562 && ( (Entry->Type != OC_BOOT_APPLE_TIME_MACHINE)
1563 || ((Context->PickerAttributes & OC_ATTR_HIDE_THEMED_ICONS) == 0)))
1564 {
1565 Status = Context->GetEntryIcon (Context, Entry, &IconFileData, &IconFileSize);
1566
1567 if (!EFI_ERROR (Status)) {
1568 Status = GuiIcnsToImageIcon (
1569 &VolumeEntry->EntryIcon,
1570 IconFileData,
1571 IconFileSize,
1572 GuiContext->Scale,
1575 FALSE
1576 );
1577 FreePool (IconFileData);
1578 if (!EFI_ERROR (Status)) {
1579 VolumeEntry->CustomIcon = TRUE;
1580 } else {
1581 DEBUG ((DEBUG_INFO, "OCUI: Failed to convert icon - %r\n", Status));
1582 }
1583 }
1584 } else {
1585 Status = EFI_UNSUPPORTED;
1586 }
1587
1588 //
1589 // Flavour system is used internally for icon priorities even when
1590 // user-specified flavours from .contentFlavour are not being read
1591 //
1592 if (EFI_ERROR (Status)) {
1593 ASSERT (Entry->Flavour != NULL);
1594
1595 IconTypeIndex = Entry->IsExternal ? ICON_TYPE_EXTERNAL : ICON_TYPE_BASE;
1596
1597 FlavourNameEnd = Entry->Flavour - 1;
1598 do {
1599 for (FlavourNameStart = ++FlavourNameEnd; *FlavourNameEnd != '\0' && *FlavourNameEnd != ':'; ++FlavourNameEnd) {
1600 }
1601
1602 Status = InternalGetFlavourIcon (
1603 GuiContext,
1604 Context->StorageContext,
1605 FlavourNameStart,
1606 FlavourNameEnd - FlavourNameStart,
1607 IconTypeIndex,
1608 UseFlavourIcon,
1609 &VolumeEntry->EntryIcon,
1610 &VolumeEntry->CustomIcon
1611 );
1612 } while (EFI_ERROR (Status) && *FlavourNameEnd != '\0');
1613
1614 if (EFI_ERROR (Status)) {
1615 SuggestedIcon = NULL;
1616
1617 if (Entry->Type == OC_BOOT_EXTERNAL_OS) {
1618 SuggestedIcon = &GuiContext->Icons[ICON_OTHER][IconTypeIndex];
1619 } else if ((Entry->Type & (OC_BOOT_EXTERNAL_TOOL | OC_BOOT_SYSTEM)) != 0) {
1620 SuggestedIcon = &GuiContext->Icons[ICON_TOOL][IconTypeIndex];
1621 }
1622
1623 if ((SuggestedIcon == NULL) || (SuggestedIcon->Buffer == NULL)) {
1624 SuggestedIcon = &GuiContext->Icons[ICON_GENERIC_HDD][IconTypeIndex];
1625 }
1626
1627 CopyMem (&VolumeEntry->EntryIcon, SuggestedIcon, sizeof (VolumeEntry->EntryIcon));
1628 } else {
1629 DEBUG ((DEBUG_INFO, "OCUI: Using flavour icon, custom: %u\n", VolumeEntry->CustomIcon));
1630 }
1631 }
1632
1633 VolumeEntry->Hdr.Parent = &mBootPicker.Hdr.Obj;
1634 VolumeEntry->Hdr.Obj.Width = BOOT_ENTRY_ICON_DIMENSION * GuiContext->Scale;
1635 VolumeEntry->Hdr.Obj.Height = (BOOT_ENTRY_HEIGHT - BOOT_ENTRY_ICON_SPACE) * GuiContext->Scale;
1636 VolumeEntry->Hdr.Obj.Opacity = 0xFF;
1637 VolumeEntry->Hdr.Obj.Draw = InternalBootPickerEntryDraw;
1639 VolumeEntry->Hdr.Obj.NumChildren = 0;
1640 VolumeEntry->Hdr.Obj.Children = NULL;
1641 if (VolumeEntry->Hdr.Obj.Width > VolumeEntry->Label.Width) {
1642 VolumeEntry->LabelOffset = (INT16)((VolumeEntry->Hdr.Obj.Width - VolumeEntry->Label.Width) / 2);
1643 }
1644
1645 if (EntryIndex > 0) {
1646 PrevEntry = InternalGetVolumeEntry (EntryIndex - 1);
1647 VolumeEntry->Hdr.Obj.OffsetX = PrevEntry->Hdr.Obj.OffsetX + (BOOT_ENTRY_DIMENSION + BOOT_ENTRY_SPACE) * GuiContext->Scale;
1648 } else {
1649 //
1650 // Account for the selector background.
1651 //
1652 VolumeEntry->Hdr.Obj.OffsetX = BOOT_ENTRY_ICON_SPACE * GuiContext->Scale;
1653 }
1654
1655 VolumeEntry->Hdr.Obj.OffsetY = BOOT_ENTRY_ICON_SPACE * GuiContext->Scale;
1656
1657 mBootPicker.Hdr.Obj.Children[EntryIndex] = &VolumeEntry->Hdr;
1658 VolumeEntry->Index = EntryIndex;
1659 mBootPicker.Hdr.Obj.Width += (BOOT_ENTRY_WIDTH + BOOT_ENTRY_SPACE) * GuiContext->Scale;
1660 mBootPicker.Hdr.Obj.OffsetX -= (BOOT_ENTRY_WIDTH + BOOT_ENTRY_SPACE) * GuiContext->Scale / 2;
1661
1662 return EFI_SUCCESS;
1663}
1664
1665VOID
1667 IN GUI_VOLUME_ENTRY *Entry
1668 )
1669{
1670 ASSERT (Entry != NULL);
1671 ASSERT (Entry->Label.Buffer != NULL);
1672
1673 if (Entry->CustomIcon) {
1674 FreePool (Entry->EntryIcon.Buffer);
1675 }
1676
1677 FreePool (Entry->Label.Buffer);
1678 FreePool (Entry);
1679}
1680
1682
1683VOID
1685 IN GUI_INTERPOL_TYPE Type,
1686 IN UINT64 StartTime,
1687 IN UINT64 Duration
1688 )
1689{
1691 mBpAnimInfoImageList.StartTime = StartTime;
1692 mBpAnimInfoImageList.Duration = Duration;
1695}
1696
1697BOOLEAN
1699 IN BOOT_PICKER_GUI_CONTEXT *Context,
1700 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
1701 IN UINT64 CurrentTime
1702 )
1703{
1704 #if 0
1705 GUI_VOLUME_ENTRY *Entry;
1706 CONST GUI_IMAGE *EntryIcon;
1707
1708 Entry = BASE_CR (&mBootPicker.Hdr.Obj, GUI_VOLUME_ENTRY, Hdr.Obj);
1709 EntryIcon = &Entry->EntryIcon;
1710
1711 mBootPickerImageIndex++;
1712 mBootPickerImageIndex = (UINT8)GuiGetInterpolatedValue (&mBpAnimInfoImageList, CurrentTime);
1713 Entry->EntryIcon = &((GUI_IMAGE *)Context)[mBootPickerImageIndex];
1714 GuiRedrawObject (
1716 DrawContext,
1719 );
1720
1721 if (mBootPickerImageIndex == mBpAnimInfoImageList.EndValue) {
1722 return TRUE;
1723 }
1724
1725 #endif
1726 return FALSE;
1727}
1728
1729STATIC UINT32 mPrevSine;
1730
1733 0,
1734 25,
1735 0,
1736 0,
1737 0
1738};
1739
1740VOID
1742 IN CONST GUI_DRAWING_CONTEXT *DrawContext
1743 )
1744{
1745 mBpAnimInfoSinMove.EndValue = 35 * DrawContext->Scale;
1746 //
1747 // FIXME: This assumes that only relative changes of X are performed on
1748 // mBootPickerContainer between animation initialisation and start.
1749 //
1750 mBootPickerContainer.Obj.OffsetX += 35 * DrawContext->Scale;
1751
1752 mPrevSine = 0;
1753}
1754
1755BOOLEAN
1757 IN BOOT_PICKER_GUI_CONTEXT *Context,
1758 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
1759 IN UINT64 CurrentTime
1760 )
1761{
1762 UINT8 Opacity;
1763 UINT32 InterpolVal;
1764 UINT32 DeltaSine;
1765
1766 ASSERT (DrawContext != NULL);
1767
1768 Opacity = (UINT8)GuiGetInterpolatedValue (
1770 CurrentTime
1771 );
1773 //
1774 // Animate the scroll buttons based on their active state.
1775 //
1776 if (mBootPicker.Hdr.Obj.OffsetX < 0) {
1778 }
1779
1782 }
1783
1784 //
1785 // If PasswordView already faded-in the action buttons, skip them.
1786 //
1789 //
1790 // The view is constructed such that the action buttons are always fully
1791 // visible.
1792 //
1802 );
1803 }
1804
1805 InterpolVal = GuiGetInterpolatedValue (&mBpAnimInfoSinMove, CurrentTime);
1806 DeltaSine = InterpolVal - mPrevSine;
1807 mBootPickerContainer.Obj.OffsetX -= DeltaSine;
1808 mPrevSine = InterpolVal;
1809 //
1810 // Draw the full dimension of the inner container to implicitly cover the
1811 // scroll buttons with the off-screen entries.
1812 //
1814 DrawContext,
1817 mBootPicker.Hdr.Obj.Width + DeltaSine,
1819 );
1820
1823}
1824
1827 0,
1828 125,
1829 0xFF,
1830 0x50,
1831 0
1832};
1833
1836 0,
1837 125,
1838 0x50,
1839 0xFF,
1840 20
1841};
1842
1843BOOLEAN
1845 IN BOOT_PICKER_GUI_CONTEXT *Context,
1846 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
1847 IN UINT64 CurrentTime
1848 )
1849{
1852
1853 GUI_INTERPOLATION *Temp;
1854
1855 if (DrawContext->TimeOutSeconds > 0) {
1857 CurInterpol,
1858 CurrentTime
1859 );
1860 } else {
1862 }
1863
1864 //
1865 // The view is constructed such that the action buttons are always fully
1866 // visible.
1867 //
1873 );
1874
1875 if (DrawContext->TimeOutSeconds == 0) {
1876 return TRUE;
1877 }
1878
1879 if (CurrentTime - CurInterpol->StartTime >= CurInterpol->Duration + CurInterpol->HoldTime) {
1880 Temp = CurInterpol;
1881 CurInterpol = NextInterpol;
1882 NextInterpol = Temp;
1883 CurInterpol->StartTime = CurrentTime + 1;
1884 }
1885
1886 return FALSE;
1887}
1888
1890 { NULL, NULL },
1891 NULL,
1893};
1894
1895EFI_STATUS
1897 OUT GUI_DRAWING_CONTEXT *DrawContext,
1898 IN BOOT_PICKER_GUI_CONTEXT *GuiContext,
1899 IN GUI_CURSOR_GET_IMAGE GetCursorImage,
1900 IN UINT8 NumBootEntries
1901 )
1902{
1903 CONST GUI_IMAGE *SelectorBackgroundImage;
1904 CONST GUI_IMAGE *SelectorButtonImage;
1905 UINT32 ContainerMaxWidth;
1906 UINT32 ContainerWidthDelta;
1907 UINTN DestLen;
1908 CHAR16 *UString;
1909 BOOLEAN Result;
1910
1911 ASSERT (DrawContext != NULL);
1912 ASSERT (GuiContext != NULL);
1913 ASSERT (GetCursorImage != NULL);
1914
1916
1918 DrawContext,
1919 GuiContext,
1920 (GuiContext->PickerContext->PickerAttributes & OC_ATTR_USE_MINIMAL_UI) == 0
1921 ? ((GuiContext->PickerContext->PickerAttributes & OC_ATTR_USE_REVERSED_UI) == 0
1924 )
1926 );
1927
1929 (INT64)DrawContext->Screen.Width - DrawContext->GuiContext->Background.Width,
1930 2,
1931 NULL
1932 );
1934 (INT64)DrawContext->Screen.Height - DrawContext->GuiContext->Background.Height,
1935 2,
1936 NULL
1937 );
1938
1939 SelectorBackgroundImage = &GuiContext->Icons[ICON_SELECTED][ICON_TYPE_BASE];
1940 SelectorButtonImage = &GuiContext->Icons[ICON_SELECTOR][ICON_TYPE_BASE];
1941
1944 mBootPickerSelectorBackground.Obj.Width = SelectorBackgroundImage->Width;
1945 mBootPickerSelectorBackground.Obj.Height = SelectorBackgroundImage->Height;
1946
1947 ASSERT (SelectorBackgroundImage->Width >= SelectorButtonImage->Width);
1948 mBootPickerSelectorButton.Hdr.Obj.OffsetX = (SelectorBackgroundImage->Width - SelectorButtonImage->Width) / 2;
1949 mBootPickerSelectorButton.Hdr.Obj.OffsetY = SelectorBackgroundImage->Height + BOOT_SELECTOR_BUTTON_SPACE * DrawContext->Scale;
1950 mBootPickerSelectorButton.Hdr.Obj.Width = SelectorButtonImage->Width;
1951 mBootPickerSelectorButton.Hdr.Obj.Height = SelectorButtonImage->Height;
1954
1957 mBootPickerSelectorContainer.Obj.Width = SelectorBackgroundImage->Width;
1959
1963 mBootPickerLeftScroll.Hdr.Obj.OffsetY = (DrawContext->Screen.Height - mBootPickerLeftScroll.Hdr.Obj.Height) / 2;
1966
1970 mBootPickerRightScroll.Hdr.Obj.OffsetY = (DrawContext->Screen.Height - mBootPickerRightScroll.Hdr.Obj.Height) / 2;
1973 //
1974 // The boot entry container must precisely show a set of boot entries, i.e.
1975 // there may not be partial entries or extra padding.
1976 //
1977 ContainerMaxWidth = DrawContext->Screen.Width - mBootPickerLeftScroll.Hdr.Obj.Width - 2 * BOOT_SCROLL_BUTTON_SPACE - mBootPickerRightScroll.Hdr.Obj.Width - 2 * BOOT_SCROLL_BUTTON_SPACE;
1978 ContainerWidthDelta = (ContainerMaxWidth + BOOT_ENTRY_SPACE * GuiContext->Scale) % ((BOOT_ENTRY_WIDTH + BOOT_ENTRY_SPACE) * GuiContext->Scale);
1979
1981 mBootPickerContainer.Obj.Width = ContainerMaxWidth - ContainerWidthDelta;
1982 mBootPickerContainer.Obj.OffsetX = (DrawContext->Screen.Width - mBootPickerContainer.Obj.Width) / 2;
1983 //
1984 // Center the icons and labels excluding the selector images vertically.
1985 //
1986 ASSERT ((DrawContext->Screen.Height - (BOOT_ENTRY_HEIGHT - BOOT_ENTRY_ICON_SPACE) * GuiContext->Scale) / 2 - (BOOT_ENTRY_ICON_SPACE * GuiContext->Scale) == (DrawContext->Screen.Height - (BOOT_ENTRY_HEIGHT + BOOT_ENTRY_ICON_SPACE) * GuiContext->Scale) / 2);
1987 mBootPickerContainer.Obj.OffsetY = (DrawContext->Screen.Height - (BOOT_ENTRY_HEIGHT + BOOT_ENTRY_ICON_SPACE) * GuiContext->Scale) / 2;
1988
1989 mBootPicker.Hdr.Obj.Height = BOOT_SELECTOR_HEIGHT * GuiContext->Scale;
1990 //
1991 // Adding an entry will wrap around Width such that the first entry has no
1992 // padding.
1993 //
1994 mBootPicker.Hdr.Obj.Width = 0U - (UINT32)(BOOT_ENTRY_SPACE * GuiContext->Scale);
1995 //
1996 // Adding an entry will also shift OffsetX considering the added boot entry
1997 // space. This is not needed for the first, so initialise accordingly.
1998 //
1999 mBootPicker.Hdr.Obj.OffsetX = mBootPickerContainer.Obj.Width / 2 + (UINT32)(BOOT_ENTRY_SPACE * GuiContext->Scale) / 2;
2001
2003
2004 mBootPicker.Hdr.Obj.Children = AllocateZeroPool (NumBootEntries * sizeof (*mBootPicker.Hdr.Obj.Children));
2005 if (mBootPicker.Hdr.Obj.Children == NULL) {
2006 return EFI_OUT_OF_RESOURCES;
2007 }
2008
2009 mBootPicker.Hdr.Obj.NumChildren = NumBootEntries;
2010
2011 if (GuiContext->PickerContext->TitleSuffix == NULL) {
2013
2018 } else {
2019 DestLen = AsciiStrLen (GuiContext->PickerContext->TitleSuffix);
2020 UString = AsciiStrCopyToUnicode (GuiContext->PickerContext->TitleSuffix, DestLen);
2021
2022 Result = GuiGetLabel (
2024 &GuiContext->FontContext,
2025 UString,
2026 DestLen,
2027 GuiContext->LightBackground
2028 );
2029
2030 FreePool (UString);
2031
2032 if (!Result) {
2033 DEBUG ((DEBUG_WARN, "OCUI: version label failed\n"));
2034 return Result;
2035 }
2036
2039 mBootPickerVersionLabel.Obj.OffsetX = DrawContext->Screen.Width - ((3 * mBootPickerVersionLabel.Obj.Width) / 2);
2040 mBootPickerVersionLabel.Obj.OffsetY = DrawContext->Screen.Height - ((5 * mBootPickerVersionLabel.Obj.Height) / 2);
2041 }
2042
2043 // TODO: animations should be tied to UI objects, not global
2044 // Each object has its own list of animations.
2045 // How to animate addition of one or more boot entries?
2046 // 1. MOVE:
2047 // - Calculate the delta by which each entry moves to the left or to the right.
2048 // ∆i = (N(added after) - N(added before))
2049 // Conditions for delta function:
2050 //
2051
2052 InitializeListHead (&mBootPickerLabelAnimation.Link);
2053
2054 if (GuiContext->UseMenuEaseIn) {
2055 InitBpAnimIntro (DrawContext);
2056 InsertHeadList (&DrawContext->Animations, &mBootPickerIntroAnimation.Link);
2057 //
2058 // Fade-in picker, scroll buttons, and action buttons.
2059 //
2063 } else {
2064 //
2065 // The late code assumes the scroll buttons are visible by default.
2066 //
2069 //
2070 // Unhide action buttons immediately if they are not animated.
2071 //
2073 }
2074
2075 if ( !GuiContext->PickerContext->PickerAudioAssist
2076 && (DrawContext->TimeOutSeconds > 0))
2077 {
2078 STATIC GUI_ANIMATION PickerAnim2;
2079 PickerAnim2.Context = NULL;
2080 PickerAnim2.Animate = InternalBootPickerAnimateTimeout;
2081 InsertHeadList (&DrawContext->Animations, &PickerAnim2.Link);
2082 }
2083
2084 /*
2085 InitBpAnimImageList(GuiInterpolTypeLinear, 25, 25);
2086 STATIC GUI_ANIMATION PoofAnim;
2087 PoofAnim.Context = GuiContext->Poof;
2088 PoofAnim.Animate = InternalBootPickerAnimateImageList;
2089 InsertHeadList(&DrawContext->Animations, &PoofAnim.Link);
2090 */
2091
2092 return EFI_SUCCESS;
2093}
2094
2095VOID
2097 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
2098 IN BOOT_PICKER_GUI_CONTEXT *GuiContext,
2099 IN UINT8 DefaultIndex
2100 )
2101{
2102 CONST GUI_VOLUME_ENTRY *BootEntry;
2103
2104 ASSERT (DefaultIndex < mBootPicker.Hdr.Obj.NumChildren);
2105
2106 mBootPicker.SelectedIndex = DefaultIndex;
2107
2108 //
2109 // If more entries than screen width, firstly align left-most entry
2110 // then scroll from there as needed to bring default entry on screen
2111 //
2112 if (mBootPicker.Hdr.Obj.OffsetX < 0) {
2115 }
2116
2117 //
2118 // If the scroll buttons are hidden, the intro animation will update them
2119 // implicitly.
2120 //
2121 if (mBootPickerLeftScroll.Hdr.Obj.Opacity == 0xFF) {
2123 }
2124
2125 InternalBootPickerSelectEntry (&mBootPicker, NULL, DefaultIndex);
2126 BootEntry = InternalGetVolumeEntry (DefaultIndex);
2127 InternalStartAnimateLabel (DrawContext, BootEntry);
2128 GuiContext->BootEntry = BootEntry->Context;
2129}
2130
2131VOID
2133 IN OUT GUI_DRAWING_CONTEXT *DrawContext,
2134 IN OUT BOOT_PICKER_GUI_CONTEXT *GuiContext
2135 )
2136{
2137 UINT32 Index;
2138
2139 if (mVersionLabelImage.Buffer != NULL) {
2140 FreePool (mVersionLabelImage.Buffer);
2142 }
2143
2144 for (Index = 0; Index < mBootPicker.Hdr.Obj.NumChildren; ++Index) {
2146 }
2147
2148 if (mBootPicker.Hdr.Obj.Children != NULL) {
2149 FreePool (mBootPicker.Hdr.Obj.Children);
2150 }
2151
2153
2154 GuiViewDeinitialize (DrawContext, GuiContext);
2155}
#define ARRAY_SIZE(Array)
Definition AppleMacEfi.h:34
SMBIOS_STRUCTURE Hdr
Definition AppleSmBios.h:51
BOOLEAN GuiGetLabel(OUT GUI_IMAGE *LabelImage, IN CONST GUI_FONT_CONTEXT *Context, IN CONST CHAR16 *String, IN UINTN StringLen, IN BOOLEAN Inverted)
Definition BitmapFont.c:609
#define RGB_APPLY_OPACITY(Rgba, Opacity)
Definition Blending.h:11
FILEPATH_DEVICE_PATH EntryName
VOID BootPickerViewLateInitialize(IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *GuiContext, IN UINT8 DefaultIndex)
GUI_OBJ * InternalBootPickerSelectorPtrEvent(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN INT64 BaseX, IN INT64 BaseY, IN CONST GUI_PTR_EVENT *Event)
Definition BootPicker.c:854
STATIC VOID InternalBootPickerEntryDraw(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN INT64 BaseX, IN INT64 BaseY, IN UINT32 OffsetX, IN UINT32 OffsetY, IN UINT32 Width, IN UINT32 Height, IN UINT8 Opacity)
Definition BootPicker.c:508
BOOLEAN InternalBootPickerAnimateIntro(IN BOOT_PICKER_GUI_CONTEXT *Context, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN UINT64 CurrentTime)
VOID InternalStartAnimateLabel(IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN CONST GUI_VOLUME_ENTRY *Entry)
Definition BootPicker.c:151
#define BOOT_LABEL_SHADOW_WIDTH
Definition BootPicker.c:36
EFI_STATUS BootPickerEntriesSet(IN OC_PICKER_CONTEXT *Context, IN BOOT_PICKER_GUI_CONTEXT *GuiContext, IN OC_BOOT_ENTRY *Entry, IN UINT8 EntryIndex)
BOOLEAN InternalBootPickerExitLoop(IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context)
STATIC GUI_OBJ_CHILD * mBootPickerSelectorContainerChildren[]
GLOBAL_REMOVE_IF_UNREFERENCED GUI_VIEW_CONTEXT mBootPickerViewContextMinimal
INT64 mBackgroundImageOffsetY
Definition Common.c:20
BOOLEAN InternalBootPickerAnimateLabel(IN BOOT_PICKER_GUI_CONTEXT *Context, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN UINT64 CurrentTime)
Definition BootPicker.c:102
#define BOOT_LABEL_WRAPAROUND_PADDING
Definition BootPicker.c:33
GUI_OBJ * InternalBootPickerLeftScrollPtrEvent(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN INT64 BaseX, IN INT64 BaseY, IN CONST GUI_PTR_EVENT *Event)
Definition BootPicker.c:897
VOID InternalBootPickerScroll(IN OUT GUI_VOLUME_PICKER *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN INT64 BaseX, IN INT64 BaseY, IN INT64 ScrollOffset)
Definition BootPicker.c:284
STATIC GUI_INTERPOLATION mBpAnimInfoImageList
STATIC GUI_OBJ * mBootPickerFocusListReversed[]
Definition BootPicker.c:63
VOID InternalBootPickerViewKeyEvent(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN CONST GUI_KEY_EVENT *KeyEvent)
STATIC GUI_ANIMATION mBootPickerIntroAnimation
STATIC GUI_VOLUME_ENTRY * InternalGetVolumeEntry(IN UINT32 Index)
Definition BootPicker.c:75
STATIC GUI_OBJ * mBootPickerFocusListMinimal[]
Definition BootPicker.c:69
VOID BootPickerViewDeinitialize(IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN OUT BOOT_PICKER_GUI_CONTEXT *GuiContext)
VOID InternalBootPickerFocus(IN CONST GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOLEAN Focus)
STATIC VOID InternalRedrawVolumeLabel(IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN CONST GUI_VOLUME_ENTRY *Entry)
Definition BootPicker.c:87
#define BOOT_LABEL_SCROLLING_HOLD_TIME
Definition BootPicker.c:34
STATIC EFI_STATUS CopyLabel(OUT GUI_IMAGE *Destination, IN CONST GUI_IMAGE *Source)
GUI_OBJ_CLICKABLE mBootPickerLeftScroll
VOID InitBpAnimImageList(IN GUI_INTERPOL_TYPE Type, IN UINT64 StartTime, IN UINT64 Duration)
VOID InternalBootPickerEntryDestruct(IN GUI_VOLUME_ENTRY *Entry)
EFI_STATUS BootPickerViewInitialize(OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *GuiContext, IN GUI_CURSOR_GET_IMAGE GetCursorImage, IN UINT8 NumBootEntries)
STATIC GUI_OBJ_CHILD * mBootPickerViewChildren[]
GUI_VOLUME_PICKER mBootPicker
VOID InternalBootPickerChangeEntry(IN OUT GUI_VOLUME_PICKER *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN INT64 BaseX, IN INT64 BaseY, IN UINT32 NewIndex)
Definition BootPicker.c:336
BOOLEAN InternalBootPickerAnimateImageList(IN BOOT_PICKER_GUI_CONTEXT *Context, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN UINT64 CurrentTime)
GLOBAL_REMOVE_IF_UNREFERENCED GUI_VIEW_CONTEXT mBootPickerViewContextReversed
GUI_OBJ_CLICKABLE mBootPickerSelectorButton
STATIC GUI_OBJ * mBootPickerFocusList[]
Definition BootPicker.c:57
GUI_OBJ_CHILD mBootPickerSelectorContainer
INT64 mBackgroundImageOffsetX
Definition Common.c:19
GUI_KEY_CONTEXT * mKeyContext
Definition OpenCanopy.c:45
STATIC GUI_INTERPOLATION mBootPickerTimeoutOpacityInterpolUp
GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CHILD mBootPickerVersionLabel
STATIC UINT32 mBootPickerLabelScrollHoldTime
Definition BootPicker.c:55
STATIC GUI_ANIMATION mBootPickerLabelAnimation
Definition BootPicker.c:144
VOID InternalBootPickerSelectEntry(IN OUT GUI_VOLUME_PICKER *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN UINT32 NewIndex)
Definition BootPicker.c:192
BOOLEAN InternalBootPickerAnimateTimeout(IN BOOT_PICKER_GUI_CONTEXT *Context, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN UINT64 CurrentTime)
STATIC GUI_OBJ * InternalBootPickerEntryPtrEvent(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN INT64 BaseX, IN INT64 BaseY, IN CONST GUI_PTR_EVENT *Event)
Definition BootPicker.c:750
VOID InitBpAnimIntro(IN CONST GUI_DRAWING_CONTEXT *DrawContext)
GUI_OBJ_CLICKABLE mBootPickerRightScroll
VOID InternalBootPickerKeyEvent(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *GuiContext, IN CONST GUI_KEY_EVENT *KeyEvent)
Definition BootPicker.c:388
STATIC GUI_IMAGE mVersionLabelImage
STATIC GUI_INTERPOLATION mBpAnimInfoSinMove
VOID InternalStopAnimateLabel(IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN OUT GUI_VOLUME_ENTRY *Entry)
Definition BootPicker.c:171
GLOBAL_REMOVE_IF_UNREFERENCED GUI_VIEW_CONTEXT mBootPickerViewContext
VOID InternalBootPickerSelectorBackgroundDraw(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN INT64 BaseX, IN INT64 BaseY, IN UINT32 OffsetX, IN UINT32 OffsetY, IN UINT32 Width, IN UINT32 Height, IN UINT8 Opacity)
Definition BootPicker.c:812
GUI_OBJ * InternalBootPickerRightScrollPtrEvent(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN INT64 BaseX, IN INT64 BaseY, IN CONST GUI_PTR_EVENT *Event)
Definition BootPicker.c:988
CONST GUI_IMAGE mBackgroundImage
STATIC GUI_OBJ_CHILD * mBootPickerContainerChildren[]
STATIC GUI_INTERPOLATION mBootPickerTimeoutOpacityInterpolDown
GUI_OBJ_CHILD mBootPickerSelectorBackground
GUI_OBJ_CHILD mBootPickerContainer
VOID InternalUpdateScrollButtons(VOID)
Definition BootPicker.c:266
STATIC UINT32 mPrevSine
STATIC GUI_OBJ_CHILD * mBootPickerViewChildrenMinimal[]
INT64 InternelBootPickerScrollSelected(VOID)
Definition BootPicker.c:230
VOID InternalVersionLabelDraw(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN INT64 BaseX, IN INT64 BaseY, IN UINT32 OffsetX, IN UINT32 OffsetY, IN UINT32 Width, IN UINT32 Height, IN UINT8 Opacity)
GUI_OBJ * InternalCommonViewPtrEvent(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN INT64 BaseX, IN INT64 BaseY, IN CONST GUI_PTR_EVENT *Event)
Definition Common.c:249
GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mCommonShutDown
Definition Common.c:626
VOID CommonViewInitialize(IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *GuiContext, IN CONST GUI_VIEW_CONTEXT *ViewContext)
Definition Common.c:657
VOID InternalCommonViewDraw(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN INT64 BaseX, IN INT64 BaseY, IN UINT32 OffsetX, IN UINT32 OffsetY, IN UINT32 Width, IN UINT32 Height, IN UINT8 Opacity)
Definition Common.c:189
VOID InternalCommonSimpleButtonDraw(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN INT64 BaseX, IN INT64 BaseY, IN UINT32 OffsetX, IN UINT32 OffsetY, IN UINT32 Width, IN UINT32 Height, IN UINT8 Opacity)
Definition Common.c:263
GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mCommonRestart
Definition Common.c:609
GLOBAL_REMOVE_IF_UNREFERENCED GUI_INTERPOLATION mCommonIntroOpacityInterpol
Definition Common.c:22
VOID GuiDrawChildImage(IN CONST GUI_IMAGE *Image, IN UINT8 Opacity, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN INT64 ParentBaseX, IN INT64 ParentBaseY, IN INT64 ChildBaseX, IN INT64 ChildBaseY, IN UINT32 OffsetX, IN UINT32 OffsetY, IN UINT32 Width, IN UINT32 Height)
Definition Common.c:37
UINT8 InternalCommonSimpleButtonPtrEvent(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN INT64 BaseX, IN INT64 BaseY, IN CONST GUI_PTR_EVENT *Event)
Definition Common.c:309
BOOLEAN GuiClickableIsHit(IN CONST GUI_IMAGE *Image, IN INT64 OffsetX, IN INT64 OffsetY)
Definition Common.c:90
GUI_OBJ * InternalFocusKeyHandler(IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN CONST GUI_KEY_EVENT *KeyEvent)
Definition Common.c:109
GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CHILD mCommonActionButtonsContainer
Definition Common.c:643
@ CommonPtrHit
Definition Common.h:89
@ CommonPtrAction
Definition Common.h:88
@ CommonPtrNotHit
Definition Common.h:87
CONST GUI_IMAGE * InternalGetCursorImage(IN BOOT_PICKER_GUI_CONTEXT *Context)
Definition GuiApp.c:663
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
#define BOOT_ENTRY_WIDTH
Definition GuiApp.h:37
#define BOOT_SELECTOR_HEIGHT
Definition GuiApp.h:35
#define BOOT_ENTRY_DIMENSION
Definition GuiApp.h:21
#define BOOT_ENTRY_LABEL_HEIGHT
Definition GuiApp.h:25
@ LABEL_RESET_NVRAM
Definition GuiApp.h:65
@ LABEL_SHELL
Definition GuiApp.h:66
@ LABEL_APPLE
Definition GuiApp.h:59
@ 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
@ ICON_TYPE_BASE
Definition GuiApp.h:103
@ ICON_TYPE_EXTERNAL
Definition GuiApp.h:104
#define BOOT_SELECTOR_BUTTON_SPACE
Definition GuiApp.h:34
@ CanopyVoSelectedEntry
Definition GuiApp.h:110
#define BOOT_ENTRY_ICON_SPACE
Definition GuiApp.h:23
@ ICON_SET_DEFAULT
Definition GuiApp.h:78
@ ICON_TOOL
Definition GuiApp.h:96
@ ICON_OTHER
Definition GuiApp.h:95
@ ICON_SELECTOR
Definition GuiApp.h:77
@ ICON_GENERIC_HDD
Definition GuiApp.h:89
@ ICON_LEFT
Definition GuiApp.h:79
@ ICON_RIGHT
Definition GuiApp.h:80
@ ICON_SELECTED
Definition GuiApp.h:76
#define BOOT_ENTRY_ICON_DIMENSION
Definition GuiApp.h:22
#define BOOT_ENTRY_SPACE
Definition GuiApp.h:28
#define BOOT_ENTRY_HEIGHT
Definition GuiApp.h:38
#define BOOT_SCROLL_BUTTON_SPACE
Definition GuiApp.h:41
#define BOOT_SCROLL_BUTTON_DIMENSION
Definition GuiApp.h:40
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
#define OC_VOICE_OVER_AUDIO_FILE_RELOADING
Definition OcAudio.h:64
#define OC_VOICE_OVER_AUDIO_FILE_SHOW_AUXILIARY
Definition OcAudio.h:68
#define OC_VOICE_OVER_AUDIO_BASE_TYPE_OPEN_CORE
Definition OcAudio.h:38
STATIC_ASSERT(BYTES_PER_PIXEL==sizeof(UINT32), "Non 4-byte pixels are unsupported!")
#define OC_ATTR_USE_GENERIC_LABEL_IMAGE
#define OC_PICKER_KEYS_FOR_PICKER
#define OC_FLAVOUR_WINDOWS
#define OC_ATTR_USE_REVERSED_UI
#define OC_FLAVOUR_ID_RESET_NVRAM
#define OC_MODIFIERS_SET_DEFAULT
#define OC_ATTR_USE_DISK_LABEL_FILE
#define OC_FLAVOUR_ID_TOGGLE_SIP_DISABLED
#define OC_BOOT_APPLE_TIME_MACHINE
#define OC_INPUT_LEFT
Move left.
#define OC_ATTR_USE_VOLUME_ICON
#define OC_BOOT_EXTERNAL_TOOL
#define OC_BOOT_EXTERNAL_OS
#define OC_VOICE_OVER_IDLE_TIMEOUT_MS
Experimental, less is problematic.
#define OC_ATTR_USE_FLAVOUR_ICON
#define OC_INPUT_CONTINUE
Continue (press enter)
#define OC_INPUT_ABORTED
Esc or 0.
#define OC_BOOT_APPLE_RECOVERY
#define OC_ATTR_USE_MINIMAL_UI
#define OC_INPUT_MORE
Show more entries (press space)
#define OC_BOOT_WINDOWS
#define OC_INPUT_RIGHT
Move right.
#define OC_FLAVOUR_ID_FIRMWARE_SETTINGS
#define OC_FLAVOUR_ID_NETWORK_BOOT
#define OC_BOOT_APPLE_OS
#define OC_BOOT_UNKNOWN
#define OC_BOOT_APPLE_FW_UPDATE
#define OC_ATTR_HIDE_THEMED_ICONS
#define OC_INPUT_VOICE_OVER
Toggle VoiceOver (press CMD+F5)
#define OC_BOOT_UNMANAGED
#define OC_FLAVOUR_ID_TOGGLE_SIP_ENABLED
#define OC_FLAVOUR_ID_UEFI_SHELL
#define OC_BOOT_SYSTEM
#define OC_MENU_DISK_IMAGE
#define ASSERT_EQUALS(Expression, ExpectedValue)
Definition OcMiscLib.h:259
#define L_STR_LEN(String)
Definition OcStringLib.h:26
#define L_STR_SIZE(String)
Definition OcStringLib.h:35
CHAR8 *EFIAPI OcAsciiStriStr(IN CONST CHAR8 *String, IN CONST CHAR8 *SearchString)
Definition OcAsciiLib.c:327
CHAR16 * AsciiStrCopyToUnicode(IN CONST CHAR8 *String, IN UINTN Length)
Definition OcAsciiLib.c:119
VOID GuiDrawToBuffer(IN CONST GUI_IMAGE *Image, IN UINT8 Opacity, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN INT64 BaseX, IN INT64 BaseY, IN UINT32 OffsetX, IN UINT32 OffsetY, IN UINT32 Width, IN UINT32 Height)
Definition OpenCanopy.c:354
VOID GuiRequestDraw(IN UINT32 PosX, IN UINT32 PosY, IN UINT32 Width, IN UINT32 Height)
Definition OpenCanopy.c:475
VOID GuiRequestDrawCrop(IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN INT64 X, IN INT64 Y, IN UINT32 Width, IN UINT32 Height)
Definition OpenCanopy.c:570
VOID GuiViewDeinitialize(IN OUT GUI_DRAWING_CONTEXT *DrawContext, OUT BOOT_PICKER_GUI_CONTEXT *GuiContext)
Definition OpenCanopy.c:977
GUI_OBJ * GuiObjDelegatePtrEvent(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN INT64 BaseX, IN INT64 BaseY, IN CONST GUI_PTR_EVENT *Event)
Definition OpenCanopy.c:226
UINT32 GuiGetInterpolatedValue(IN CONST GUI_INTERPOLATION *Interpol, IN UINT64 CurrentTime)
VOID GuiGetBaseCoords(IN GUI_OBJ *This, IN GUI_DRAWING_CONTEXT *DrawContext, OUT INT64 *BaseX, OUT INT64 *BaseY)
Definition OpenCanopy.c:996
VOID GuiObjDrawDelegate(IN OUT GUI_OBJ *This, IN OUT GUI_DRAWING_CONTEXT *DrawContext, IN BOOT_PICKER_GUI_CONTEXT *Context, IN INT64 BaseX, IN INT64 BaseY, IN UINT32 OffsetX, IN UINT32 OffsetY, IN UINT32 Width, IN UINT32 Height, IN UINT8 Opacity)
Definition OpenCanopy.c:137
@ GuiPointerPrimaryUp
Definition OpenCanopy.h:23
@ GuiPointerPrimaryDown
Definition OpenCanopy.h:22
@ GuiPointerPrimaryDoubleClick
Definition OpenCanopy.h:24
GUI_INTERPOL_TYPE
Definition OpenCanopy.h:347
@ GuiInterpolTypeLinear
Definition OpenCanopy.h:348
@ GuiInterpolTypeSmooth
Definition OpenCanopy.h:349
CONST GUI_IMAGE *(* GUI_CURSOR_GET_IMAGE)(IN BOOT_PICKER_GUI_CONTEXT *Context)
Definition OpenCanopy.h:136
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
INT64 EFIAPI DivS64x64Remainder(IN INT64 Dividend, IN INT64 Divisor, OUT INT64 *Remainder OPTIONAL)
Definition UserMath.c:42
#define ASSERT(x)
Definition coder.h:55
#define MIN(a, b)
Definition deflate.c:1673
LIST_ENTRY Link
Definition OpenCanopy.h:100
UINT32 Height
Definition OpenCanopy.h:128
EFI_GRAPHICS_OUTPUT_BLT_PIXEL * Buffer
Definition OpenCanopy.h:129
UINT32 Width
Definition OpenCanopy.h:127
GUI_INTERPOL_TYPE Type
Definition OpenCanopy.h:353
OC_PICKER_KEY_MAP KeyFilter
Definition OpenCanopy.h:44
GUI_OBJ * Parent
Definition OpenCanopy.h:123
UINT8 ImageState
Definition Common.h:9
GUI_OBJ_CHILD Hdr
Definition Common.h:7
UINT8 ImageId
Definition Common.h:8
GUI_OBJ_DRAW Draw
Definition OpenCanopy.h:113
INT64 OffsetX
Definition OpenCanopy.h:108
UINT32 NumChildren
Definition OpenCanopy.h:117
UINT32 Height
Definition OpenCanopy.h:111
UINT8 Opacity
Definition OpenCanopy.h:112
INT64 OffsetY
Definition OpenCanopy.h:109
GUI_OBJ_PTR_EVENT PtrEvent
Definition OpenCanopy.h:115
GUI_OBJ_CHILD ** Children
Definition OpenCanopy.h:118
UINT32 Width
Definition OpenCanopy.h:110
GUI_OBJ_CHILD Hdr
Definition BootPicker.h:14
GUI_IMAGE Label
Definition BootPicker.h:16
GUI_IMAGE EntryIcon
Definition BootPicker.h:15
BOOLEAN ShowLeftShadow
Definition BootPicker.h:20
BOOLEAN CustomIcon
Definition BootPicker.h:18
OC_BOOT_ENTRY * Context
Definition BootPicker.h:17
GUI_OBJ_CHILD Hdr
Definition BootPicker.h:25