Skip to content

Commit

Permalink
OcConfigurationLib: Split ShowPicker and HibernateSkipsPicker (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 authored Dec 5, 2022
1 parent 4ad59a2 commit 10fc98f
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 86 deletions.
5 changes: 1 addition & 4 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ OpenCore Changelog
#### v0.8.7
- Removed unwanted clear screen when launching non-text boot entry
- Fixed TSC/FSB for AMD CPUs in ProvideCurrentCpuInfo, thx @Shaneee
- Changed `Misc` -> `Boot` -> `ShowPicker` typing to string:
- `Always` - Always show picker (equivalent to 0.8.6's ShowPicker=True)
- `Never` - Never show picker (equivalent to 0.8.6's ShowPicker=False)
- `SkipOnHibernateWake` - Don't show picker if waking from macOS hibernation
- Added `Misc` -> `Boot` -> `HibernateSkipsPicker` not to show picker if waking from macOS hibernation
- Changed macrecovery to download files into `com.apple.recovery.boot` by default, thx @dreamwhite
- Supported Apple builtin picker (using `BootKicker.efi` or `PickerMode` `Apple`) when running GPUs without Mac-EFI support on units such as the MacPro5,1 (thx @cdf, @tsialex)
- Enabled `PickerMode` `Apple` to successfully launch selected entry
Expand Down
2 changes: 1 addition & 1 deletion Docs/Configuration.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
484521975a7ca94903e2affd1b4719b7
227bc0ca27ee8c9f6f033dca38233a50
Binary file modified Docs/Configuration.pdf
Binary file not shown.
38 changes: 19 additions & 19 deletions Docs/Configuration.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3328,6 +3328,22 @@ \subsection{Boot Properties}\label{miscbootprops}
\emph{Note}: If the firmware can handle hibernation itself (valid for Mac EFI firmware),
then \texttt{None} should be specified to hand-off hibernation state as is to OpenCore.

\item
\texttt{HibernateSkipsPicker}\\
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
\textbf{Description}: Do not show picker if waking from macOS hibernation.

Limitations:
\begin{itemize}
\item Only supports macOS hibernation wake, Windows and Linux are currently out of scope.
\item Should only be used on systems with reliable hibernation wake in macOS, otherwise users may not
be able to visually see boot loops that may occur.
\item Highly recommended to pair this option with \texttt{PollAppleHotKeys}, allows to enter picker in
case of issues with hibernation wake.
\item Visual indication for hibernation wake is currently out of scope.
\end{itemize}

\item
\texttt{HideAuxiliary}\\
\textbf{Type}: \texttt{plist\ boolean}\\
Expand Down Expand Up @@ -3604,25 +3620,9 @@ \subsection{Boot Properties}\label{miscbootprops}

\item
\texttt{ShowPicker}\\
\textbf{Type}: \texttt{plist\ string}\\
\textbf{Failsafe}: \texttt{Always}\\
\textbf{Description}: Show a simple picker to allow boot entry selection:
\begin{itemize}
\tightlist
\item \texttt{Always} --- Always show picker.
\item \texttt{Never} --- Never show picker.
\item \texttt{SkipOnHibernateWake} --- Like \texttt{Always}, however doesn't show picker if waking from macOS hibernation.
\end{itemize}

Notes for \texttt{SkipOnHibernateWake}:
\begin{itemize}
\item Only supports macOS hibernation wake, Windows and Linux are currently out of scope.
\item Should only be used on systems with reliable hibernation wake in macOS, otherwise users may not
be able to visually see boot loops that may occur.
\item Highly recommended to pair this option with \texttt{PollAppleHotKeys}, allows to enter picker in
case of issues with hibernation wake.
\item Visual indication for hibernation wake is currently out of scope.
\end{itemize}
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
\textbf{Description}: Show a simple picker to allow boot entry selection.

\item
\texttt{TakeoffDelay}\\
Expand Down
Binary file modified Docs/Differences/Differences.pdf
Binary file not shown.
47 changes: 23 additions & 24 deletions Docs/Differences/Differences.tex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Sun Nov 20 12:50:09 2022
%DIF ADD ../Configuration.tex Sun Dec 4 19:13:10 2022
%DIF ADD ../Configuration.tex Tue Dec 6 01:39:25 2022

\usepackage{lmodern}
\usepackage{amssymb,amsmath}
Expand Down Expand Up @@ -3389,7 +3389,24 @@ \subsection{Boot Properties}\label{miscbootprops}
then \texttt{None} should be specified to hand-off hibernation state as is to OpenCore.

\item
\texttt{HideAuxiliary}\\
\DIFaddbegin \texttt{\DIFadd{HibernateSkipsPicker}}\\
\textbf{\DIFadd{Type}}\DIFadd{: }\texttt{\DIFadd{plist\ boolean}}\\
\textbf{\DIFadd{Failsafe}}\DIFadd{: }\texttt{\DIFadd{false}}\\
\textbf{\DIFadd{Description}}\DIFadd{: Do not show picker if waking from macOS hibernation.
}

\DIFadd{Limitations:
}\begin{itemize}
\item \DIFadd{Only supports macOS hibernation wake, Windows and Linux are currently out of scope.
}\item \DIFadd{Should only be used on systems with reliable hibernation wake in macOS, otherwise users may not
be able to visually see boot loops that may occur.
}\item \DIFadd{Highly recommended to pair this option with }\texttt{\DIFadd{PollAppleHotKeys}}\DIFadd{, allows to enter picker in
case of issues with hibernation wake.
}\item \DIFadd{Visual indication for hibernation wake is currently out of scope.
}\end{itemize}

\item
\DIFaddend \texttt{HideAuxiliary}\\
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
\textbf{Description}: Set to \texttt{true} to hide auxiliary entries from the picker menu.
Expand Down Expand Up @@ -3664,30 +3681,12 @@ \subsection{Boot Properties}\label{miscbootprops}

\item
\texttt{ShowPicker}\\
\textbf{Type}: \texttt{plist\ \DIFdelbegin \DIFdel{boolean}\DIFdelend \DIFaddbegin \DIFadd{string}\DIFaddend }\\
\textbf{Failsafe}: \texttt{\DIFdelbegin \DIFdel{false}\DIFdelend \DIFaddbegin \DIFadd{Always}\DIFaddend }\\
\textbf{Description}: Show a simple picker to allow boot entry selection\DIFdelbegin \DIFdel{.
}\DIFdelend \DIFaddbegin \DIFadd{:
}\begin{itemize}
\tightlist
\item \texttt{\DIFadd{Always}} \DIFadd{--- Always show picker.
}\item \texttt{\DIFadd{Never}} \DIFadd{--- Never show picker.
}\item \texttt{\DIFadd{SkipOnHibernateWake}} \DIFadd{--- Like }\texttt{\DIFadd{Always}}\DIFadd{, however doesn't show picker if waking from macOS hibernation.
}\end{itemize}
\DIFaddend

\DIFaddbegin \DIFadd{Notes for }\texttt{\DIFadd{SkipOnHibernateWake}}\DIFadd{:
}\begin{itemize}
\DIFaddend \item \DIFaddbegin \DIFadd{Only supports macOS hibernation wake, Windows and Linux are currently out of scope.
}\item \DIFadd{Should only be used on systems with reliable hibernation wake in macOS, otherwise users may not
be able to visually see boot loops that may occur.
}\item \DIFadd{Highly recommended to pair this option with }\texttt{\DIFadd{PollAppleHotKeys}}\DIFadd{, allows to enter picker in
case of issues with hibernation wake.
}\item \DIFadd{Visual indication for hibernation wake is currently out of scope.
}\end{itemize}
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
\textbf{Description}: Show a simple picker to allow boot entry selection.

\item
\DIFaddend \texttt{TakeoffDelay}\\
\texttt{TakeoffDelay}\\
\textbf{Type}: \texttt{plist\ integer}, 32 bit\\
\textbf{Failsafe}: \texttt{0}\\
\textbf{Description}: Delay in microseconds executed before handling
Expand Down
Binary file modified Docs/Errata/Errata.pdf
Binary file not shown.
4 changes: 3 additions & 1 deletion Docs/Sample.plist
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,8 @@
<integer>0</integer>
<key>HibernateMode</key>
<string>None</string>
<key>HibernateSkipsPicker</key>
<false/>
<key>HideAuxiliary</key>
<true/>
<key>LauncherOption</key>
Expand All @@ -1077,7 +1079,7 @@
<key>PollAppleHotKeys</key>
<false/>
<key>ShowPicker</key>
<string>Always</string>
<true/>
<key>TakeoffDelay</key>
<integer>0</integer>
<key>Timeout</key>
Expand Down
4 changes: 3 additions & 1 deletion Docs/SampleCustom.plist
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,8 @@
<integer>0</integer>
<key>HibernateMode</key>
<string>None</string>
<key>HibernateSkipsPicker</key>
<false/>
<key>HideAuxiliary</key>
<true/>
<key>LauncherOption</key>
Expand All @@ -1077,7 +1079,7 @@
<key>PollAppleHotKeys</key>
<false/>
<key>ShowPicker</key>
<string>Always</string>
<true/>
<key>TakeoffDelay</key>
<integer>0</integer>
<key>Timeout</key>
Expand Down
3 changes: 2 additions & 1 deletion Include/Acidanthera/Library/OcConfigurationLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,10 @@ OC_DECLARE (OC_MISC_BLESS_ARRAY)
_(UINT32 , TakeoffDelay , , 0 , ()) \
_(UINT32 , Timeout , , 0 , ()) \
_(BOOLEAN , PickerAudioAssist , , FALSE , ()) \
_(BOOLEAN , HibernateSkipsPicker , , FALSE , ()) \
_(BOOLEAN , HideAuxiliary , , FALSE , ()) \
_(BOOLEAN , PollAppleHotKeys , , FALSE , ()) \
_(OC_STRING , ShowPicker , , OC_STRING_CONSTR ("Always", _, __) , OC_DESTR (OC_STRING) )
_(BOOLEAN , ShowPicker , , FALSE , ())
OC_DECLARE (OC_MISC_BOOT)

#define OC_MISC_DEBUG_FIELDS(_, __) \
Expand Down
27 changes: 14 additions & 13 deletions Library/OcConfigurationLib/OcConfigurationLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,19 +405,20 @@ OC_SCHEMA
STATIC
OC_SCHEMA
mMiscConfigurationBootSchema[] = {
OC_SCHEMA_INTEGER_IN ("ConsoleAttributes", OC_GLOBAL_CONFIG, Misc.Boot.ConsoleAttributes),
OC_SCHEMA_STRING_IN ("HibernateMode", OC_GLOBAL_CONFIG, Misc.Boot.HibernateMode),
OC_SCHEMA_BOOLEAN_IN ("HideAuxiliary", OC_GLOBAL_CONFIG, Misc.Boot.HideAuxiliary),
OC_SCHEMA_STRING_IN ("LauncherOption", OC_GLOBAL_CONFIG, Misc.Boot.LauncherOption),
OC_SCHEMA_STRING_IN ("LauncherPath", OC_GLOBAL_CONFIG, Misc.Boot.LauncherPath),
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_STRING_IN ("ShowPicker", OC_GLOBAL_CONFIG, Misc.Boot.ShowPicker),
OC_SCHEMA_INTEGER_IN ("TakeoffDelay", OC_GLOBAL_CONFIG, Misc.Boot.TakeoffDelay),
OC_SCHEMA_INTEGER_IN ("Timeout", OC_GLOBAL_CONFIG, Misc.Boot.Timeout),
OC_SCHEMA_INTEGER_IN ("ConsoleAttributes", OC_GLOBAL_CONFIG, Misc.Boot.ConsoleAttributes),
OC_SCHEMA_STRING_IN ("HibernateMode", OC_GLOBAL_CONFIG, Misc.Boot.HibernateMode),
OC_SCHEMA_BOOLEAN_IN ("HibernateSkipsPicker", OC_GLOBAL_CONFIG, Misc.Boot.HibernateSkipsPicker),
OC_SCHEMA_BOOLEAN_IN ("HideAuxiliary", OC_GLOBAL_CONFIG, Misc.Boot.HideAuxiliary),
OC_SCHEMA_STRING_IN ("LauncherOption", OC_GLOBAL_CONFIG, Misc.Boot.LauncherOption),
OC_SCHEMA_STRING_IN ("LauncherPath", OC_GLOBAL_CONFIG, Misc.Boot.LauncherPath),
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),
OC_SCHEMA_INTEGER_IN ("Timeout", OC_GLOBAL_CONFIG, Misc.Boot.Timeout),
};

STATIC
Expand Down
14 changes: 2 additions & 12 deletions Library/OcMainLib/OpenCoreMisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,6 @@ OcMiscBoot (
CONST CHAR8 *AsciiPicker;
CONST CHAR8 *AsciiPickerVariant;
CONST CHAR8 *AsciiDmg;
CONST CHAR8 *ShowPicker;

AsciiPicker = OC_BLOB_GET (&Config->Misc.Boot.PickerMode);

Expand Down Expand Up @@ -930,20 +929,11 @@ OcMiscBoot (
&Context->RecoveryInitiator
);

ShowPicker = OC_BLOB_GET (&Config->Misc.Boot.ShowPicker);
if ( (AsciiStrCmp (ShowPicker, "Always") != 0)
&& (AsciiStrCmp (ShowPicker, "SkipOnHibernateWake") != 0)
&& (AsciiStrCmp (ShowPicker, "Never") != 0))
{
DEBUG ((DEBUG_WARN, "OC: Unknown ShowPicker: %a, using Always\n", ShowPicker));
ShowPicker = "Always";
}

if (!EFI_ERROR (Status)) {
Context->PickerCommand = OcPickerBootAppleRecovery;
} else if (AsciiStrCmp (ShowPicker, "Always") == 0) {
} else if (Config->Misc.Boot.ShowPicker && !Config->Misc.Boot.HibernateSkipsPicker) {
Context->PickerCommand = OcPickerShowPicker;
} else if (AsciiStrCmp (ShowPicker, "SkipOnHibernateWake") == 0) {
} else if (Config->Misc.Boot.ShowPicker && Config->Misc.Boot.HibernateSkipsPicker) {
if (OcIsAppleHibernateWake ()) {
Context->PickerCommand = OcPickerDefault;
} else {
Expand Down
10 changes: 0 additions & 10 deletions Utilities/ocvalidate/ValidateMisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ CheckMiscBoot (
BOOLEAN IsAudioSupportEnabled;
CONST CHAR8 *LauncherOption;
CONST CHAR8 *LauncherPath;
CONST CHAR8 *ShowPicker;

ErrorCount = 0;

Expand Down Expand Up @@ -254,15 +253,6 @@ CheckMiscBoot (
++ErrorCount;
}

ShowPicker = OC_BLOB_GET (&Config->Misc.Boot.ShowPicker);
if ( (AsciiStrCmp (ShowPicker, "Always") != 0)
&& (AsciiStrCmp (ShowPicker, "SkipOnHibernateWake") != 0)
&& (AsciiStrCmp (ShowPicker, "Never") != 0))
{
DEBUG ((DEBUG_WARN, "Misc->Boot->ShowPicker is borked (Can only be Always, SkipOnHibernateWake, or Never)!\n"));
++ErrorCount;
}

//
// Check the length of path relative to OC directory.
//
Expand Down

0 comments on commit 10fc98f

Please sign in to comment.