Display CLover boot volume

Use .VolumeLabel.txt to improve menu item label
This commit is contained in:
jief 2019-12-16 15:28:22 +01:00
parent 6c7ec5f7c5
commit 35eedf476a
2 changed files with 28 additions and 2 deletions

View File

@ -643,9 +643,28 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CHAR16 *LoaderPath,
break;
}
Entry->me.Title = NULL;
if (FullTitle) {
Entry->me.Title = EfiStrDuplicate(FullTitle);
} else if ((Entry->VolName == NULL) || (StrLen(Entry->VolName) == 0)) {
}
if ( Entry->me.Title == NULL && FileExists(Volume->RootDir, L"\\.VolumeLabel.txt") ) {
EFI_STATUS Status;
EFI_FILE_HANDLE FileHandle;
Status = Volume->RootDir->Open(Volume->RootDir, &FileHandle, L"\\.VolumeLabel.txt", EFI_FILE_MODE_READ, 0);
if (!EFI_ERROR(Status)) {
CHAR8 Buffer[32+1];
UINTN BufferSize = sizeof(Buffer)-sizeof(CHAR8);
SetMem(Buffer, BufferSize+sizeof(CHAR8), 0);
Status = FileHandle->Read(FileHandle, &BufferSize, Buffer);
FileHandle->Close(FileHandle);
if (!EFI_ERROR(Status)) {
Entry->me.Title = PoolPrint(L"Boot %s from %a", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath), Buffer);
}
}
}
if ( Entry->me.Title == NULL && ((Entry->VolName == NULL) || (StrLen(Entry->VolName) == 0)) ) {
//DBG("encounter Entry->VolName ==%s and StrLen(Entry->VolName) ==%d\n",Entry->VolName, StrLen(Entry->VolName));
if (GlobalConfig.BootCampStyle) {
Entry->me.Title = PoolPrint(L"%s", ((LoaderTitle != NULL) ? LoaderTitle : Basename(Volume->DevicePathString)));
@ -653,7 +672,8 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CHAR16 *LoaderPath,
Entry->me.Title = PoolPrint(L"Boot %s from %s", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath),
Basename(Volume->DevicePathString));
}
} else {
}
if ( Entry->me.Title == NULL ) {
//DBG("encounter LoaderTitle ==%s and Entry->VolName ==%s\n", LoaderTitle, Entry->VolName);
if (GlobalConfig.BootCampStyle) {
if ((StriCmp(LoaderTitle, L"macOS") == 0) || (StriCmp(LoaderTitle, L"Recovery") == 0)) {

View File

@ -4214,6 +4214,12 @@ VOID MainMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, IN UINT
break;
case MENU_FUNCTION_PAINT_ALL:
{
// Display Clover boot volume
CHAR16 line[256];
UnicodeSPrint(line, 255, L"Clover booted from %s", SelfVolume->VolName);
DrawTextXY(line, 100, 50, X_IS_LEFT);
}
for (i = 0; i <= State->MaxIndex; i++) {
if (Screen->Entries[i]->Row == 0) {
if ((i >= State->FirstVisible) && (i <= State->LastVisible)) {