This commit is contained in:
vectorsigma72 2020-04-10 19:01:45 +02:00
commit 0a65180438
6 changed files with 50 additions and 20 deletions

View File

@ -20,6 +20,8 @@
**/
#include "Platform.h"
#include "../../Version.h"
#ifdef __cplusplus
extern "C" {
#include <Library/PrintLib.h>
@ -1099,7 +1101,11 @@ VOID PatchTableType11()
// AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.EfiVersion, iStrLen(gSettings.EfiVersion, 64));
AsciiStrCatS(OEMString, MAX_OEM_STRING, " Board-ID : ");
AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.BoardNumber, iStrLen(gSettings.BoardNumber, 64));
snprintf(TempRev, MAX_OEM_STRING, "\n⌘ Powered by Clover %ls\n", gFirmwareRevision);
#ifdef REVISION_STR
snprintf(TempRev, MAX_OEM_STRING, "\n⌘ Powered by %s\n", REVISION_STR);
#else
snprintf(TempRev, MAX_OEM_STRING, "\n⌘ Powered by Clover %s\n", gFirmwareRevision);
#endif
AsciiStrCatS(OEMString, MAX_OEM_STRING, TempRev);
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type11->StringCount, OEMString);

View File

@ -48,6 +48,9 @@
#define DBG(...) DebugLog(DEBUG_COMMON_MENU, __VA_ARGS__)
#endif
extern CONST CHAR8* IconsNames[];
#if 0
static CONST CHAR16 *BuiltinIconNames[] = {
/*
L"About",
@ -89,6 +92,7 @@ EG_IMAGE *LoadBuiltinIcon(IN CONST CHAR16 *IconName)
}
return NULL;
}
#endif
const XImage& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
@ -145,9 +149,10 @@ const XImage& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EF
IconNum = BUILTIN_ICON_VOL_INTERNAL;
break;
}
IconX = &ThemeX.GetIcon(IconNum);
// DBG("asked IconNum = %llu Volume->DiskKind=%d OSType=%d\n", IconNum, Volume->DiskKind, OSType);
IconX = &ThemeX.GetIcon(IconNum); //asked IconNum = BUILTIN_ICON_VOL_INTERNAL_HFS, got day icon
if (IconX->isEmpty()) {
DBG("asked IconNum = %llu not found, took internal\n", IconNum);
DBG("asked Icon %s not found, took internal\n", IconsNames[IconNum]);
IconX = &ThemeX.GetIcon(BUILTIN_ICON_VOL_INTERNAL); //including embedded which is really present
}

View File

@ -477,7 +477,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
return NULL;
}
}
// DBG("OSType =%d\n", OSType);
if (!CustomEntry) {
CUSTOM_LOADER_ENTRY *Custom;
UINTN CustomIndex = 0;
@ -573,7 +573,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
++CustomIndex;
}
}
// DBG("prepare the menu entry\n");
// prepare the menu entry
// Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
Entry = new LOADER_ENTRY();
@ -595,7 +595,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
} else if ((AsciiStrLen(gSettings.BootArgs) > 0) && OSFLAG_ISUNSET(Flags, OSFLAG_NODEFAULTARGS)) {
Entry->LoadOptions = SPrintf("%s", gSettings.BootArgs);
}
//DBG("locate a custom icon \n");
// locate a custom icon for the loader
//StrCpy(IconFileName, Volume->OSIconName); Sothor - Unused?
//actions
@ -607,7 +607,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
Entry->LoaderType = OSType;
Entry->BuildVersion = NULL;
Entry->OSVersion = GetOSVersion(Entry);
//DBG("OSVersion=%s \n", Entry->OSVersion);
// detect specific loaders
OSIconName = NULL;
ShortcutLetter = 0;
@ -662,7 +662,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
Entry->LoaderType = OSTYPE_OTHER;
break;
}
//DBG("OSIconName=%ls \n", OSIconName);
Entry->Title = FullTitle;
if (Entry->Title.isEmpty() && Volume->VolLabel != NULL) {
if (Volume->VolLabel[0] == L'#') {
@ -675,7 +675,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
BOOLEAN BootCampStyle = ThemeX.BootCampStyle;
if ( Entry->Title.isEmpty() && ((Entry->VolName == NULL) || (StrLen(Entry->VolName) == 0)) ) {
//DBG("encounter Entry->VolName ==%ls and StrLen(Entry->VolName) ==%d\n",Entry->VolName, StrLen(Entry->VolName));
// DBG("encounter Entry->VolName ==%ls and StrLen(Entry->VolName) ==%llu\n",Entry->VolName, StrLen(Entry->VolName));
if (BootCampStyle) {
if (!LoaderTitle.isEmpty()) {
Entry->Title = LoaderTitle;
@ -687,8 +687,9 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
Basename(Volume->DevicePathString));
}
}
// DBG("check Entry->Title \n");
if ( Entry->Title.isEmpty() ) {
//DBG("encounter LoaderTitle ==%ls and Entry->VolName ==%ls\n", LoaderTitle, Entry->VolName);
// DBG("encounter LoaderTitle ==%ls and Entry->VolName ==%ls\n", LoaderTitle.wc_str(), Entry->VolName);
if (BootCampStyle) {
if ((StriCmp(LoaderTitle.wc_str(), L"macOS") == 0) || (StriCmp(LoaderTitle.wc_str(), L"Recovery") == 0)) {
Entry->Title.takeValueFrom(Entry->VolName);
@ -704,7 +705,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
Entry->VolName);
}
}
//DBG("Entry->Title =%ls\n", Entry->Title);
// DBG("Entry->Title =%ls\n", Entry->Title.wc_str());
// just an example that UI can show hibernated volume to the user
// should be better to show it on entry image
if (OSFLAG_ISSET(Entry->Flags, OSFLAG_HIBERNATED)) {
@ -722,22 +723,24 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
} else {
Entry->Image = ThemeX.LoadOSIcon(OSIconName);
}
// DBG("Load DriveImage\n");
// Load DriveImage
if (DriveImage) {
// DBG("DriveImage presents\n");
Entry->DriveImage = *DriveImage;
} else {
Entry->DriveImage = ScanVolumeDefaultIcon(Volume, Entry->LoaderType, Volume->DevicePath);
}
// DBG("HideBadges=%d Volume=%ls ", GlobalConfig.HideBadges, Volume->VolName);
// DBG("HideBadges=%llu Volume=%ls ", ThemeX.HideBadges, Volume->VolName);
if (ThemeX.HideBadges & HDBADGES_SHOW) {
if (ThemeX.HideBadges & HDBADGES_SWAP) {
// Entry->BadgeImage = egCopyScaledImage(Entry->DriveImage, ThemeX.BadgeScale);
Entry->BadgeImage = XImage(Entry->DriveImage, ThemeX.BadgeScale/16.f);
// DBG(" Show badge as Drive.");
DBG(" Show badge as Drive.");
} else {
Entry->BadgeImage = XImage(Entry->Image, ThemeX.BadgeScale/16.f);
// Entry->BadgeImage = egCopyScaledImage((Entry->Image).ToEGImage(), ThemeX.BadgeScale);
// DBG(" Show badge as OSImage.");
DBG(" Show badge as OSImage.");
}
}
Entry->BootBgColor = BootBgColor;
@ -746,7 +749,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
#ifdef DUMP_KERNEL_KEXT_PATCHES
DumpKernelAndKextPatches(Entry->KernelAndKextPatches);
#endif
// DBG("%sLoader entry created for '%ls'\n", indent, Entry->DevicePathString);
DBG("%sLoader entry created for '%ls'\n", indent, Entry->DevicePathString);
return Entry;
}

View File

@ -310,21 +310,26 @@ const XImage& XTheme::GetIcon(INTN Id)
if (Icons[i].Id == Id)
{
if (!Daylight && !Icons[i].ImageNight.isEmpty()) {
// DBG("got night icon %lld name{%s}\n", Id, IconsNames[Id]);
return Icons[i].ImageNight;
}
//if daylight or night icon absent
if (!Icons[i].Image.isEmpty()) {
// DBG("got day icon %lld name{%s}\n", Id, IconsNames[Id]);
return Icons[i].Image;
}
//if not found then create new one from embedded
Icon* NewIcon = new Icon(Id, true);
// NewIcon.GetEmbedded();
// DBG("got embedded icon %lld name{%s}\n", Id, IconsNames[Id]);
if (!Daylight && !NewIcon->ImageNight.isEmpty()) {
// DBG("got night icon and cache\n");
Icons[i].ImageNight = NewIcon->ImageNight; //
return NewIcon->ImageNight;
}
//if daylight or night icon absent
if (!NewIcon->Image.isEmpty()) {
// DBG("got day icon and cache\n");
Icons[i].Image = NewIcon->Image;
return NewIcon->Image;
}
@ -394,6 +399,14 @@ void XTheme::FillByEmbedded()
Icon* NewIcon = new Icon(i, true);
Icons.AddReference(NewIcon, true);
}
Background = XImage(UGAWidth, UGAHeight);
if (DarkEmbedded) {
Background.Fill(DarkEmbeddedBackgroundPixel);
} else {
Background.Fill(StdBackgroundPixel);
}
BigBack.setEmpty();
//and buttons
Buttons[0].FromPNG(ACCESS_EMB_DATA(emb_radio_button), ACCESS_EMB_SIZE(emb_radio_button));
Buttons[1].FromPNG(ACCESS_EMB_DATA(emb_radio_button_selected), ACCESS_EMB_SIZE(emb_radio_button_selected));

View File

@ -2872,9 +2872,12 @@ static void nsvg__parseText(NSVGparser* p, const char** dict)
NSVGparser *p1 = NULL;
EFI_STATUS Status;
DBG("required font %s not found, try to load external\n", text->fontFace->fontFamily);
Status = egLoadFile(ThemeX.ThemeDir, PoolPrint(L"%s.svg", text->fontFace->fontFamily), &FileData, &FileDataLength);
DBG("font %s loaded status=%s\n", text->fontFace->fontFamily, strerror(Status));
// CONST CHAR16 *FontFileName = PoolPrint(L"%a.svg", text->fontFace->fontFamily);
XStringW FontFileName = XStringW().takeValueFrom(text->fontFace->fontFamily) + L".svg"_XSW;
DBG(" file name =%ls\n", FontFileName.wc_str());
Status = egLoadFile(ThemeX.ThemeDir, FontFileName.wc_str(), &FileData, &FileDataLength);
// FreePool(FontFileName);
DBG(" font %s loaded status=%lld, %s\n", text->fontFace->fontFamily, Status, strerror(Status));
if (!EFI_ERROR(Status)) {
p1 = nsvgParse((CHAR8*)FileData, 72, 1.0f); //later we will free parser p1
if (!p1) {
@ -4293,7 +4296,7 @@ void nsvg__imageBounds(NSVGparser* p, float* bounds)
clipPath = clipPath->next;
}
count += nsvg__shapesBound(image->shapes, bounds);
DBG("found shapes=%d\n", count);
// DBG("found shapes=%d\n", count);
if (count == 0) {
bounds[0] = bounds[1] = 0.0f;
bounds[2] = bounds[3] = 1.0f;

View File

@ -1232,7 +1232,7 @@ VOID AboutRefit(VOID)
#ifdef REVISION_STR
AboutMenu.AddMenuInfo_f(" %s ", REVISION_STR);
#else
AboutMenu.AddMenuInfo_f((L"Clover Revision %s", gFirmwareRevision));
AboutMenu.AddMenuInfo_f("Clover Revision %s", gFirmwareRevision);
#endif
#ifdef FIRMWARE_BUILDDATE
AboutMenu.AddMenuInfo_f(" Build: %s", FIRMWARE_BUILDDATE);