提交 e7f73600 编写于 作者: P PMheart 提交者: vit9696

OpenCanopy: Implement PickerVariant support

上级 c23174e7
......@@ -17,6 +17,8 @@ OpenCore Changelog
- Reworked LogoutHook.command to support older macOS
- Improved Duet USB legacy management for supported controllers
- Implemented MP3 audio decoding for audio assistant support
- Added support for `PickerVariant` for more theme variants
- Added `OC_ATTR_HIDE_THEMED_ICONS` `PickerAttribute` for Time Machine
#### v0.6.4
- Added `BlacklistAppleUpdate` to fix macOS 11 broken update optout
......
......@@ -3040,9 +3040,9 @@ entry choice will update till next manual reconfiguration.
\item \texttt{0x0004} --- \texttt{OC\_ATTR\_USE\_GENERIC\_LABEL\_IMAGE}, provides predefined
label images for boot entries without custom entries. May give less detail for the actual
boot entry.
\item \texttt{0x0008} --- \texttt{OC\_ATTR\_USE\_ALTERNATE\_ICONS}, changes used icon set to
an alternate one if it is supported. For example, this could make a use of old-style icons
with a custom background colour.
\item \texttt{0x0008} --- \texttt{OC\_ATTR\_HIDE\_THEMED\_ICONS}, prefers builtin icons
for certain icon categories to match the theme style. For example, this could force
displaying the builtin Time Machine icon. Requires \texttt{OC\_ATTR\_USE\_VOLUME\_ICON}.
\item \texttt{0x0010} --- \texttt{OC\_ATTR\_USE\_POINTER\_CONTROL}, enable pointer control
in the picker when available. For example, this could make use of mouse or trackpad to
control UI elements.
......@@ -3179,6 +3179,23 @@ entry choice will update till next manual reconfiguration.
The \texttt{BootKicker} utility can be blessed to workaround this problem even without loading
OpenCore. On some Macs however, the \texttt{BootKicker} utility cannot be run from OpenCore.
\item
\texttt{PickerVariant}\\
\textbf{Type}: \texttt{plist\ string}\\
\textbf{Failsafe}: \texttt{Auto}\\
\textbf{Description}: Choose specific icon set used for boot management.
The following values are supported:
\begin{itemize}
\tightlist
\item \texttt{Auto} --- Automatically select one set of icons based on \texttt{DefaultBackground}
colour.
\item \texttt{Default} --- Normal icon set (without prefix).
\item \texttt{Old} --- Vintage icon set (\texttt{Old} filename prefix).
\item \texttt{Modern} --- Nouveau icon set (\texttt{Modern} filename prefix).
\item Other value --- Custom icon set if supported by the resources.
\end{itemize}
\end{enumerate}
\subsection{Debug Properties}\label{miscdebugprops}
......
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Wed Dec 16 19:38:04 2020
%DIF ADD ../Configuration.tex Sat Jan 2 07:28:05 2021
%DIF ADD ../Configuration.tex Sat Jan 2 15:39:49 2021
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
......@@ -3100,10 +3100,11 @@ entry choice will update till next manual reconfiguration.
\item \texttt{0x0004} --- \texttt{OC\_ATTR\_USE\_GENERIC\_LABEL\_IMAGE}, provides predefined
label images for boot entries without custom entries. May give less detail for the actual
boot entry.
\item \texttt{0x0008} --- \texttt{OC\_ATTR\_USE\_ALTERNATE\_ICONS}, changes used icon set to
an alternate one if it is supported. For example, this could make a use of old-style icons
with a custom background colour.
\item \texttt{0x0010} --- \texttt{OC\_ATTR\_USE\_POINTER\_CONTROL}, enable pointer control
\item \texttt{0x0008} --- \texttt{OC\_ATTR\_\DIFdelbegin \DIFdel{USE}\DIFdelend \DIFaddbegin \DIFadd{HIDE}\DIFaddend \_\DIFdelbegin \DIFdel{ALTERNATE}\DIFdelend \DIFaddbegin \DIFadd{THEMED}\DIFaddend \_ICONS}, \DIFdelbegin \DIFdel{changes used icon set to an alternate one if it is supported}\DIFdelend \DIFaddbegin \DIFadd{prefers builtin icons
for certain icon categories to match the theme style}\DIFaddend . For example, this could \DIFdelbegin \DIFdel{make a use of old-style icons
with a custom background colour. }\DIFdelend \DIFaddbegin \DIFadd{force
displaying the builtin Time Machine icon. Requires }\texttt{\DIFadd{OC\_ATTR\_USE\_VOLUME\_ICON}}\DIFadd{.
}\DIFaddend \item \texttt{0x0010} --- \texttt{OC\_ATTR\_USE\_POINTER\_CONTROL}, enable pointer control
in the picker when available. For example, this could make use of mouse or trackpad to
control UI elements.
\end{itemize}
......@@ -3239,7 +3240,25 @@ entry choice will update till next manual reconfiguration.
The \texttt{BootKicker} utility can be blessed to workaround this problem even without loading
OpenCore. On some Macs however, the \texttt{BootKicker} utility cannot be run from OpenCore.
\end{enumerate}
\DIFaddbegin \item
\texttt{\DIFadd{PickerVariant}}\\
\textbf{\DIFadd{Type}}\DIFadd{: }\texttt{\DIFadd{plist\ string}}\\
\textbf{\DIFadd{Failsafe}}\DIFadd{: }\texttt{\DIFadd{Auto}}\\
\textbf{\DIFadd{Description}}\DIFadd{: Choose specific icon set used for boot management.
}
\DIFadd{The following values are supported:
}\begin{itemize}
\tightlist
\item \texttt{\DIFadd{Auto}} \DIFadd{--- Automatically select one set of icons based on }\texttt{\DIFadd{DefaultBackground}}
\DIFadd{colour.
}\item \texttt{\DIFadd{Default}} \DIFadd{--- Normal icon set (without prefix).
}\item \texttt{\DIFadd{Old}} \DIFadd{--- Vintage icon set (}\texttt{\DIFadd{Old}} \DIFadd{filename prefix).
}\item \texttt{\DIFadd{Modern}} \DIFadd{--- Nouveau icon set (}\texttt{\DIFadd{Modern}} \DIFadd{filename prefix).
}\item \DIFadd{Other value --- Custom icon set if supported by the resources.
}\end{itemize}
\DIFaddend \end{enumerate}
\subsection{Debug Properties}\label{miscdebugprops}
......
......@@ -733,6 +733,8 @@
<false/>
<key>PickerMode</key>
<string>Builtin</string>
<key>PickerVariant</key>
<string>Auto</string>
<key>PollAppleHotKeys</key>
<false/>
<key>ShowPicker</key>
......
......@@ -733,6 +733,8 @@
<false/>
<key>PickerMode</key>
<string>Builtin</string>
<key>PickerVariant</key>
<string>Auto</string>
<key>PollAppleHotKeys</key>
<false/>
<key>ShowPicker</key>
......
......@@ -60,11 +60,11 @@ typedef struct OC_PICKER_CONTEXT_ OC_PICKER_CONTEXT;
#define OC_ATTR_USE_VOLUME_ICON BIT0
#define OC_ATTR_USE_DISK_LABEL_FILE BIT1
#define OC_ATTR_USE_GENERIC_LABEL_IMAGE BIT2
#define OC_ATTR_USE_ALTERNATE_ICONS BIT3
#define OC_ATTR_HIDE_THEMED_ICONS BIT3
#define OC_ATTR_USE_POINTER_CONTROL BIT4
#define OC_ATTR_ALL_BITS (\
OC_ATTR_USE_VOLUME_ICON | OC_ATTR_USE_DISK_LABEL_FILE | \
OC_ATTR_USE_GENERIC_LABEL_IMAGE | OC_ATTR_USE_ALTERNATE_ICONS | \
OC_ATTR_USE_GENERIC_LABEL_IMAGE | OC_ATTR_HIDE_THEMED_ICONS | \
OC_ATTR_USE_POINTER_CONTROL)
/**
......@@ -692,6 +692,10 @@ struct OC_PICKER_CONTEXT_ {
//
UINT32 PickerAttributes;
//
// Picker icon set variant (refer to docs for requested behaviour).
//
CONST CHAR8 *PickerVariant;
//
// Enable polling boot arguments.
//
BOOLEAN PollAppleHotKeys;
......
......@@ -325,6 +325,7 @@
_(OC_STRING , HibernateMode , , OC_STRING_CONSTR ("None", _, __) , OC_DESTR (OC_STRING)) \
_(UINT32 , ConsoleAttributes , , 0 , ()) \
_(UINT32 , PickerAttributes , , 0 , ()) \
_(OC_STRING , PickerVariant , , OC_STRING_CONSTR ("Auto", _, __) , OC_DESTR (OC_STRING)) \
_(UINT32 , TakeoffDelay , , 0 , ()) \
_(UINT32 , Timeout , , 0 , ()) \
_(BOOLEAN , PickerAudioAssist , , FALSE , ()) \
......
......@@ -398,6 +398,7 @@ mMiscConfigurationBootSchema[] = {
OC_SCHEMA_INTEGER_IN ("PickerAttributes", OC_GLOBAL_CONFIG, Misc.Boot.PickerAttributes),
OC_SCHEMA_BOOLEAN_IN ("PickerAudioAssist", OC_GLOBAL_CONFIG, Misc.Boot.PickerAudioAssist),
OC_SCHEMA_STRING_IN ("PickerMode", OC_GLOBAL_CONFIG, Misc.Boot.PickerMode),
OC_SCHEMA_STRING_IN ("PickerVariant", OC_GLOBAL_CONFIG, Misc.Boot.PickerVariant),
OC_SCHEMA_BOOLEAN_IN ("PollAppleHotKeys", OC_GLOBAL_CONFIG, Misc.Boot.PollAppleHotKeys),
OC_SCHEMA_BOOLEAN_IN ("ShowPicker", OC_GLOBAL_CONFIG, Misc.Boot.ShowPicker),
OC_SCHEMA_INTEGER_IN ("TakeoffDelay", OC_GLOBAL_CONFIG, Misc.Boot.TakeoffDelay),
......
......@@ -116,7 +116,7 @@ LoadImageFileFromStorage (
IN UINT32 MatchWidth,
IN UINT32 MatchHeight,
IN BOOLEAN Icon,
IN BOOLEAN Old,
IN CONST CHAR8 *Prefix,
IN BOOLEAN AllowLessSize
)
{
......@@ -137,7 +137,7 @@ LoadImageFileFromStorage (
Path,
sizeof (Path),
OPEN_CORE_IMAGE_PATH L"%a%a%a.icns",
Old ? "Old" : "",
Prefix,
Index > 0 ? "Ext" : "",
ImageFilePath
);
......@@ -169,11 +169,11 @@ LoadImageFileFromStorage (
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_INFO,
"OCUI: Failed to load image (%u/%u) %s old:%d icon:%d - %r\n",
"OCUI: Failed to load image (%u/%u) %s prefix:%a icon:%d - %r\n",
Index+1,
ImageCount,
Path,
Old,
Prefix,
Icon,
Status
));
......@@ -274,7 +274,7 @@ InternalContextConstruct (
UINTN UiScaleSize;
UINT32 Index;
UINT32 ImageDimension;
BOOLEAN Old;
CONST CHAR8 *Prefix;
BOOLEAN Result;
ASSERT (Context != NULL);
......@@ -315,9 +315,16 @@ InternalContextConstruct (
mBackgroundPixel.Blue = Context->BackgroundColor.Pixel.Blue;
mBackgroundPixel.Reserved = 0xFF;
Old = Context->BackgroundColor.Raw == APPLE_COLOR_LIGHT_GRAY;
if ((Picker->PickerAttributes & OC_ATTR_USE_ALTERNATE_ICONS) != 0) {
Old = !Old;
if (AsciiStrCmp (Picker->PickerVariant, "Auto") == 0) {
if (Context->BackgroundColor.Raw == APPLE_COLOR_LIGHT_GRAY) {
Prefix = "Old";
} else {
Prefix = "";
}
} else if (AsciiStrCmp (Picker->PickerVariant, "Default") == 0) {
Prefix = "";
} else {
Prefix = Picker->PickerVariant;
}
if (Context->BackgroundColor.Raw == APPLE_COLOR_SYRAH_BLACK) {
......@@ -354,7 +361,7 @@ InternalContextConstruct (
ImageDimension,
ImageDimension,
Index >= ICON_NUM_SYS,
Old,
Prefix,
Index == ICON_CURSOR
);
......
......@@ -849,7 +849,14 @@ BootPickerEntriesAdd (
VolumeEntry->Context = Entry;
if (UseVolumeIcon) {
//
// Load volume icons when allowed.
// Do not load volume icons for Time Machine entries unless explicitly enabled.
// This works around Time Machine icon style incompatibilities.
//
if (UseVolumeIcon
&& (Entry->Type != OC_BOOT_APPLE_TIME_MACHINE
|| (Context->PickerAttributes & OC_ATTR_HIDE_THEMED_ICONS) == 0)) {
Status = Context->GetEntryIcon (Context, Entry, &IconFileData, &IconFileSize);
if (!EFI_ERROR (Status)) {
......
......@@ -739,6 +739,7 @@ OcMiscBoot (
UINTN BlessOverrideSize;
CHAR16 **BlessOverride;
CONST CHAR8 *AsciiPicker;
CONST CHAR8 *AsciiPickerVariant;
CONST CHAR8 *AsciiDmg;
AsciiPicker = OC_BLOB_GET (&Config->Misc.Boot.PickerMode);
......@@ -754,6 +755,8 @@ OcMiscBoot (
PickerMode = OcPickerModeBuiltin;
}
AsciiPickerVariant = OC_BLOB_GET (&Config->Misc.Boot.PickerVariant);
AsciiDmg = OC_BLOB_GET (&Config->Misc.Security.DmgLoading);
if (AsciiStrCmp (AsciiDmg, "Disabled") == 0) {
......@@ -877,6 +880,7 @@ OcMiscBoot (
Context->PickerMode = PickerMode;
Context->ConsoleAttributes = Config->Misc.Boot.ConsoleAttributes;
Context->PickerAttributes = Config->Misc.Boot.PickerAttributes;
Context->PickerVariant = AsciiPickerVariant;
Context->BlacklistAppleUpdate = Config->Misc.Security.BlacklistAppleUpdate;
if ((Config->Misc.Security.ExposeSensitiveData & OCS_EXPOSE_VERSION_UI) != 0) {
......
......@@ -152,6 +152,7 @@ CheckMisc (
CONST CHAR8 *HibernateMode;
UINT32 PickerAttributes;
CONST CHAR8 *PickerMode;
CONST CHAR8 *PickerVariant;
UINT64 DisplayLevel;
UINT64 AllowedDisplayLevel;
UINT64 HaltLevel;
......@@ -180,6 +181,7 @@ CheckMisc (
HibernateMode = OC_BLOB_GET (&UserMisc->Boot.HibernateMode);
PickerAttributes = UserMisc->Boot.PickerAttributes;
PickerMode = OC_BLOB_GET (&UserMisc->Boot.PickerMode);
PickerVariant = OC_BLOB_GET (&UserMisc->Boot.PickerVariant);
DisplayLevel = UserMisc->Debug.DisplayLevel;
AllowedDisplayLevel = DEBUG_WARN | DEBUG_INFO | DEBUG_VERBOSE | DEBUG_ERROR;
HaltLevel = DisplayLevel;
......@@ -222,6 +224,11 @@ CheckMisc (
++ErrorCount;
}
if (PickerVariant[0] == '\0') {
DEBUG ((DEBUG_WARN, "Misc->Boot->PickerVariant cannot be empty!\n"));
++ErrorCount;
}
//
// FIXME: Check whether DisplayLevel only supports values within AllowedDisplayLevel, or all possible levels in DebugLib.h?
//
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册