Skip to content

Commit

Permalink
OpenCanopy: Fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Dec 16, 2020
1 parent 1bc4bfb commit 897797c
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 8 deletions.
66 changes: 65 additions & 1 deletion Include/Acidanthera/Library/OcBootManagementLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,50 @@ INTN
OUT BOOLEAN *SetDefault OPTIONAL
);


/**
Play audio file for context.
**/
typedef
EFI_STATUS
(EFIAPI *OC_PLAY_AUDIO_FILE) (
IN OC_PICKER_CONTEXT *Context,
IN UINT32 File,
IN BOOLEAN Fallback
);

/**
Generate cycles of beep signals for context with silence afterwards, blocking.
**/
typedef
EFI_STATUS
(EFIAPI *OC_PLAY_AUDIO_BEEP) (
IN OC_PICKER_CONTEXT *Context,
IN UINT32 ToneCount,
IN UINT32 ToneLength,
IN UINT32 SilenceLength
);

/**
Play audio entry for context.
**/
typedef
EFI_STATUS
(EFIAPI *OC_PLAY_AUDIO_ENTRY) (
IN OC_PICKER_CONTEXT *Context,
IN OC_BOOT_ENTRY *Entry
);

/**
Toggle VoiceOver support.
**/
typedef
VOID
(EFIAPI *OC_TOGGLE_VOICE_OVER) (
IN OC_PICKER_CONTEXT *Context,
IN UINT32 File OPTIONAL
);

