mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
OpenCanopy: Support VoiceOver for TAB navigation
This commit is contained in:
parent
afc7a72041
commit
9af9dc1343
@ -102,8 +102,10 @@ typedef enum {
|
||||
OcVoiceOverAudioFileUEFI_Shell = 0x1047,
|
||||
OcVoiceOverAudioFileWelcome = 0x1048,
|
||||
OcVoiceOverAudioFileWindows = 0x1049,
|
||||
OcVoiceOverAudioFileShutDown = 0x104A,
|
||||
OcVoiceOverAudioFileRestart = 0x104B,
|
||||
|
||||
OcVoiceOverAudioFileMax = 0x104A,
|
||||
OcVoiceOverAudioFileMax = 0x104C,
|
||||
} OC_VOICE_OVER_AUDIO_FILE;
|
||||
|
||||
STATIC_ASSERT (OcVoiceOverAudioFileIndexMax - OcVoiceOverAudioFileIndexBase == 9 + 26, "Invalid index count");
|
||||
|
||||
@ -168,6 +168,12 @@ OcAudioGetFilePath (
|
||||
case OcVoiceOverAudioFileWindows:
|
||||
BasePath = "Windows";
|
||||
break;
|
||||
case OcVoiceOverAudioFileShutDown:
|
||||
BasePath = "ShutDown";
|
||||
break;
|
||||
case OcVoiceOverAudioFileRestart:
|
||||
BasePath = "Restart";
|
||||
break;
|
||||
default:
|
||||
BasePath = NULL;
|
||||
break;
|
||||
|
||||
@ -100,6 +100,13 @@ typedef enum {
|
||||
ICON_TYPE_COUNT = 2,
|
||||
} ICON_TYPE;
|
||||
|
||||
enum {
|
||||
CanopyVoSelectedEntry,
|
||||
CanopyVoFocusPassword,
|
||||
CanopyVoFocusShutDown,
|
||||
CanopyVoFocusRestart
|
||||
};
|
||||
|
||||
typedef struct _BOOT_PICKER_GUI_CONTEXT {
|
||||
GUI_IMAGE Background;
|
||||
GUI_IMAGE Icons[ICON_NUM_TOTAL][ICON_TYPE_COUNT];
|
||||
@ -114,6 +121,7 @@ typedef struct _BOOT_PICKER_GUI_CONTEXT {
|
||||
BOOLEAN DoneIntroAnimation;
|
||||
BOOLEAN ReadyToBoot;
|
||||
UINT8 Scale;
|
||||
UINT8 VoAction;
|
||||
INT32 CursorOffsetX;
|
||||
INT32 CursorOffsetY;
|
||||
INT32 AudioPlaybackTimeout;
|
||||
|
||||
@ -1206,15 +1206,61 @@ GuiDrawLoop (
|
||||
1000000
|
||||
));
|
||||
if (DrawContext->GuiContext->AudioPlaybackTimeout <= 0) {
|
||||
DrawContext->GuiContext->PickerContext->PlayAudioFile (
|
||||
DrawContext->GuiContext->PickerContext,
|
||||
OcVoiceOverAudioFileSelected,
|
||||
FALSE
|
||||
);
|
||||
DrawContext->GuiContext->PickerContext->PlayAudioEntry (
|
||||
DrawContext->GuiContext->PickerContext,
|
||||
DrawContext->GuiContext->BootEntry
|
||||
);
|
||||
switch (DrawContext->GuiContext->VoAction) {
|
||||
case CanopyVoSelectedEntry:
|
||||
{
|
||||
DrawContext->GuiContext->PickerContext->PlayAudioFile (
|
||||
DrawContext->GuiContext->PickerContext,
|
||||
OcVoiceOverAudioFileSelected,
|
||||
FALSE
|
||||
);
|
||||
DrawContext->GuiContext->PickerContext->PlayAudioEntry (
|
||||
DrawContext->GuiContext->PickerContext,
|
||||
DrawContext->GuiContext->BootEntry
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
case CanopyVoFocusPassword:
|
||||
{
|
||||
DrawContext->GuiContext->PickerContext->PlayAudioFile (
|
||||
DrawContext->GuiContext->PickerContext,
|
||||
OcVoiceOverAudioFileEnterPassword,
|
||||
TRUE
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
case CanopyVoFocusShutDown:
|
||||
{
|
||||
DrawContext->GuiContext->PickerContext->PlayAudioFile (
|
||||
DrawContext->GuiContext->PickerContext,
|
||||
OcVoiceOverAudioFileShutDown,
|
||||
TRUE
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
case CanopyVoFocusRestart:
|
||||
{
|
||||
DrawContext->GuiContext->PickerContext->PlayAudioFile (
|
||||
DrawContext->GuiContext->PickerContext,
|
||||
OcVoiceOverAudioFileRestart,
|
||||
TRUE
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
ASSERT (FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Avoid playing twice if we reach precisely 0.
|
||||
//
|
||||
DrawContext->GuiContext->AudioPlaybackTimeout = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -211,6 +211,7 @@ InternalBootPickerSelectEntry (
|
||||
// Set voice timeout to N frames from now.
|
||||
//
|
||||
DrawContext->GuiContext->AudioPlaybackTimeout = OC_VOICE_OVER_IDLE_TIMEOUT_MS;
|
||||
DrawContext->GuiContext->VoAction = CanopyVoSelectedEntry;
|
||||
DrawContext->GuiContext->BootEntry = NewEntry->Context;
|
||||
}
|
||||
}
|
||||
@ -1057,6 +1058,9 @@ InternalBootPickerFocus (
|
||||
mBootPickerSelectorContainer.Obj.Opacity = 0;
|
||||
} else {
|
||||
mBootPickerSelectorContainer.Obj.Opacity = 0xFF;
|
||||
|
||||
DrawContext->GuiContext->AudioPlaybackTimeout = 0;
|
||||
DrawContext->GuiContext->VoAction = CanopyVoSelectedEntry;
|
||||
}
|
||||
|
||||
GuiRequestDraw (
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
#include <Base.h>
|
||||
|
||||
#include <Protocol/OcAudio.h>
|
||||
|
||||
#include <Library/DebugLib.h>
|
||||
|
||||
#include "../OpenCanopy.h"
|
||||
@ -546,6 +548,15 @@ InternalCommonActionButtonFocus (
|
||||
|
||||
mCommonFocus.Obj.OffsetX = This->OffsetX + ((INT32) This->Width - (INT32) mCommonFocus.Obj.Width) / 2;
|
||||
mCommonFocus.Obj.OffsetY = This->OffsetY + ((INT32) This->Height - (INT32) mCommonFocus.Obj.Height) / 2;
|
||||
|
||||
DrawContext->GuiContext->AudioPlaybackTimeout = 0;
|
||||
|
||||
if (This == &mCommonShutDown.Hdr.Obj) {
|
||||
DrawContext->GuiContext->VoAction = CanopyVoFocusShutDown;
|
||||
} else {
|
||||
ASSERT (This == &mCommonRestart.Hdr.Obj);
|
||||
DrawContext->GuiContext->VoAction = CanopyVoFocusRestart;
|
||||
}
|
||||
}
|
||||
|
||||
GuiRequestDrawCrop (
|
||||
|
||||
@ -343,6 +343,9 @@ InternalPasswordBoxFocus (
|
||||
{
|
||||
if (Focus) {
|
||||
mPasswordBoxContainer.Obj.Opacity = 0xFF;
|
||||
|
||||
DrawContext->GuiContext->AudioPlaybackTimeout = 0;
|
||||
DrawContext->GuiContext->VoAction = CanopyVoFocusPassword;
|
||||
} else {
|
||||
mPasswordBoxContainer.Obj.Opacity = 0x100 / 2;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user