347 CHAR16 OldEntryCursor;
349 UINT32 TimeOutSeconds;
354 BOOLEAN ModifiersChanged;
357 UINTN SafeEntryLength;
360 #if defined (BUILTIN_DEMONSTRATE_TYPING)
363 INT32 TypingStartColumn;
365 INT32 ShutdownRestartRow;
366 INT32 ShutdownColumn;
374 TimeOutSeconds = BootContext->PickerContext->TimeoutSeconds;
377 ASSERT (BootContext->DefaultEntry != NULL);
378 ChosenEntry = (INTN)(BootContext->DefaultEntry->EntryIndex - 1);
379 OldChosenEntry = ChosenEntry;
382 OldEntryCursor = L
'\0';
408 DEBUG ((DEBUG_INFO,
"OCB: Init builtin picker debug\n"));
416 if (KeyMap == NULL) {
417 DEBUG ((DEBUG_ERROR,
"OCB: Missing AppleKeyMapAggregator\n"));
418 return EFI_UNSUPPORTED;
421 Count = (UINT32)BootContext->BootEntryCount;
424 DEBUG ((DEBUG_WARN,
"OCB: Cannot display all entries in the menu!\n"));
431 gST->ConOut->QueryMode (
gST->ConOut,
gST->ConOut->Mode->Mode, &Columns, &Rows);
432 for (Index = 0; Index < Count; Index++) {
434 if (BootEntries[Index]->IsExternal) {
438 if (BootEntries[Index]->IsFolder) {
445 SafeEntryLength =
L_STR_LEN (L
"...") + 1;
448 if (StrLen (BootEntries[Index]->Name) > SafeEntryLength) {
449 StrCpyS (&BootEntries[Index]->Name[SafeEntryLength -
L_STR_LEN (L
"...")],
L_STR_SIZE (L
"..."), L
"...");
454 gST->ConOut->EnableCursor (
gST->ConOut, FALSE);
456 if (BootContext->PickerContext->ConsoleAttributes != 0) {
457 gST->ConOut->SetAttribute (
gST->ConOut, BootContext->PickerContext->ConsoleAttributes & 0x7FU);
460 gST->ConOut->ClearScreen (
gST->ConOut);
463 if (FirstIndexRow != -1) {
467 if ((OldChosenEntry >= 0) && (OldChosenEntry != ChosenEntry)) {
468 gST->ConOut->SetCursorPosition (
gST->ConOut, 0, FirstIndexRow + OldChosenEntry);
469 gST->ConOut->OutputString (
gST->ConOut, L
" ");
472 if (ChosenEntry >= 0) {
478 if ((OldChosenEntry != ChosenEntry) || (OldEntryCursor != EntryCursor)) {
479 if (ChosenEntry >= 0) {
480 gST->ConOut->SetCursorPosition (
gST->ConOut, 0, FirstIndexRow + ChosenEntry);
481 Code[0] = EntryCursor;
482 gST->ConOut->OutputString (
gST->ConOut,
Code);
485 OldChosenEntry = ChosenEntry;
486 OldEntryCursor = EntryCursor;
496 gST->ConOut->SetCursorPosition (
gST->ConOut, MillisColumn, 0);
506 gST->ConOut->ClearScreen (
gST->ConOut);
509 if (BootContext->PickerContext->TitleSuffix != NULL) {
510 Length = AsciiStrLen (BootContext->PickerContext->TitleSuffix);
511 gST->ConOut->OutputString (
gST->ConOut, L
" (");
512 for (Index = 0; Index <
Length; ++Index) {
513 Code[0] = BootContext->PickerContext->TitleSuffix[Index];
514 gST->ConOut->OutputString (
gST->ConOut,
Code);
517 gST->ConOut->OutputString (
gST->ConOut, L
")");
525 gST->ConOut->OutputString (
gST->ConOut, L
" [System uptime: ");
526 MillisColumn =
gST->ConOut->Mode->CursorColumn;
532 gST->ConOut->OutputString (
gST->ConOut, L
"\r\n\r\n");
534 FirstIndexRow =
gST->ConOut->Mode->CursorRow;
539 if ((ChosenEntry >= 0) && ((UINTN)ChosenEntry == Index)) {
540 OldEntryCursor = EntryCursor;
543 Code[0] = EntryCursor;
544 gST->ConOut->OutputString (
gST->ConOut,
Code);
545 gST->ConOut->OutputString (
gST->ConOut, L
" ");
548 gST->ConOut->OutputString (
gST->ConOut,
Code);
549 gST->ConOut->OutputString (
gST->ConOut, L
". ");
550 gST->ConOut->OutputString (
gST->ConOut, BootEntries[Index]->Name);
551 if (BootEntries[Index]->IsExternal) {
555 if (BootEntries[Index]->IsFolder) {
564 gST->ConOut->SetCursorPosition (
gST->ConOut, 0,
MIN (FirstIndexRow + Index + 1, Rows - 1));
568 gST->ConOut->OutputString (
gST->ConOut, L
"\r\n");
570 ShutdownRestartRow =
gST->ConOut->Mode->CursorRow;
571 gST->ConOut->OutputString (
gST->ConOut, L
" ");
574 ShutdownColumn =
gST->ConOut->Mode->CursorColumn;
575 gST->ConOut->OutputString (
gST->ConOut, L
"|Shutdown|");
576 gST->ConOut->OutputString (
gST->ConOut, L
" ");
577 RestartColumn =
gST->ConOut->Mode->CursorColumn;
578 gST->ConOut->OutputString (
gST->ConOut, L
"|Restart|");
580 RestartColumn =
gST->ConOut->Mode->CursorColumn;
581 gST->ConOut->OutputString (
gST->ConOut, L
"|Restart|");
582 gST->ConOut->OutputString (
gST->ConOut, L
" ");
583 ShutdownColumn =
gST->ConOut->Mode->CursorColumn;
584 gST->ConOut->OutputString (
gST->ConOut, L
"|Shutdown|");
587 gST->ConOut->OutputString (
gST->ConOut, L
"\r\n");
592 ShutdownRestartRow = 0;
597 gST->ConOut->OutputString (
gST->ConOut, L
"\r\n");
603 #if defined (BUILTIN_DEMONSTRATE_TYPING)
604 gST->ConOut->OutputString (
gST->ConOut, L
"\r\n\r\n");
605 gST->ConOut->OutputString (
gST->ConOut, L
"Typing: ");
606 TypingRow =
gST->ConOut->Mode->CursorRow;
607 TypingColumn =
gST->ConOut->Mode->CursorColumn;
608 TypingStartColumn = TypingColumn;
617 gST->ConOut->OutputString (
gST->ConOut, L
"\r\n\r\n");
619 L
"mTscFrequency = %,Lu\n",
628 if (!PlayedOnce && BootContext->PickerContext->PickerAudioAssist) {
630 for (Index = 0; Index < Count; ++Index) {
632 if ((TimeOutSeconds > 0) && (BootContext->DefaultEntry->EntryIndex - 1 == Index)) {
638 BootContext->PickerContext,
648 BootContext->PickerContext->HotKeyContext->FlushTypingBuffer (BootContext->PickerContext);
657 }
else if (TimeOutSeconds != 0) {
658 if (KeyEndTime == 0) {
659 KeyEndTime = BootContext->PickerContext->HotKeyContext->GetKeyWaitEndTime (TimeOutSeconds * 1000);
665 ModifiersChanged = BootContext->PickerContext->HotKeyContext->WaitForKeyInfo (
666 BootContext->PickerContext,
679 FocusList[FocusState],
682 #
if defined (BUILTIN_DEMONSTRATE_TYPING)
696 if ((FocusList[FocusState] ==
TAB_PICKER) && (TimeOutSeconds > 0)) {
701 if (FocusState == 0) {
702 FocusState = NumFocusList;
708 if (FocusState == NumFocusList) {
717 FocusList[FocusState],
720 #
if defined (BUILTIN_DEMONSTRATE_TYPING)
736 gST->ConOut->OutputString (
gST->ConOut, L
"\r\n");
744 gST->ConOut->OutputString (
gST->ConOut, L
"\r\n");
751 #if defined (BUILTIN_DEMONSTRATE_TYPING)
752 else if (FocusList[FocusState] == TAB_TYPING_DEMO) {
758 gST->ConOut->SetCursorPosition (
gST->ConOut, TypingColumn, TypingRow);
760 gST->ConOut->OutputString (
gST->ConOut,
Code);
762 gST->ConOut->OutputString (
gST->ConOut,
Code);
768 gST->ConOut->SetCursorPosition (
gST->ConOut, TypingColumn, TypingRow);
770 gST->ConOut->OutputString (
gST->ConOut,
Code);
772 gST->ConOut->OutputString (
gST->ConOut,
Code);
785 *ChosenBootEntry = BootEntries[BootContext->DefaultEntry->EntryIndex - 1];
787 gST->ConOut->OutputString (
gST->ConOut, L
"\r\n");
791 if (ChosenEntry >= 0) {
792 *ChosenBootEntry = BootEntries[(UINTN)ChosenEntry];
794 *ChosenBootEntry = BootContext->DefaultEntry;
799 gST->ConOut->OutputString (
gST->ConOut, L
"\r\n");
803 gST->ConOut->OutputString (
gST->ConOut, L
"\r\n");
808 gST->ConOut->OutputString (
gST->ConOut, L
"\r\n");
810 BootContext->PickerContext->HideAuxiliary = FALSE;
813 if (ChosenEntry < 0) {
815 }
else if (ChosenEntry == 0) {
822 if (BootContext->PickerContext->PickerAudioAssist) {
828 if (ChosenEntry < 0) {
837 if (BootContext->PickerContext->PickerAudioAssist) {
845 if (BootContext->PickerContext->PickerAudioAssist) {
853 if (BootContext->PickerContext->PickerAudioAssist) {
862 *ChosenBootEntry = BootEntries[PickerKeyInfo.
OcKeyCode];
865 gST->ConOut->OutputString (
gST->ConOut,
Code);
866 gST->ConOut->OutputString (
gST->ConOut, L
"\r\n");
876 if (ModifiersChanged || (PickerKeyInfo.
UnicodeChar != CHAR_NULL)) {