Skip to content

Commit

Permalink
OpenCanopy: Only require presence of label images when used
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebeaton committed Jan 3, 2024
1 parent 0b1f838 commit 7e916f5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ OpenCore Changelog
- Swapped the position of Shutdown and Restart buttons to better match recent macOS
- Added `OC_ATTR_USE_REVERSED_UI` to allow access to previous default Shutdown and Restart button arrangement
- Fixed intro animation getting stuck in OpenCanopy if an entry which returns to menu is selected before animation ends
- Modified OpenCanopy to require presence of label images only when used due to `OC_ATTR_USE_GENERIC_LABEL_IMAGE`

#### v0.9.7
- Updated recovery_urls.txt
Expand Down
29 changes: 18 additions & 11 deletions Platform/OpenCanopy/GuiApp.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,15 @@ InternalContextConstruct (
UINT32 ImageHeight;
BOOLEAN Result;
BOOLEAN AllowLessSize;
BOOLEAN UseGenericLabel;

ASSERT (Context != NULL);

Context->Scale = 1;
UiScaleSize = sizeof (Context->Scale);

UseGenericLabel = (Picker->PickerAttributes & OC_ATTR_USE_GENERIC_LABEL_IMAGE) != 0;

Status = gRT->GetVariable (
APPLE_UI_SCALE_VARIABLE_NAME,
&gAppleVendorVariableGuid,
Expand Down Expand Up @@ -596,18 +599,22 @@ InternalContextConstruct (
}

for (Index = 0; Index < LABEL_NUM_TOTAL; ++Index) {
Status = LoadLabelFromStorage (
Storage,
mLabelNames[Index],
Context->Scale,
Context->LightBackground,
&Context->Labels[Index]
);
if (EFI_ERROR (Status)) {
if (!UseGenericLabel) {
Context->Labels[Index].Buffer = NULL;
DEBUG ((DEBUG_WARN, "OCUI: Failed to load images\n"));
InternalContextDestruct (Context);
return EFI_UNSUPPORTED;
} else {
Status = LoadLabelFromStorage (
Storage,
mLabelNames[Index],
Context->Scale,
Context->LightBackground,
&Context->Labels[Index]
);
if (EFI_ERROR (Status)) {
Context->Labels[Index].Buffer = NULL;
DEBUG ((DEBUG_WARN, "OCUI: Failed to load images\n"));
InternalContextDestruct (Context);
return EFI_UNSUPPORTED;
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions Platform/OpenCanopy/Views/BootPicker.c
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,11 @@ CopyLabel (
IN CONST GUI_IMAGE *Source
)
{
if (Source->Buffer == NULL) {
ASSERT (FALSE);
return EFI_UNSUPPORTED;
}

Destination->Width = Source->Width;
Destination->Height = Source->Height;
Destination->Buffer = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)AllocateCopyPool (
Expand Down

0 comments on commit 7e916f5

Please sign in to comment.