/**
Picker behaviour action.
**/
Expand Down Expand Up @@ -680,6 +724,22 @@ struct OC_PICKER_CONTEXT_ {
//
APPLE_BEEP_GEN_PROTOCOL *BeepGen;
//
// Play audio file function.
//
OC_PLAY_AUDIO_FILE PlayAudioFile;
//
// Play audio beep function.
//
OC_PLAY_AUDIO_BEEP PlayAudioBeep;
//
// Play audio entry function.
//
OC_PLAY_AUDIO_ENTRY PlayAudioEntry;
//
// Toggle VoiceOver function.
//
OC_TOGGLE_VOICE_OVER ToggleVoiceOver;
//
// Recovery initiator if present.
//
EFI_DEVICE_PATH_PROTOCOL *RecoveryInitiator;
Expand Down Expand Up @@ -1234,6 +1294,7 @@ OcRunFirmwareApplication (
@retval EFI_SUCCESS on success or when unnecessary.
**/
EFI_STATUS
EFIAPI
OcPlayAudioFile (
IN OC_PICKER_CONTEXT *Context,
IN UINT32 File,
Expand All @@ -1251,6 +1312,7 @@ OcPlayAudioFile (
@retval EFI_SUCCESS on success or when unnecessary.
**/
EFI_STATUS
EFIAPI
OcPlayAudioBeep (
IN OC_PICKER_CONTEXT *Context,
IN UINT32 ToneCount,
Expand All @@ -1259,14 +1321,15 @@ OcPlayAudioBeep (
);

/**
Play audio file for context.
Play audio entry for context.
@param[in] Context Picker context.
@param[in] Entry Entry to play.
@retval EFI_SUCCESS on success or when unnecessary.
**/
EFI_STATUS
EFIAPI
OcPlayAudioEntry (
IN OC_PICKER_CONTEXT *Context,
IN OC_BOOT_ENTRY *Entry
Expand All @@ -1279,6 +1342,7 @@ OcPlayAudioEntry (
@param[in] File File to play after enabling VoiceOver.
**/
VOID
EFIAPI
OcToggleVoiceOver (
IN OC_PICKER_CONTEXT *Context,
IN UINT32 File OPTIONAL
Expand Down
4 changes: 4 additions & 0 deletions Library/OcBootManagementLib/BootAudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include <Library/UefiLib.h>

EFI_STATUS
EFIAPI
OcPlayAudioFile (
IN OC_PICKER_CONTEXT *Context,
IN UINT32 File,
Expand Down Expand Up @@ -138,6 +139,7 @@ OcPlayAudioFile (
}

EFI_STATUS
EFIAPI
OcPlayAudioBeep (
IN OC_PICKER_CONTEXT *Context,
IN UINT32 ToneCount,
Expand Down Expand Up @@ -170,6 +172,7 @@ OcPlayAudioBeep (
}

EFI_STATUS
EFIAPI
OcPlayAudioEntry (
IN OC_PICKER_CONTEXT *Context,
IN OC_BOOT_ENTRY *Entry
Expand Down Expand Up @@ -207,6 +210,7 @@ OcPlayAudioEntry (
}

VOID
EFIAPI
OcToggleVoiceOver (
IN OC_PICKER_CONTEXT *Context,
IN UINT32 File OPTIONAL
Expand Down
36 changes: 29 additions & 7 deletions Platform/OpenCanopy/Views/BootPicker.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ InternalBootPickerViewDraw (
ASSERT (Context != NULL);

if (!Context->PlayedOnce && Context->PickerContext->PickerAudioAssist) {
OcPlayAudioFile (Context->PickerContext, OcVoiceOverAudioFileChooseOS, FALSE);
Context->PickerContext->PlayAudioFile (
Context->PickerContext,
OcVoiceOverAudioFileChooseOS,
FALSE
);
}

GuiDrawToBuffer (
Expand Down Expand Up @@ -131,7 +135,7 @@ InternalBootPickerViewDraw (
);

if (!Context->PlayedOnce) {
OcPlayAudioBeep (
Context->PickerContext->PlayAudioBeep (
Context->PickerContext,
OC_VOICE_OVER_SIGNALS_NORMAL,
OC_VOICE_OVER_SIGNAL_NORMAL_MS,
Expand Down Expand Up @@ -225,8 +229,15 @@ InternalBootPickerChangeEntry (
PrevEntry = This->SelectedEntry;
InternalBootPickerSelectEntry (This, NewEntry);

OcPlayAudioFile (DrawContext->GuiContext->PickerContext, OcVoiceOverAudioFileSelected, FALSE);
OcPlayAudioEntry (DrawContext->GuiContext->PickerContext, This->SelectedEntry->Context);
DrawContext->GuiContext->PickerContext->PlayAudioFile (
DrawContext->GuiContext->PickerContext,
OcVoiceOverAudioFileSelected,
FALSE
);
DrawContext->GuiContext->PickerContext->PlayAudioEntry (
DrawContext->GuiContext->PickerContext,
This->SelectedEntry->Context
);
//
// To redraw the entry *and* the selector, draw the entire height of the
// Picker object. For this, the height just reach from the top of the entries
Expand Down Expand Up @@ -316,12 +327,23 @@ InternalBootPickerKeyEvent (
if (Key == OC_INPUT_MORE) {
GuiContext->HideAuxiliary = FALSE;
GuiContext->Refresh = TRUE;
OcPlayAudioFile (DrawContext->GuiContext->PickerContext, OcVoiceOverAudioFileShowAuxiliary, FALSE);
DrawContext->GuiContext->PickerContext->PlayAudioFile (
DrawContext->GuiContext->PickerContext,
OcVoiceOverAudioFileShowAuxiliary,
FALSE
);
} else if (Key == OC_INPUT_ABORTED) {
GuiContext->Refresh = TRUE;
OcPlayAudioFile (DrawContext->GuiContext->PickerContext, OcVoiceOverAudioFileReloading, FALSE);
DrawContext->GuiContext->PickerContext->PlayAudioFile (
DrawContext->GuiContext->PickerContext,
OcVoiceOverAudioFileReloading,
FALSE
);
} else if (Key == OC_INPUT_VOICE_OVER) {
OcToggleVoiceOver (DrawContext->GuiContext->PickerContext, 0);
DrawContext->GuiContext->PickerContext->ToggleVoiceOver (
DrawContext->GuiContext->PickerContext,
0
);
}
}

Expand Down
4 changes: 4 additions & 0 deletions Platform/OpenCore/OpenCoreMisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,10 @@ OcMiscBoot (
Context->GetEntryLabelImage = OcGetBootEntryLabelImage;
Context->GetEntryIcon = OcGetBootEntryIcon;
Context->GetKeyIndex = OcGetAppleKeyIndex;
Context->PlayAudioFile = OcPlayAudioFile;
Context->PlayAudioBeep = OcPlayAudioBeep;
Context->PlayAudioEntry = OcPlayAudioEntry;
Context->ToggleVoiceOver = OcToggleVoiceOver;
Context->PickerMode = PickerMode;
Context->ConsoleAttributes = Config->Misc.Boot.ConsoleAttributes;
Context->PickerAttributes = Config->Misc.Boot.PickerAttributes;
Expand Down

0 comments on commit 897797c

Please sign in to comment.