Merge pull request #57 from jief666/BootAndVolumeInfo

Display Cover boot volume, Use .VolumeLabel.txt
This commit is contained in:
jief666 2019-12-18 23:45:55 +01:00 committed by GitHub
commit af35dcccbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 2 deletions

View File

@ -643,9 +643,28 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CHAR16 *LoaderPath,
break; break;
} }
Entry->me.Title = NULL;
if (FullTitle) { if (FullTitle) {
Entry->me.Title = EfiStrDuplicate(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)); //DBG("encounter Entry->VolName ==%s and StrLen(Entry->VolName) ==%d\n",Entry->VolName, StrLen(Entry->VolName));
if (GlobalConfig.BootCampStyle) { if (GlobalConfig.BootCampStyle) {
Entry->me.Title = PoolPrint(L"%s", ((LoaderTitle != NULL) ? LoaderTitle : Basename(Volume->DevicePathString))); 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), Entry->me.Title = PoolPrint(L"Boot %s from %s", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath),
Basename(Volume->DevicePathString)); Basename(Volume->DevicePathString));
} }
} else { }
if ( Entry->me.Title == NULL ) {
//DBG("encounter LoaderTitle ==%s and Entry->VolName ==%s\n", LoaderTitle, Entry->VolName); //DBG("encounter LoaderTitle ==%s and Entry->VolName ==%s\n", LoaderTitle, Entry->VolName);
if (GlobalConfig.BootCampStyle) { if (GlobalConfig.BootCampStyle) {
if ((StriCmp(LoaderTitle, L"macOS") == 0) || (StriCmp(LoaderTitle, L"Recovery") == 0)) { 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; break;
case MENU_FUNCTION_PAINT_ALL: 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++) { for (i = 0; i <= State->MaxIndex; i++) {
if (Screen->Entries[i]->Row == 0) { if (Screen->Entries[i]->Row == 0) {
if ((i >= State->FirstVisible) && (i <= State->LastVisible)) { if ((i >= State->FirstVisible) && (i <= State->LastVisible)) {