diff --git a/Docs/Configuration.tex b/Docs/Configuration.tex index c0c3084f..bf9fc68c 100755 --- a/Docs/Configuration.tex +++ b/Docs/Configuration.tex @@ -2438,20 +2438,38 @@ entry choice will update till next manual reconfiguration. \tightlist \item \texttt{0x0001} --- \texttt{OC\_ATTR\_USE\_VOLUME\_ICON}, provides custom icons for boot entries: + + For \texttt{Tools} OpenCore will try to load a custom icon and fallback to the default icon: \begin{itemize} - \tightlist + \tightlist + \item \texttt{ResetNVRAM} --- \texttt{Resources\textbackslash Image\textbackslash ResetNVRAM.icns} + --- \texttt{ResetNVRAM.icns} from icons directory. + \item \texttt{Tools\textbackslash .icns} + --- icon near the tool file with appended \texttt{.icns} extension. + \end{itemize} \medskip + + For custom boot \texttt{Entries} OpenCore will try to load a custom icon and fallback + to the volume icon or the default icon: + \begin{itemize} + \tightlist + \item \texttt{.icns} --- icon near the entry file with appended \texttt{.icns} extension. + \end{itemize} \medskip + + For all other entries OpenCore will try to load a volume icon and fallback to the default icon: + \begin{itemize} + \tightlist \item \texttt{.VolumeIcon.icns} file at \texttt{Preboot} root for APFS. \item \texttt{.VolumeIcon.icns} file at volume root for other filesystems. - \item \texttt{.icns} file for \texttt{Tools}. - \end{itemize} + \end{itemize} \medskip + Volume icons can be set in Finder. Note, that enabling this may result in external and internal icons to be indistinguishable. \item \texttt{0x0002} --- \texttt{OC\_ATTR\_USE\_DISK\_LABEL\_FILE}, provides custom rendered titles for boot entries: \begin{itemize} - \tightlist + \tightlist \item \texttt{.disk\_label} (\texttt{.disk\_label\_2x}) file near bootloader for all filesystems. - \item \texttt{.lbl} (\texttt{.l2x}) file near tool for \texttt{Tools}. \end{itemize} Prerendered labels can be generated via \texttt{disklabel} utility or \texttt{bless} command. When disabled or missing text labels (\texttt{.contentDetails} or \texttt{.disk\_label.contentDetails}) diff --git a/Library/OcBootManagementLib/BootEntryInfo.c b/Library/OcBootManagementLib/BootEntryInfo.c index 86c65852..10684676 100644 --- a/Library/OcBootManagementLib/BootEntryInfo.c +++ b/Library/OcBootManagementLib/BootEntryInfo.c @@ -432,7 +432,7 @@ OcGetBootEntryIcon ( NULL ); - DEBUG ((DEBUG_INFO, "Get custom icon %s - %r\n", BootEntry->Name, Status)); + DEBUG ((DEBUG_INFO, "OCB: OcGetBootEntryIcon - %s (tool) - %r\n", BootEntry->Name, Status)); return Status; } @@ -459,6 +459,29 @@ OcGetBootEntryIcon ( return Status; } + if (BootEntry->Type == OC_BOOT_EXTERNAL_OS && BootEntry->PathName != NULL) { + // + // Try to load the icon from the same path with appended .icns extension. + // + Status = InternalGetAppleImage ( + FileSystem, + BootEntry->PathName, + L".icns", + ImageData, + DataLength + ); + + DEBUG ((DEBUG_INFO, "OCB: OcGetBootEntryIcon - %s (custom entry) - %r\n", BootEntry->Name, Status)); + + // + // Return early if custom icon was loaded successfully. + // + if(!EFI_ERROR (Status)) { + FreePool (BootDirectoryName); + return Status; + } + } + Status = InternalGetAppleImage ( FileSystem, L"", @@ -467,7 +490,7 @@ OcGetBootEntryIcon ( DataLength ); - DEBUG ((DEBUG_INFO, "OCB: Get normal icon %s - %r\n", BootEntry->Name, Status)); + DEBUG ((DEBUG_INFO, "OCB: OcGetBootEntryIcon - %s (volume icon) - %r\n", BootEntry->Name, Status)); FreePool (BootDirectoryName);