using XIcon class for dynamic images

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2020-05-16 22:30:29 +03:00
parent 813b0d22cc
commit 22f9adcbc9
25 changed files with 333 additions and 376 deletions

View File

@ -352,7 +352,7 @@ IsLangInSupportedLangCodes(
if (Iso639Language) {
CompareLength = ISO_639_2_ENTRY_SIZE;
for (Index = 0; Index < AsciiStrLen(SupportedLang); Index += CompareLength) {
if (AsciiStrnCmp (Lang, SupportedLang + Index, CompareLength) == 0) {
if (AsciiStrnCmp(Lang, SupportedLang + Index, CompareLength) == 0) {
//
// Successfully find the Lang string in SupportedLang string.
//
@ -377,7 +377,7 @@ IsLangInSupportedLangCodes(
for (CompareLength = 0; SupportedLang[CompareLength] != '\0' && SupportedLang[CompareLength] != ';'; CompareLength++);
if ((CompareLength == LanguageLength) &&
(AsciiStrnCmp (Lang, SupportedLang, CompareLength) == 0)) {
(AsciiStrnCmp(Lang, SupportedLang, CompareLength) == 0)) {
//
// Successfully find the Lang string in SupportedLang string.
//

View File

@ -748,8 +748,8 @@ BuildEdd30DevicePath (
Controller = (UINT32) Drive->Parameters.InterfacePath.Pci.Controller;
ZeroMem (&Node, sizeof (Node));
if ((AsciiStrnCmp ("ATAPI", Drive->Parameters.InterfaceType, 5) == 0) ||
(AsciiStrnCmp ("ATA", Drive->Parameters.InterfaceType, 3) == 0)
if ((strncmp("ATAPI", Drive->Parameters.InterfaceType, 5) == 0) ||
(strncmp("ATA", Drive->Parameters.InterfaceType, 3) == 0)
) {
//
// ATA or ATAPI drive found
@ -777,7 +777,7 @@ BuildEdd30DevicePath (
ZeroMem (&Node, sizeof (Node));
#endif
if (AsciiStrnCmp ("SCSI", Drive->Parameters.InterfaceType, 4) == 0) {
if (strncmp("SCSI", Drive->Parameters.InterfaceType, 4) == 0) {
//
// SCSI drive
//
@ -792,7 +792,7 @@ BuildEdd30DevicePath (
CopyMem(&Node.Scsi.Lun, &Drive->Parameters.DevicePath.Scsi.Lun, sizeof (UINT16));
Node.Scsi.Pun = Drive->Parameters.DevicePath.Scsi.Pun;
} else if (AsciiStrnCmp ("USB", Drive->Parameters.InterfaceType, 3) == 0) {
} else if (strncmp("USB", Drive->Parameters.InterfaceType, 3) == 0) {
//
// USB drive
//
@ -802,7 +802,7 @@ BuildEdd30DevicePath (
Node.Usb.ParentPortNumber = Drive->Number; //(UINT8) Drive->Parameters.DevicePath.Usb.Reserved;
Node.Usb.InterfaceNumber = (UINT8) Drive->Parameters.DevicePath.Usb.SerialNumber;
} else if (AsciiStrnCmp ("1394", Drive->Parameters.InterfaceType, 4) == 0) {
} else if (strncmp("1394", Drive->Parameters.InterfaceType, 4) == 0) {
//
// 1394 drive
//
@ -811,7 +811,7 @@ BuildEdd30DevicePath (
SetDevicePathNodeLength (&Node.F1394.Header, sizeof (F1394_DEVICE_PATH));
Node.F1394.Guid = Drive->Parameters.DevicePath.FireWire.Guid;
} else if (AsciiStrnCmp ("FIBRE", Drive->Parameters.InterfaceType, 5) == 0) {
} else if (strncmp("FIBRE", Drive->Parameters.InterfaceType, 5) == 0) {
//
// Fibre drive
//

View File

@ -474,20 +474,20 @@ DumpDeviceTreeNodeRecusively (
break;
}
if (AsciiStrnCmp (PropertyName, "name", 4) == 0) {
if (AsciiStrnCmp(PropertyName, "name", 4) == 0) {
DEBUG ((DEBUG_INFO, "+%*ao %a\n", mDTNodeDepth * Spacer, "-", PropertyValue, mDTNodeDepth));
DEBUG ((DEBUG_INFO, "|%*a\n", mDTNodeDepth * Spacer, " {" , mDTNodeDepth));
PropertyParent = PropertyValue;
mDTNodeDepth++;
} else if (AsciiStrnCmp (PropertyName, "guid", 4) == 0) {
} else if (AsciiStrnCmp(PropertyName, "guid", 4) == 0) {
//
// Show Guid.
//
DEBUG ((DEBUG_INFO, "|%*a \"%a\" = < %g >\n", mDTNodeDepth * Spacer, " ", PropertyName, PropertyValue, PropertySize));
} else if (AsciiStrnCmp (PropertyParent, "memory-map", 10) == 0) {
} else if (AsciiStrnCmp(PropertyParent, "memory-map", 10) == 0) {
MemMap = (DTMemMapEntry *)PropertyValue;
if (AsciiStrnCmp (PropertyName, "Driver-", 7) == 0) {
if (AsciiStrnCmp(PropertyName, "Driver-", 7) == 0) {
Kext = (DTBooterKextFileInfo *)(UINTN)MemMap->Address;
if (Kext != NULL && Kext->ExecutablePhysAddr != 0) {

View File

@ -619,7 +619,7 @@ LoadUserSettings (
return Status;
}
STATIC BOOLEAN AddCustomEntry (IN CUSTOM_LOADER_ENTRY *Entry)
STATIC BOOLEAN AddCustomLoaderEntry(IN CUSTOM_LOADER_ENTRY *Entry)
{
if (Entry == NULL) {
return FALSE;
@ -638,6 +638,7 @@ STATIC BOOLEAN AddCustomEntry (IN CUSTOM_LOADER_ENTRY *Entry)
return TRUE;
}
STATIC BOOLEAN AddCustomLegacyEntry (IN CUSTOM_LEGACY_ENTRY *Entry)
{
if (Entry == NULL) {
@ -1938,7 +1939,9 @@ FillinCustomEntry (
UINTN DataLen = 0;
UINT8 *TmpData = GetDataSetting (DictPointer, "ImageData", &DataLen);
if (TmpData) {
Entry->Image.FromPNG(TmpData, DataLen);
if (!EFI_ERROR(Entry->Image.Image.FromPNG(TmpData, DataLen))) {
Entry->Image.setFilled();
}
FreePool(TmpData);
}
}
@ -1958,7 +1961,9 @@ FillinCustomEntry (
UINTN DataLen = 0;
UINT8 *TmpData = GetDataSetting (DictPointer, "ImageData", &DataLen);
if (TmpData) {
Entry->DriveImage.FromPNG(TmpData, DataLen);
if (!EFI_ERROR(Entry->DriveImage.Image.FromPNG(TmpData, DataLen))) {
Entry->DriveImage.setFilled();
}
FreePool(TmpData);
}
}
@ -2243,7 +2248,9 @@ FillingCustomLegacy (
UINTN DataLen = 0;
UINT8 *TmpData = GetDataSetting (DictPointer, "ImageData", &DataLen);
if (TmpData) {
Entry->Image.FromPNG(TmpData, DataLen);
if (!EFI_ERROR(Entry->Image.Image.FromPNG(TmpData, DataLen))) {
Entry->Image.setFilled();
}
FreePool(TmpData);
}
}
@ -2257,7 +2264,9 @@ FillingCustomLegacy (
UINTN DataLen = 0;
UINT8 *TmpData = GetDataSetting (DictPointer, "DriveImageData", &DataLen);
if (TmpData) {
Entry->DriveImage.FromPNG(TmpData, DataLen);
if (!EFI_ERROR(Entry->DriveImage.Image.FromPNG(TmpData, DataLen))) {
Entry->DriveImage.setFilled();
}
FreePool(TmpData);
}
}
@ -2358,7 +2367,9 @@ FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY *Entry, TagPtr DictPointer)
UINTN DataLen = 0;
UINT8 *TmpData = GetDataSetting (DictPointer, "ImageData", &DataLen);
if (TmpData) {
Entry->Image.FromPNG(TmpData, DataLen);
if (!EFI_ERROR(Entry->Image.Image.FromPNG(TmpData, DataLen))) {
Entry->Image.setFilled();
}
FreePool(TmpData);
}
}
@ -3037,7 +3048,7 @@ GetEarlyUserSettings (
CUSTOM_LOADER_ENTRY* Entry = new CUSTOM_LOADER_ENTRY;
// Fill it in
if (Entry != NULL && (!FillinCustomEntry(Entry, Dict3, FALSE) || !AddCustomEntry(Entry))) {
if (Entry != NULL && (!FillinCustomEntry(Entry, Dict3, FALSE) || !AddCustomLoaderEntry(Entry))) {
delete Entry;
}
}

View File

@ -93,8 +93,8 @@ typedef struct CUSTOM_LOADER_ENTRY CUSTOM_LOADER_ENTRY;
struct CUSTOM_LOADER_ENTRY {
CUSTOM_LOADER_ENTRY *Next;
CUSTOM_LOADER_ENTRY *SubEntries;
XImage Image;
XImage DriveImage;
XIcon Image;
XIcon DriveImage;
CONST CHAR16 *ImagePath;
CONST CHAR16 *DriveImagePath;
CONST CHAR16 *Volume;
@ -128,8 +128,8 @@ struct CUSTOM_LOADER_ENTRY {
typedef struct CUSTOM_LEGACY_ENTRY CUSTOM_LEGACY_ENTRY;
struct CUSTOM_LEGACY_ENTRY {
CUSTOM_LEGACY_ENTRY *Next;
XImage Image;
XImage DriveImage;
XIcon Image;
XIcon DriveImage;
CONST CHAR16 *ImagePath;
CONST CHAR16 *DriveImagePath;
CONST CHAR16 *Volume;
@ -144,7 +144,7 @@ struct CUSTOM_LEGACY_ENTRY {
typedef struct CUSTOM_TOOL_ENTRY CUSTOM_TOOL_ENTRY;
struct CUSTOM_TOOL_ENTRY {
CUSTOM_TOOL_ENTRY *Next;
XImage Image;
XIcon Image;
CHAR16 *ImagePath;
CHAR16 *Volume;
XStringW Path;

View File

@ -213,7 +213,7 @@ VOID GetCPUProperties (VOID)
}
AsciiStrnCpyS(gCPUStructure.BrandString, 48, s, 48);
if (!AsciiStrnCmp((const CHAR8*)gCPUStructure.BrandString, (const CHAR8*)CPU_STRING_UNKNOWN, iStrLen((gCPUStructure.BrandString) + 1, 48)))
if (!strncmp((const CHAR8*)gCPUStructure.BrandString, (const CHAR8*)CPU_STRING_UNKNOWN, iStrLen((gCPUStructure.BrandString) + 1, 48)))
{
gCPUStructure.BrandString[0] = '\0';
}

View File

@ -106,18 +106,12 @@ BOOLEAN checkOSBundleRequired(UINT8 loaderType, TagPtr dict)
else
osbundlerequired[0] = '\0';
if (OSTYPE_IS_OSX_RECOVERY(loaderType)) {
if (AsciiStrnCmp(osbundlerequired, "root", 4) &&
AsciiStrnCmp(osbundlerequired, "local", 5) &&
AsciiStrnCmp(osbundlerequired, "console", 7) &&
AsciiStrnCmp(osbundlerequired, "network-root", 12)) {
inject = FALSE;
}
} else if (OSTYPE_IS_OSX_INSTALLER(loaderType)) {
if (AsciiStrnCmp(osbundlerequired, "root", 4) &&
AsciiStrnCmp(osbundlerequired, "local", 5) &&
AsciiStrnCmp(osbundlerequired, "console", 7) &&
AsciiStrnCmp(osbundlerequired, "network-root", 12)) {
if (OSTYPE_IS_OSX_RECOVERY(loaderType) ||
OSTYPE_IS_OSX_INSTALLER(loaderType)) {
if (strncmp(osbundlerequired, "root", 4) &&
strncmp(osbundlerequired, "local", 5) &&
strncmp(osbundlerequired, "console", 7) &&
strncmp(osbundlerequired, "network-root", 12)) {
inject = FALSE;
}
}
@ -128,7 +122,7 @@ BOOLEAN checkOSBundleRequired(UINT8 loaderType, TagPtr dict)
//extern VOID KernelAndKextPatcherInit(IN LOADER_ENTRY *Entry);
//extern VOID AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, INT32 N, LOADER_ENTRY *Entry);
EFI_STATUS EFIAPI LOADER_ENTRY::LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType, IN OUT VOID *kext_v)
EFI_STATUS LOADER_ENTRY::LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType, IN OUT VOID *kext_v)
{
EFI_STATUS Status;
UINT8* infoDictBuffer = NULL;
@ -225,7 +219,7 @@ EFI_STATUS EFIAPI LOADER_ENTRY::LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileNa
return EFI_SUCCESS;
}
EFI_STATUS EFIAPI LOADER_ENTRY::AddKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType)
EFI_STATUS LOADER_ENTRY::AddKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType)
{
EFI_STATUS Status;
KEXT_ENTRY *KextEntry;
@ -787,7 +781,7 @@ EFI_STATUS LOADER_ENTRY::InjectKexts(IN UINT32 deviceTreeP, IN UINT32* deviceTre
while(!EFI_ERROR(DTIterateProperties(iter, &ptr))) {
prop = iter->CurrentProperty;
drvPtr = (UINT8*) prop;
if(AsciiStrnCmp(prop->Name, "Driver-", 7)==0 || AsciiStrnCmp(prop->Name, "DriversPackage-", 15)==0) {
if(strncmp(prop->Name, "Driver-", 7)==0 || strncmp(prop->Name, "DriversPackage-", 15)==0) {
break;
}
}
@ -798,10 +792,10 @@ EFI_STATUS LOADER_ENTRY::InjectKexts(IN UINT32 deviceTreeP, IN UINT32* deviceTre
if(!EFI_ERROR(DTCreatePropertyIterator(platformEntry, iter))) {
while(!EFI_ERROR(DTIterateProperties(iter, &ptr))) {
prop = iter->CurrentProperty;
if(AsciiStrnCmp(prop->Name, "mm_extra", 8)==0) {
if(strncmp(prop->Name, "mm_extra", 8)==0) {
infoPtr = (UINT8*)prop;
}
if(AsciiStrnCmp(prop->Name, "extra", 5)==0) {
if(strncmp(prop->Name, "extra", 5)==0) {
extraPtr = (UINT8*)prop;
}
}

View File

@ -253,17 +253,17 @@ VOID ExtractKextBundleIdentifier(CHAR8 *Plist)
while (*Tag != '\0') {
if (AsciiStrnCmp(Tag, "<dict>", 6) == 0) {
if (strncmp(Tag, "<dict>", 6) == 0) {
// opening dict
DictLevel++;
Tag += 6;
} else if (AsciiStrnCmp(Tag, "</dict>", 7) == 0) {
} else if (strncmp(Tag, "</dict>", 7) == 0) {
// closing dict
DictLevel--;
Tag += 7;
} else if (DictLevel == 1 && AsciiStrnCmp(Tag, "<key>CFBundleIdentifier</key>", 29) == 0) {
} else if (DictLevel == 1 && strncmp(Tag, "<key>CFBundleIdentifier</key>", 29) == 0) {
// BundleIdentifier is next <string>...</string>
BIStart = AsciiStrStr(Tag + 29, "<string>");
if (BIStart != NULL) {

View File

@ -2373,7 +2373,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
version_start++;
// strip "Version "
if (AsciiStrnCmp((const CHAR8*)rom + version_start, "Version ", 8) == 0) {
if (strncmp((const CHAR8*)rom + version_start, "Version ", 8) == 0) {
version_start += 8;
}
s = (CHAR8*)(rom + version_start);

View File

@ -117,7 +117,7 @@ XMLDecode(CHAR8* src)
UINTN i;
s++;
for (i = 0; i < sizeof(ents)/sizeof(ents[0]); i++) {
if ( AsciiStrnCmp(s, ents[i].name, ents[i].nameLen) == 0 ) {
if ( strncmp(s, ents[i].name, ents[i].nameLen) == 0 ) {
entFound = TRUE;
break;
}
@ -339,7 +339,7 @@ EFI_STATUS XMLParseNextTag(CHAR8* buffer, TagPtr* tag, UINT32* lenPtr)
}
pos = length;
if (!AsciiStrnCmp(tagName, kXMLTagPList, 6)) {
if (!strncmp(tagName, kXMLTagPList, 6)) {
length=0;
Status=EFI_SUCCESS;
}
@ -354,7 +354,7 @@ EFI_STATUS XMLParseNextTag(CHAR8* buffer, TagPtr* tag, UINT32* lenPtr)
DBG("end dict len=%d\n", length);
Status = ParseTagList(buffer + pos, tag, kTagTypeDict, 1, &length);
}
else if (!AsciiStrnCmp(tagName, kXMLTagDict " ", 5))
else if (!strncmp(tagName, kXMLTagDict " ", 5))
{
DBG("space dict len=%d\n", length);
Status = ParseTagList(buffer + pos, tag, kTagTypeDict, 0, &length);
@ -372,7 +372,7 @@ EFI_STATUS XMLParseNextTag(CHAR8* buffer, TagPtr* tag, UINT32* lenPtr)
Status = ParseTagString(buffer + pos, tag, &length);
}
/***** string ****/
else if (!AsciiStrnCmp(tagName, kXMLTagString " ", 7))
else if (!strncmp(tagName, kXMLTagString " ", 7))
{
DBG("parse String len=%d\n", length);
Status = ParseTagString(buffer + pos, tag, &length);
@ -382,7 +382,7 @@ EFI_STATUS XMLParseNextTag(CHAR8* buffer, TagPtr* tag, UINT32* lenPtr)
{
Status = ParseTagInteger(buffer + pos, tag, &length);
}
else if (!AsciiStrnCmp(tagName, kXMLTagInteger " ", 8))
else if (!strncmp(tagName, kXMLTagInteger " ", 8))
{
Status = ParseTagInteger(buffer + pos, tag, &length);
}
@ -391,7 +391,7 @@ EFI_STATUS XMLParseNextTag(CHAR8* buffer, TagPtr* tag, UINT32* lenPtr)
{
Status = ParseTagFloat(buffer + pos, tag, &length);
}
else if (!AsciiStrnCmp(tagName, kXMLTagFloat " ", 8))
else if (!strncmp(tagName, kXMLTagFloat " ", 8))
{
Status = ParseTagFloat(buffer + pos, tag, &length);
}
@ -400,7 +400,7 @@ EFI_STATUS XMLParseNextTag(CHAR8* buffer, TagPtr* tag, UINT32* lenPtr)
{
Status = ParseTagData(buffer + pos, tag, &length);
}
else if (!AsciiStrnCmp(tagName, kXMLTagData " ", 5))
else if (!strncmp(tagName, kXMLTagData " ", 5))
{
Status = ParseTagData(buffer + pos, tag, &length);
}
@ -424,7 +424,7 @@ EFI_STATUS XMLParseNextTag(CHAR8* buffer, TagPtr* tag, UINT32* lenPtr)
{
Status = ParseTagList(buffer + pos, tag, kTagTypeArray, 0, &length);
}
else if (!AsciiStrnCmp(tagName, kXMLTagArray " ", 6))
else if (!strncmp(tagName, kXMLTagArray " ", 6))
{
DBG("begin array len=%d\n", length);
Status = ParseTagList(buffer + pos, tag, kTagTypeArray, 0, &length);

View File

@ -1678,7 +1678,7 @@ VOID PatchTableType17()
}
if (trustSMBIOS && gRAM.SMBIOS[SMBIOSIndex].InUse &&
(iStrLen(gRAM.SMBIOS[SMBIOSIndex].Vendor, 64) > 0) &&
(AsciiStrnCmp(gRAM.SPD[SPDIndex].Vendor, "NoName", 6) == 0)) {
(strncmp(gRAM.SPD[SPDIndex].Vendor, "NoName", 6) == 0)) {
DBG("Type17->Manufacturer corrected by SMBIOS from NoName to %s\n", gRAM.SMBIOS[SMBIOSIndex].Vendor);
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, gRAM.SMBIOS[SMBIOSIndex].Vendor);
}

View File

@ -54,11 +54,11 @@
extern CONST CHAR8* IconsNames[];
const XImage& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
const XIcon& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
{
UINTN IconNum = 0;
const XImage* IconX;
const XIcon* IconX;
// default volume icon based on disk kind
switch (Volume->DiskKind) {
case DISK_KIND_INTERNAL:
@ -111,7 +111,7 @@ const XImage& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EF
}
// 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()) {
if (IconX->Image.isEmpty()) {
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

@ -46,7 +46,7 @@ extern REFIT_MENU_SCREEN MainMenu;
extern XObjArray<REFIT_VOLUME> Volumes;
// common
const XImage& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath);
const XIcon& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath);
// Ask user for file path from directory menu

View File

@ -51,7 +51,7 @@
//the function is not in the class and deals always with MainMenu
//I made args as pointers to have an ability to call with NULL
BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTitle, IN REFIT_VOLUME *Volume, IN const XImage* Image, IN const XImage* DriveImage, IN CHAR16 Hotkey, IN BOOLEAN CustomEntry)
BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTitle, IN REFIT_VOLUME *Volume, IN const XIcon* Image, IN const XIcon* DriveImage, IN CHAR16 Hotkey, IN BOOLEAN CustomEntry)
{
LEGACY_ENTRY *Entry, *SubEntry;
REFIT_MENU_SCREEN *SubScreen;
@ -137,7 +137,7 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi
Entry->Image = *Image;
} else {
Entry->Image = ThemeX.LoadOSIcon(Volume->LegacyOS->IconName);
if (Entry->Image.isEmpty()) {
if (Entry->Image.Image.isEmpty()) {
Entry->Image = ThemeX.GetIcon("os_win"_XS8); //we have no legacy.png
}
}
@ -154,9 +154,9 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi
Entry->AtRightClick = ActionDetails;
if (ThemeX.HideBadges & HDBADGES_SHOW) {
if (ThemeX.HideBadges & HDBADGES_SWAP) { //will be scaled later
Entry->BadgeImage = XImage(Entry->DriveImage, 0); //ThemeX.BadgeScale/16.f); //0 accepted
Entry->BadgeImage.Image = XImage(Entry->DriveImage.Image, 0); //ThemeX.BadgeScale/16.f); //0 accepted
} else {
Entry->BadgeImage = XImage(Entry->Image, 0); //ThemeX.BadgeScale/16.f);
Entry->BadgeImage.Image = XImage(Entry->Image.Image, 0); //ThemeX.BadgeScale/16.f);
}
}
Entry->Volume = Volume;
@ -170,7 +170,7 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi
// SubScreen->Title = L"Boot Options for "_XSW + LoaderTitle + L" on "_XSW + VolDesc;
SubScreen->Title.SWPrintf("Boot Options for %ls on %ls", LoaderTitle.wc_str(), VolDesc);
SubScreen->TitleImage.Image = Entry->Image; //TODO - ImageNight
SubScreen->TitleImage = Entry->Image; //it is XIcon
SubScreen->ID = SCREEN_BOOT;
SubScreen->GetAnime();
// default entry
@ -277,8 +277,8 @@ VOID AddCustomLegacy(VOID)
BOOLEAN ShowVolume, HideIfOthersFound;
REFIT_VOLUME *Volume;
CUSTOM_LEGACY_ENTRY *Custom;
XImage Image;
XImage DriveImage;
XIcon MainIcon;
XIcon DriveIcon;
UINTN i = 0;
// DBG("Custom legacy start\n");
@ -305,10 +305,6 @@ VOID AddCustomLegacy(VOID)
DBG(" Checking volume \"%ls\" (%ls) ... ", Volume->VolName, Volume->DevicePathString);
// skip volume if its kind is configured as disabled
/* if ((Volume->DiskKind == DISK_KIND_OPTICAL && (GlobalConfig.DisableFlags & VOLTYPE_OPTICAL)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && (GlobalConfig.DisableFlags & VOLTYPE_EXTERNAL)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && (GlobalConfig.DisableFlags & VOLTYPE_INTERNAL)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && (GlobalConfig.DisableFlags & VOLTYPE_FIREWIRE))) */
if (((1ull<<Volume->DiskKind) & GlobalConfig.DisableFlags) != 0)
{
DBG("skipped because media is disabled\n");
@ -316,10 +312,6 @@ VOID AddCustomLegacy(VOID)
}
if (Custom->VolumeType != 0) {
/* if ((Volume->DiskKind == DISK_KIND_OPTICAL && ((Custom->VolumeType & VOLTYPE_OPTICAL) == 0)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && ((Custom->VolumeType & VOLTYPE_EXTERNAL) == 0)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && ((Custom->VolumeType & VOLTYPE_INTERNAL) == 0)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && ((Custom->VolumeType & VOLTYPE_FIREWIRE) == 0))) */
if (((1ull<<Volume->DiskKind) & Custom->VolumeType) == 0) {
DBG("skipped because media is ignored\n");
continue;
@ -380,18 +372,18 @@ VOID AddCustomLegacy(VOID)
continue;
}
// Change to custom image if needed
Image = Custom->Image;
if (Image.isEmpty()) {
Image.LoadXImage(ThemeX.ThemeDir, Custom->ImagePath);
MainIcon = Custom->Image;
if (MainIcon.Image.isEmpty()) {
MainIcon.Image.LoadXImage(ThemeX.ThemeDir, Custom->ImagePath);
}
// Change to custom drive image if needed
DriveImage = Custom->DriveImage;
if (DriveImage.isEmpty()) {
DriveImage.LoadXImage(ThemeX.ThemeDir, Custom->DriveImagePath);
DriveIcon = Custom->DriveImage;
if (DriveIcon.Image.isEmpty()) {
DriveIcon.Image.LoadXImage(ThemeX.ThemeDir, Custom->DriveImagePath);
}
// Create a legacy entry for this volume
if (AddLegacyEntry(Custom->FullTitle, Custom->Title, Volume, &Image, &DriveImage, Custom->Hotkey, TRUE))
if (AddLegacyEntry(Custom->FullTitle, Custom->Title, Volume, &MainIcon, &DriveIcon, Custom->Hotkey, TRUE))
{
DBG("match!\n");
}

View File

@ -445,8 +445,8 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
IN CONST XStringW& FullTitle,
IN CONST XStringW& LoaderTitle,
IN REFIT_VOLUME *Volume,
IN XImage *Image,
IN XImage *DriveImage,
IN XIcon *Image,
IN XIcon *DriveImage,
IN UINT8 OSType,
IN UINT8 Flags,
IN CHAR16 Hotkey,
@ -470,7 +470,6 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
}
// Get the loader device path
// LoaderDevicePath = FileDevicePath(Volume->DeviceHandle, (*LoaderPath == L'\\') ? (LoaderPath + 1) : LoaderPath);
LoaderDevicePath = FileDevicePath(Volume->DeviceHandle, LoaderPath);
if (LoaderDevicePath == NULL) {
return NULL;
@ -497,7 +496,6 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
UINTN CustomIndex = 0;
// Ignore this loader if it's device path is already present in another loader
// if (MainMenu.Entries) {
for (UINTN i = 0; i < MainMenu.Entries.size(); ++i) {
REFIT_ABSTRACT_MENU_ENTRY& MainEntry = MainMenu.Entries[i];
// Only want loaders
@ -509,7 +507,6 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
}
}
}
// }
// If this isn't a custom entry make sure it's not hidden by a custom entry
Custom = gSettings.CustomEntries;
while (Custom) {
@ -533,10 +530,6 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
// Check if the volume_type match
if (Custom->VolumeType != 0) {
volume_type_match = (((1ull<<Volume->DiskKind) & Custom->VolumeType) != 0) ? 1 : -1;
/* (((Volume->DiskKind == DISK_KIND_INTERNAL) && (Custom->VolumeType & VOLTYPE_INTERNAL)) ||
((Volume->DiskKind == DISK_KIND_EXTERNAL) && (Custom->VolumeType & VOLTYPE_EXTERNAL)) ||
((Volume->DiskKind == DISK_KIND_OPTICAL) && (Custom->VolumeType & VOLTYPE_OPTICAL)) ||
((Volume->DiskKind == DISK_KIND_FIREWIRE) && (Custom->VolumeType & VOLTYPE_FIREWIRE))) ? 1 : -1; */
}
// Check if the path match
@ -589,9 +582,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
}
// DBG("prepare the menu entry\n");
// prepare the menu entry
// Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
Entry = new LOADER_ENTRY();
// Entry->Tag = TAG_LOADER;
Entry->Row = 0;
Entry->Volume = Volume;
@ -600,15 +591,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
Entry->DevicePath = LoaderDevicePath;
Entry->DevicePathString = LoaderDevicePathString;
Entry->Flags = OSFLAG_SET(Flags, OSFLAG_USEGRAPHICS);
// if (LoaderOptions.notEmpty()) {
// if (OSFLAG_ISSET(Flags, OSFLAG_NODEFAULTARGS)) {
// Entry->LoadOptions = LoaderOptions;
// } else {
// Entry->LoadOptions = SPrintf("%s %s", gSettings.BootArgs, LoaderOptions.c_str());
// }
// } else if ((AsciiStrLen(gSettings.BootArgs) > 0) && OSFLAG_ISUNSET(Flags, OSFLAG_NODEFAULTARGS)) {
// Entry->LoadOptions = SPrintf("%s", gSettings.BootArgs);
// }
if (OSFLAG_ISSET(Flags, OSFLAG_NODEFAULTARGS)) {
Entry->LoadOptions = LoaderOptions;
}else{
@ -672,7 +655,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
Entry->LoaderType = OSType;
OSIconName = L"linux"_XSW;
if (Image == nullptr) {
DBG(" image not found\n");
DBG(" linux image not found\n");
OSIconName = LinuxIconNameFromPath(LoaderPath, Volume->RootDir); //something named "issue"
}
ShortcutLetter = 'L';
@ -743,8 +726,11 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
// get custom volume icon if present
if (GlobalConfig.CustomIcons && FileExists(Volume->RootDir, L"\\.VolumeIcon.icns")){
Entry->Image.LoadIcns(Volume->RootDir, L"\\.VolumeIcon.icns", 128);
DBG("using VolumeIcon.icns image from Volume\n");
Entry->Image.Image.LoadIcns(Volume->RootDir, L"\\.VolumeIcon.icns", 128);
if (!Entry->Image.Image.isEmpty()) {
Entry->Image.setFilled();
DBG("using VolumeIcon.icns image from Volume\n");
}
} else if (Image) {
Entry->Image = *Image; //copy image from temporary storage
} else {
@ -761,14 +747,15 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
// 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, 0); //ThemeX.BadgeScale/16.f);
Entry->BadgeImage.Image = XImage(Entry->DriveImage.Image, 0);
DBG(" Show badge as Drive.");
} else {
Entry->BadgeImage = XImage(Entry->Image, 0); //ThemeX.BadgeScale/16.f);
// Entry->BadgeImage = egCopyScaledImage((Entry->Image).ToEGImage(), ThemeX.BadgeScale);
Entry->BadgeImage.Image = XImage(Entry->Image.Image, 0);
DBG(" Show badge as OSImage.");
}
if (!Entry->BadgeImage.Image.isEmpty()) {
Entry->BadgeImage.setFilled();
}
}
Entry->BootBgColor = BootBgColor;
@ -815,7 +802,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
SubScreen = new REFIT_MENU_SCREEN;
SubScreen->Title.SWPrintf("Options for %ls on %ls", Entry->Title.wc_str(), Entry->VolName);
SubScreen->TitleImage.Image = Entry->Image;
SubScreen->TitleImage = Entry->Image;
SubScreen->ID = Entry->LoaderType + 20; //wow
// DBG("get anime for os=%lld\n", SubScreen->ID);
SubScreen->GetAnime();
@ -832,11 +819,11 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
Entry->LoaderType == OSTYPE_OSX_INSTALLER ||
Entry->LoaderType == OSTYPE_RECOVERY) { // entries for Mac OS X
if (os_version < AsciiOSVersionToUint64("10.8")) {
SubScreen->AddMenuInfoLine_f("Mac OS X: %s", Entry->OSVersion);
SubScreen->AddMenuInfoLine_f("Mac OS X: %s", Entry->OSVersion);
} else if (os_version < AsciiOSVersionToUint64("10.12")) {
SubScreen->AddMenuInfoLine_f("OS X: %s", Entry->OSVersion);
SubScreen->AddMenuInfoLine_f("OS X: %s", Entry->OSVersion);
} else {
SubScreen->AddMenuInfoLine_f("macOS: %s", Entry->OSVersion);
SubScreen->AddMenuInfoLine_f("macOS: %s", Entry->OSVersion);
}
if (OSFLAG_ISSET(Entry->Flags, OSFLAG_HIBERNATED)) {
@ -895,10 +882,10 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
SubScreen->AddMenuCheck("Mac OS X 32bit", OPT_I386, 68);
SubScreen->AddMenuCheck("Mac OS X 64bit", OPT_X64, 68);
} else if (os_version < AsciiOSVersionToUint64("10.12")) {
SubScreen->AddMenuCheck("OS X 32bit", OPT_I386, 68);
// SubScreen->AddMenuCheck("OS X 32bit", OPT_I386, 68); //it cant be 32 bit
SubScreen->AddMenuCheck("OS X 64bit", OPT_X64, 68);
} else {
SubScreen->AddMenuCheck("macOS 32bit", OPT_I386, 68);
// SubScreen->AddMenuCheck("macOS 32bit", OPT_I386, 68);
SubScreen->AddMenuCheck("macOS 64bit", OPT_X64, 68);
}
}
@ -1034,7 +1021,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
BOOLEAN AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XStringArray& LoaderOptions,
IN CONST XStringW& LoaderTitle,
IN REFIT_VOLUME *Volume, IN XImage *Image,
IN REFIT_VOLUME *Volume, IN XIcon *Image,
IN UINT8 OSType, IN UINT8 Flags)
{
LOADER_ENTRY *Entry;
@ -1087,7 +1074,7 @@ BOOLEAN AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XStringArray& Loa
return FALSE;
}
STATIC VOID LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStringW *CustomPath, XImage *CustomImage)
STATIC VOID LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStringW *CustomPath, XIcon *CustomImage)
{
// When used for Regular Entries, all found entries will be added by AddLoaderEntry()
// When used for Custom Entries (detected by CustomPath!=NULL), CustomPath+CustomImage will be set to the first entry found and execution will stop
@ -1125,7 +1112,7 @@ STATIC VOID LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
LoaderTitle.upperAscii();
LoaderTitle += OSName.subString(1, OSName.length()) + L" Linux"_XSW;
// Very few linux icons exist in IconNames, but these few may be preloaded, so check that first
XImage ImageX = ThemeX.GetIcon(L"os_"_XSW + OSName); //will the image be destroyed or rewritten by next image after the cycle end?
XIcon ImageX = ThemeX.GetIcon(L"os_"_XSW + OSName); //will the image be destroyed or rewritten by next image after the cycle end?
if (ImageX.isEmpty()) {
// no preloaded icon, try to load from dir
ImageX.LoadXImage(ThemeX.ThemeDir, L"os_"_XSW + OSName);
@ -1149,7 +1136,7 @@ STATIC VOID LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
if (FileExists(Volume->RootDir, LinuxEntryData[Index].Path)) {
XStringW OSIconName = XStringW().takeValueFrom(LinuxEntryData[Index].Icon);
OSIconName = OSIconName.subString(0, OSIconName.indexOf(','));
XImage ImageX = ThemeX.GetIcon(L"os_"_XSW + OSIconName);
XIcon ImageX = ThemeX.GetIcon(L"os_"_XSW + OSIconName);
if (ImageX.isEmpty()) {
ImageX.LoadXImage(ThemeX.ThemeDir, L"os_"_XSW + OSIconName);
}
@ -1378,10 +1365,6 @@ VOID ScanLoader(VOID)
}
// skip volume if its kind is configured as disabled
/* if ((Volume->DiskKind == DISK_KIND_OPTICAL && (GlobalConfig.DisableFlags & VOLTYPE_OPTICAL)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && (GlobalConfig.DisableFlags & VOLTYPE_EXTERNAL)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && (GlobalConfig.DisableFlags & VOLTYPE_INTERNAL)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && (GlobalConfig.DisableFlags & VOLTYPE_FIREWIRE))) */
if (((1ull<<Volume->DiskKind) & GlobalConfig.DisableFlags) != 0)
{
DBG(", flagged disable\n");
@ -1509,7 +1492,7 @@ VOID ScanLoader(VOID)
if ((AndroidEntryData[Index].Find[aIndex].isEmpty()) || FileExists(Volume->RootDir, AndroidEntryData[Index].Find[aIndex])) ++aFound;
}
if (aFound && (aFound == aIndex)) {
XImage ImageX;
XIcon ImageX;
XStringW IconXSW = XStringW().takeValueFrom(AndroidEntryData[Index].Icon);
ImageX.LoadXImage(ThemeX.ThemeDir, (L"os_"_XSW + IconXSW.subString(0, IconXSW.indexOf(','))).wc_str());
AddLoaderEntry(AndroidEntryData[Index].Path, NullXStringArray, XStringW().takeValueFrom(AndroidEntryData[Index].Title), Volume,
@ -1602,8 +1585,8 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
for (VolumeIndex = 0; VolumeIndex < Volumes.size(); ++VolumeIndex) {
CUSTOM_LOADER_ENTRY *CustomSubEntry;
LOADER_ENTRY *Entry = NULL;
XImage Image = Custom->Image;
XImage DriveImage = Custom->DriveImage;
XIcon Image = Custom->Image;
XIcon DriveImage = Custom->DriveImage;
EFI_GUID *Guid = NULL;
UINT64 VolumeSize;
@ -1619,22 +1602,11 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
DBG(" Checking volume \"%ls\" (%ls) ... ", Volume->VolName, Volume->DevicePathString);
// skip volume if its kind is configured as disabled
/* if ((Volume->DiskKind == DISK_KIND_OPTICAL && (GlobalConfig.DisableFlags & VOLTYPE_OPTICAL)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && (GlobalConfig.DisableFlags & VOLTYPE_EXTERNAL)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && (GlobalConfig.DisableFlags & VOLTYPE_INTERNAL)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && (GlobalConfig.DisableFlags & VOLTYPE_FIREWIRE))) {
*/
if (((1ull<<Volume->DiskKind) & GlobalConfig.DisableFlags) != 0) {
DBG("skipped because media is disabled\n");
continue;
}
/* if ((Custom->VolumeType != 0) &&
((Volume->DiskKind == DISK_KIND_OPTICAL && ((Custom->VolumeType & VOLTYPE_OPTICAL ) == 0)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && ((Custom->VolumeType & VOLTYPE_EXTERNAL) == 0)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && ((Custom->VolumeType & VOLTYPE_INTERNAL) == 0)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && ((Custom->VolumeType & VOLTYPE_FIREWIRE) == 0)))) {
*/
if (Custom->VolumeType != 0 && ((1<<Volume->DiskKind) & Custom->VolumeType) == 0) {
DBG("skipped because media is ignored\n");
continue;
@ -1782,10 +1754,6 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
BetterMatch = ((Ptr->Path.notEmpty()) && CustomPath.equal(Ptr->Path) &&
((Custom->VolumeType == Ptr->VolumeType) ||
((1ull<<Volume->DiskKind) & Custom->VolumeType) != 0));
/* (Volume->DiskKind == DISK_KIND_OPTICAL && (Custom->VolumeType & VOLTYPE_OPTICAL)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && (Custom->VolumeType & VOLTYPE_EXTERNAL)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && (Custom->VolumeType & VOLTYPE_INTERNAL)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && (Custom->VolumeType & VOLTYPE_FIREWIRE)))); */
}
} else if ((StrStr(Volume->DevicePathString, Custom->Volume) == NULL) &&
((Volume->VolName == NULL) || (StrStr(Volume->VolName, Custom->Volume) == NULL))) {
@ -1796,18 +1764,10 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
BetterMatch = ((Ptr->Path.notEmpty()) && CustomPath.equal(Ptr->Path) &&
((Custom->VolumeType == Ptr->VolumeType) ||
((1ull<<Volume->DiskKind) & Custom->VolumeType) != 0));
/* (Volume->DiskKind == DISK_KIND_OPTICAL && (Custom->VolumeType & VOLTYPE_OPTICAL)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && (Custom->VolumeType & VOLTYPE_EXTERNAL)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && (Custom->VolumeType & VOLTYPE_INTERNAL)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && (Custom->VolumeType & VOLTYPE_FIREWIRE)))); */
} else if (Custom->VolumeType != Ptr->VolumeType) {
// More precise volume type match
BetterMatch = ((Custom->VolumeType == 0) &&
((1ull<<Volume->DiskKind) & Custom->VolumeType) != 0);
/* (Volume->DiskKind == DISK_KIND_OPTICAL && (Custom->VolumeType & VOLTYPE_OPTICAL)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && (Custom->VolumeType & VOLTYPE_EXTERNAL)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && (Custom->VolumeType & VOLTYPE_INTERNAL)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && (Custom->VolumeType & VOLTYPE_FIREWIRE)))); */
} else {
// Better match
BetterMatch = TRUE;
@ -1818,19 +1778,11 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
BetterMatch = ((Ptr->Path.notEmpty()) && CustomPath.equal(Ptr->Path) &&
((Custom->VolumeType == Ptr->VolumeType) ||
((1ull<<Volume->DiskKind) & Custom->VolumeType) != 0));
/* (Volume->DiskKind == DISK_KIND_OPTICAL && (Custom->VolumeType & VOLTYPE_OPTICAL)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && (Custom->VolumeType & VOLTYPE_EXTERNAL)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && (Custom->VolumeType & VOLTYPE_INTERNAL)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && (Custom->VolumeType & VOLTYPE_FIREWIRE)))); */
// Duplicate path match
} else if (Custom->VolumeType != Ptr->VolumeType) {
// More precise volume type match
BetterMatch = ((Custom->VolumeType == 0) &&
((1ull<<Volume->DiskKind) & Custom->VolumeType) != 0);
/* (Volume->DiskKind == DISK_KIND_OPTICAL && (Custom->VolumeType & VOLTYPE_OPTICAL)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && (Custom->VolumeType & VOLTYPE_EXTERNAL)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && (Custom->VolumeType & VOLTYPE_INTERNAL)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && (Custom->VolumeType & VOLTYPE_FIREWIRE)))); */
} else {
// Duplicate entry
BetterMatch = (i <= CustomIndex);
@ -1842,27 +1794,15 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
// Less precise path match
BetterMatch = ((Custom->VolumeType != Ptr->VolumeType) &&
((1ull<<Volume->DiskKind) & Custom->VolumeType) != 0);
/* (Volume->DiskKind == DISK_KIND_OPTICAL && (Custom->VolumeType & VOLTYPE_OPTICAL)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && (Custom->VolumeType & VOLTYPE_EXTERNAL)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && (Custom->VolumeType & VOLTYPE_INTERNAL)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && (Custom->VolumeType & VOLTYPE_FIREWIRE)))); */
} else if (CustomPath.equal(Ptr->Path)) {
if (Custom->Path.isEmpty()) {
// More precise path and volume type match
BetterMatch = ((Custom->VolumeType == Ptr->VolumeType) ||
((1ull<<Volume->DiskKind) & Custom->VolumeType) != 0);
/* (Volume->DiskKind == DISK_KIND_OPTICAL && (Custom->VolumeType & VOLTYPE_OPTICAL)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && (Custom->VolumeType & VOLTYPE_EXTERNAL)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && (Custom->VolumeType & VOLTYPE_INTERNAL)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && (Custom->VolumeType & VOLTYPE_FIREWIRE)))); */
} else if (Custom->VolumeType != Ptr->VolumeType) {
// More precise volume type match
BetterMatch = ((Custom->VolumeType == 0) &&
((1ull<<Volume->DiskKind) & Custom->VolumeType) != 0);
/* (Volume->DiskKind == DISK_KIND_OPTICAL && (Custom->VolumeType & VOLTYPE_OPTICAL)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && (Custom->VolumeType & VOLTYPE_EXTERNAL)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && (Custom->VolumeType & VOLTYPE_INTERNAL)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && (Custom->VolumeType & VOLTYPE_FIREWIRE)))); */
} else {
// Duplicate entry
BetterMatch = (i <= CustomIndex);
@ -1873,10 +1813,6 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
// More precise volume type match
BetterMatch = ((Custom->VolumeType == 0) &&
((1ull<<Volume->DiskKind) & Custom->VolumeType) != 0);
/* (Volume->DiskKind == DISK_KIND_OPTICAL && (Custom->VolumeType & VOLTYPE_OPTICAL)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && (Custom->VolumeType & VOLTYPE_EXTERNAL)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && (Custom->VolumeType & VOLTYPE_INTERNAL)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && (Custom->VolumeType & VOLTYPE_FIREWIRE)))); */
} else {
// Duplicate entry
BetterMatch = (i <= CustomIndex);
@ -1911,7 +1847,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
REFIT_MENU_SCREEN *SubScreen = new REFIT_MENU_SCREEN;
if (SubScreen) {
SubScreen->Title.SWPrintf("Boot Options for %ls on %ls", (Custom->Title.notEmpty()) ? Custom->Title.wc_str() : CustomPath.wc_str(), Entry->VolName);
SubScreen->TitleImage.Image = Entry->Image;
SubScreen->TitleImage = Entry->Image;
SubScreen->ID = Custom->Type + 20;
SubScreen->GetAnime();
VolumeSize = RShiftU64(MultU64x32(Volume->BlockIO->Media->LastBlock, Volume->BlockIO->Media->BlockSize), 20);

View File

@ -62,7 +62,7 @@
#endif
#ifndef DEBUG_ALL
#define DEBUG_SCAN_TOOL 1
#define DEBUG_SCAN_TOOL 0
#else
#define DEBUG_SCAN_TOOL DEBUG_ALL
#endif
@ -74,7 +74,7 @@
#endif
STATIC BOOLEAN AddToolEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle,
IN REFIT_VOLUME *Volume, const XImage& Image,
IN REFIT_VOLUME *Volume, const XIcon& Image,
IN CHAR16 ShortcutLetter, IN CONST XStringArray& Options)
{
REFIT_MENU_ENTRY_LOADER_TOOL *Entry;
@ -149,7 +149,7 @@ STATIC VOID AddCloverEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Loade
SubScreen->Title.takeValueFrom(LoaderTitle);
SubScreen->TitleImage.Image = Entry->Image;
SubScreen->TitleImage = Entry->Image;
SubScreen->ID = SCREEN_BOOT;
SubScreen->GetAnime();
SubScreen->AddMenuInfoLine_f("%ls", FileDevicePathToStr(Volume->DevicePath));
@ -239,7 +239,7 @@ VOID AddCustomTool(VOID)
UINTN VolumeIndex;
REFIT_VOLUME *Volume;
CUSTOM_TOOL_ENTRY *Custom;
XImage Image;
XIcon Image;
UINTN i = 0;
// DBG("Custom tool start\n");

View File

@ -1631,7 +1631,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
if (!TitleImage.Image.isEmpty()) {
INTN FilmXPos = (INTN)(EntriesPosX - (TitleImage.Image.GetWidth() + (int)(TITLEICON_SPACING * ThemeX.Scale)));
INTN FilmYPos = (INTN)EntriesPosY;
TitleImage.Image.Draw(FilmXPos, FilmYPos);
TitleImage.Image.Draw(FilmXPos, FilmYPos); //TODO - account night and svg
// update FilmPlace only if not set by InitAnime
if (FilmC->FilmPlace.Width == 0 || FilmC->FilmPlace.Height == 0) {
@ -1879,9 +1879,7 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN XPos,
ThemeX.MeasureText(Text, &TextWidth, NULL);
//Clear old text
// if (OldTextWidth > TextWidth) {
ThemeX.FillRectAreaOfScreen(OldX, OldY, OldTextWidth, OldTextHeight);
// }
ThemeX.FillRectAreaOfScreen(OldX, OldY, OldTextWidth, OldTextHeight);
if (!(ThemeX.BootCampStyle)
&& (ThemeX.HideBadges & HDBADGES_INLINE) && (!OldRow)
@ -1891,8 +1889,6 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN XPos,
ThemeX.FillRectAreaOfScreen((OldX - (OldTextWidth >> 1) - (BadgeDim + 16)),
(OldY - ((BadgeDim - ThemeX.TextHeight) >> 1)), 128, 128);
}
// XStringW TextX;
// TextX.takeValueFrom(Text);
DrawTextXY(Text, XPos, YPos, X_IS_CENTER);
//show inline badge
@ -1904,9 +1900,7 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN XPos,
INTN X = XPos - (TextWidth >> 1) - (BadgeDim + 16);
INTN Y = YPos - ((BadgeDim - ThemeX.TextHeight) >> 1);
Back.CopyRect(ThemeX.Background, X, Y);
Back.Compose(0, 0, Entries[ScrollState.CurrentSelection].Image, false, BadgeDim/128.f);
// Entries[ScrollState.CurrentSelection].Image.Draw((XPos - (TextWidth >> 1) - (BadgeDim + 16)),
// (YPos - ((BadgeDim - ThemeX.TextHeight) >> 1)));
Back.Compose(0, 0, Entries[ScrollState.CurrentSelection].Image.GetBest(!ThemeX.Daylight), false, BadgeDim/128.f);
Back.DrawOnBack(X, Y, Back);
}
@ -1997,27 +1991,35 @@ VOID REFIT_MENU_SCREEN::DrawTextCorner(UINTN TextC, UINT8 Align)
VOID REFIT_MENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN XPos, INTN YPos)
{
INTN MainSize = ThemeX.MainEntriesSize;
XImage MainImage(MainSize, MainSize);
XImage* BadgeImage = NULL;
// XImage MainImage(MainSize, MainSize);
// XImage* BadgeImage;
XIcon MainIcon; //it can be changed here
XIcon* BadgeIcon = NULL;
if (Entry->Row == 0 && Entry->getDriveImage() && !(ThemeX.HideBadges & HDBADGES_SWAP)) {
MainImage = *Entry->getDriveImage();
MainIcon = *Entry->getDriveImage();
} else {
MainImage = Entry->Image; //XImage
MainIcon = Entry->Image; // XIcon*
}
//this should be inited by the Theme
if (MainImage.isEmpty()) {
if (MainIcon.isEmpty()) {
// DBG(" why MainImage is empty? Report to devs\n");
if (!IsEmbeddedTheme()) {
MainImage = ThemeX.GetIcon("os_mac"_XS8);
MainIcon = ThemeX.GetIcon("os_mac"_XS8);
}
if (MainImage.isEmpty()) {
MainImage.DummyImage(MainSize);
if (MainIcon.Image.isEmpty()) {
MainIcon.Image.DummyImage(MainSize);
MainIcon.setFilled();
}
}
// const XImage& MainImage = (!ThemeX.Daylight && !MainIcon.ImageNight.isEmpty())? MainIcon.ImageNight : MainIcon.Image;
const XImage& MainImage = MainIcon.GetBest(!ThemeX.Daylight);
INTN CompWidth = (Entry->Row == 0) ? ThemeX.row0TileSize : ThemeX.row1TileSize;
INTN CompHeight = CompWidth;
// DBG("Entry title=%ls; MainWidth=%lld\n", Entry->Title.wc_str(), MainImage.GetWidth());
float fScale;
if (ThemeX.TypeSVG) {
fScale = (selected ? 1.f : -1.f);
@ -2026,18 +2028,16 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOL
}
if (Entry->Row == 0) {
BadgeImage = Entry->getBadgeImage();
// DBG(" BadgeWidth=%lld\n", BadgeImage->GetWidth());
} //else null
BadgeIcon = Entry->getBadgeImage();
}
XImage TopImage = ThemeX.SelectionImages[((Entry->Row == 0) ? 0 : 2) + (selected ? 0 : 1)];
const XImage& TopImage = ThemeX.SelectionImages[((Entry->Row == 0) ? 0 : 2) + (selected ? 0 : 1)];
// DBG(" SelectionWidth=%lld\n", TopImage.GetWidth());
if (TopImage.GetWidth() > CompWidth) {
CompWidth = TopImage.GetWidth();
CompHeight = CompWidth;
}
XImage Back(CompWidth, CompHeight);
// Back.GetArea(XPos, YPos, 0, 0); // this is background at this place
Back.CopyRect(ThemeX.Background, XPos, YPos);
INTN OffsetX = (CompWidth - MainImage.GetWidth()) / 2;
@ -2060,26 +2060,18 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOL
Back.Compose(OffsetTX, OffsetTY, TopImage, false); //selection first
Back.Compose(OffsetX, OffsetY, MainImage, false, composeScale);
}
// DBG("compose size=%lld\n", CompWidth);
//the badge is already scaled?
// DBG("check Badge size=%lld offset=%lld\n", BadgeImage->GetWidth(), ThemeX.BadgeOffsetX);
// place the badge image
float fBadgeScale = ThemeX.BadgeScale/16.f;
if (BadgeImage && !BadgeImage->isEmpty()) {
INTN BadgeWidth = (INTN)(BadgeImage->GetWidth() * fBadgeScale);
INTN BadgeHeight = (INTN)(BadgeImage->GetHeight() * fBadgeScale);
if ((Entry->Row == 0) && BadgeIcon && !BadgeIcon->isEmpty()) {
// const XImage& BadgeImage = (!ThemeX.Daylight && !BadgeIcon->ImageNight.isEmpty()) ? &BadgeIcon->ImageNight : BadgeImage = &BadgeIcon->Image;
const XImage& BadgeImage = BadgeIcon->GetBest(!ThemeX.Daylight);
INTN BadgeWidth = (INTN)(BadgeImage.GetWidth() * fBadgeScale);
INTN BadgeHeight = (INTN)(BadgeImage.GetHeight() * fBadgeScale);
if ((BadgeWidth + 8) < CompWidth && (BadgeHeight + 8) < CompHeight) {
// Check for user badge x offset from theme.plist
if (ThemeX.BadgeOffsetX != 0xFFFF) {
// Check if value is between 0 and ( width of the main icon - width of badge )
//no, we have crop at Compose so there is safe for extra offset
// if (ThemeX.BadgeOffsetX < 0 || ThemeX.BadgeOffsetX > (CompWidth - BadgeWidth)) {
// DBG("User offset X %lld is out of range\n", ThemeX.BadgeOffsetX);
// ThemeX.BadgeOffsetX = CompWidth - 8 - BadgeWidth;
// DBG(" corrected to default %lld\n", ThemeX.BadgeOffsetX);
// }
OffsetX += ThemeX.BadgeOffsetX;
} else {
// Set default position
@ -2087,19 +2079,13 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOL
}
// Check for user badge y offset from theme.plist
if (ThemeX.BadgeOffsetY != 0xFFFF) {
// Check if value is between 0 and ( height of the main icon - height of badge )
// if (ThemeX.BadgeOffsetY < 0 || ThemeX.BadgeOffsetY > (CompHeight - BadgeHeight)) {
// DBG("User offset Y %lld is out of range\n",ThemeX.BadgeOffsetY);
// ThemeX.BadgeOffsetY = CompHeight - 8 - BadgeHeight;
// DBG(" corrected to default %lld\n", ThemeX.BadgeOffsetY);
// }
OffsetY += ThemeX.BadgeOffsetY;
} else {
// Set default position
OffsetY += CompHeight - 8 - BadgeHeight;
}
// DBG(" badge offset=[%lld,%lld]\n", OffsetX, OffsetY);
Back.Compose(OffsetX, OffsetY, *BadgeImage, false, fBadgeScale);
Back.Compose(OffsetX, OffsetY, BadgeImage, false, fBadgeScale);
}
}
@ -2116,24 +2102,16 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOL
// draw BCS indicator
// Needy: if Labels (Titles) are hidden there is no point to draw the indicator
if (ThemeX.BootCampStyle && !(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)) {
// ThemeX.SelectionImages[4]->HasAlpha = TRUE;
// indicator is for row 0, main entries, only
if (Entry->Row == 0) {
// BltImageAlpha(SelectionImages[4 + (selected ? 0 : 1)],
// XPos + (row0TileSize / 2) - (INTN)(INDICATOR_SIZE * 0.5f * GlobalConfig.Scale),
// row0PosY + row0TileSize + TextHeight + (INTN)((BCSMargin * 2) * GlobalConfig.Scale),
// &MenuBackgroundPixel, Scale);
TopImage = ThemeX.SelectionImages[4 + (selected ? 0 : 1)];
//TopImage.Draw(XPos + (ThemeX.row0TileSize / 2) - (INTN)(INDICATOR_SIZE * 0.5f * ThemeX.Scale),
// row0PosY + ThemeX.row0TileSize + ThemeX.TextHeight + (INTN)((BCSMargin * 2) * ThemeX.Scale), fScale, false);
const XImage& SelImage = ThemeX.SelectionImages[4 + (selected ? 0 : 1)];
XPos = XPos + (ThemeX.row0TileSize / 2) - (INTN)(INDICATOR_SIZE * 0.5f * ThemeX.Scale);
YPos = row0PosY + ThemeX.row0TileSize + ThemeX.TextHeight + (INTN)((BCSMargin * 2) * ThemeX.Scale);
CompWidth = (INTN)(INDICATOR_SIZE * ThemeX.Scale);
CompHeight = (INTN)(INDICATOR_SIZE * ThemeX.Scale);
Back = XImage(CompWidth, CompHeight);
Back.CopyRect(ThemeX.Background, XPos, YPos);
Back.Compose(0, 0, TopImage, false);
Back.Compose(0, 0, SelImage, false);
Back.DrawWithoutCompose(XPos, YPos);
}
}

View File

@ -74,7 +74,7 @@ public:
// XPointer mPointer;
UINTN ID;
XStringW Title;
Icon TitleImage;
XIcon TitleImage;
XStringWArray InfoLines;
XObjArray<REFIT_ABSTRACT_MENU_ENTRY> Entries;

View File

@ -102,7 +102,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
UINTN Row;
CHAR16 ShortcutDigit;
CHAR16 ShortcutLetter;
XImage Image;
XIcon Image;
EG_RECT Place;
ACTION AtClick;
ACTION AtDoubleClick;
@ -110,8 +110,8 @@ class REFIT_ABSTRACT_MENU_ENTRY
ACTION AtMouseOver;
REFIT_MENU_SCREEN *SubScreen;
virtual XImage* getDriveImage() { return nullptr; };
virtual XImage* getBadgeImage() { return nullptr; };
virtual XIcon* getDriveImage() { return nullptr; };
virtual XIcon* getBadgeImage() { return nullptr; };
virtual REFIT_SIMPLE_MENU_ENTRY_TAG* getREFIT_SIMPLE_MENU_ENTRY_TAG() { return nullptr; };
virtual REFIT_MENU_SWITCH* getREFIT_MENU_SWITCH() { return nullptr; };
@ -145,11 +145,11 @@ class REFIT_ABSTRACT_MENU_ENTRY
: Title(Title_), Row(Row_), ShortcutDigit(ShortcutDigit_), ShortcutLetter(ShortcutLetter_), Image(), AtClick(AtClick_), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL)
{};
REFIT_ABSTRACT_MENU_ENTRY(const XStringW& Title_, UINTN Row_,
CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, const XImage& Image_,
CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, const XIcon& Icon_,
EG_RECT Place_, ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: Title(Title_), Row(Row_), ShortcutDigit(ShortcutDigit_), ShortcutLetter(ShortcutLetter_),
Image(Image_), Place(Place_),
Image(Icon_), Place(Place_),
AtClick(AtClick_), AtDoubleClick(AtDoubleClick_), AtRightClick(AtRightClick_), AtMouseOver(AtMouseOver_),
SubScreen(SubScreen_) {};
@ -267,14 +267,14 @@ class REFIT_ABSTRACT_MENU_ENTRY
CONST CHAR16 *DevicePathString;
XStringArray LoadOptions; //moved here for compatibility with legacy
XStringW LoaderPath;
XImage DriveImage;
XImage BadgeImage;
XIcon DriveImage;
XIcon BadgeImage;
REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER()
: REFIT_ABSTRACT_MENU_ENTRY(), DevicePathString(0), DriveImage(), BadgeImage()
{}
virtual XImage* getDriveImage() { return &DriveImage; };
virtual XImage* getBadgeImage() { return &BadgeImage; };
virtual XIcon* getDriveImage() { return &DriveImage; };
virtual XIcon* getBadgeImage() { return &BadgeImage; };
virtual REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER* getREFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER() { return this; };
};
@ -284,7 +284,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
class REFIT_MENU_ENTRY_LOADER_TOOL : public REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER
{
public:
UINT8 NoMemset;
UINT8 NoMemset; //HACK - some non zero value
UINT16 Flags;
EFI_DEVICE_PATH *DevicePath;
@ -434,9 +434,9 @@ class REFIT_ABSTRACT_MENU_ENTRY
EFI_STATUS LoadKexts();
int is_mkext_v1(UINT8* drvPtr);
void patch_mkext_v1(UINT8 *drvPtr);
// why EFIAPI?
EFI_STATUS EFIAPI LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType, IN OUT VOID *kext);
EFI_STATUS EFIAPI AddKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType);
EFI_STATUS LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType, IN OUT VOID *kext);
EFI_STATUS AddKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType);
VOID LoadPlugInKexts(IN EFI_FILE *RootDir, IN CHAR16 *DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force);
VOID AddKexts(CONST CHAR16 *SrcDir, CONST CHAR16 *Path, cpu_type_t archCpuType);
VOID KextPatcherRegisterKexts(void *FSInject, void *ForceLoadKexts);

View File

@ -295,40 +295,44 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
if (i == BUILTIN_ICON_BANNER) { //exclude "logo" as it done as Banner
continue;
}
Icon* NewIcon = new Icon(i, false); //initialize without embedded
XIcon* NewIcon = new XIcon(i, false); //initialize without embedded
Status = ParseSVGXIcon(i, NewIcon->Name, &NewIcon->Image, &NewIcon->ImageSVG);
// DBG("parse %s status %s\n", NewIcon->Name.c_str(), strerror(Status));
DBG("parse %s status %s\n", NewIcon->Name.c_str(), strerror(Status));
NewIcon->Native = !EFI_ERROR(Status);
if (!EFI_ERROR(Status)) {
NewIcon->setFilled();
ParseSVGXIcon(i, NewIcon->Name + "_night"_XS8, &NewIcon->ImageNight, &NewIcon->ImageSVGnight);
}
// DBG("parse %s status %s\n", NewIcon->Name.c_str(), strerror(Status));
// DBG("parse night %s status %s\n", NewIcon->Name.c_str(), strerror(Status));
Icons.AddReference(NewIcon, true);
if (EFI_ERROR(Status) && i >= BUILTIN_ICON_VOL_INTERNAL_HFS && i <= BUILTIN_ICON_VOL_INTERNAL_REC) {
// call to GetIconAlt will get alternate/embedded into Icon if missing
DBG(" get alt icon for %lld\n", i);
GetIconAlt(i, BUILTIN_ICON_VOL_INTERNAL);
if (EFI_ERROR(Status)) {
if (i >= BUILTIN_ICON_VOL_INTERNAL_HFS && i <= BUILTIN_ICON_VOL_INTERNAL_REC) {
// call to GetIconAlt will get alternate/embedded into Icon if missing
GetIconAlt(i, BUILTIN_ICON_VOL_INTERNAL);
} else if (i == BUILTIN_SELECTION_BIG) {
GetIconAlt(i, BUILTIN_SELECTION_SMALL);
}
}
}
// --- Make other OSes
for (INTN i = ICON_OTHER_OS; i < IconsNamesSize; ++i) {
if (AsciiStrLen(IconsNames[i]) == 0) break;
Icon* NewIcon = new Icon(i, false); //initialize without embedded
XIcon* NewIcon = new XIcon(i, false); //initialize without embedded
Status = ParseSVGXIcon(i, NewIcon->Name, &NewIcon->Image, &NewIcon->ImageSVG);
// DBG("parse %s i=%lld status %s\n", NewIcon->Name.c_str(), i, strerror(Status));
DBG("parse %s i=%lld status %s\n", NewIcon->Name.c_str(), i, strerror(Status));
NewIcon->Native = !EFI_ERROR(Status);
if (!EFI_ERROR(Status)) {
ParseSVGXIcon(i, NewIcon->Name + "_night"_XS8, &NewIcon->ImageNight, &NewIcon->ImageSVGnight);
}
Icons.AddReference(NewIcon, true);
}
DBG("parse icon_selection\n");
//selection for bootcampstyle
Icon *NewIcon = new Icon(BUILTIN_ICON_SELECTION);
XIcon *NewIcon = new XIcon(BUILTIN_ICON_SELECTION);
Status = ParseSVGXIcon(BUILTIN_ICON_SELECTION, "selection_indicator"_XS8, &NewIcon->Image, &NewIcon->ImageSVG);
if (!EFI_ERROR(Status)) {
ParseSVGXIcon(BUILTIN_ICON_SELECTION, "selection_indicator_night"_XS8, &NewIcon->ImageNight, &NewIcon->ImageSVGnight);
Status = ParseSVGXIcon(BUILTIN_ICON_SELECTION, "selection_indicator_night"_XS8, &NewIcon->ImageNight, &NewIcon->ImageSVGnight);
}
Icons.AddReference(NewIcon, true);
@ -337,15 +341,18 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
SelectionBackgroundPixel.Green = (SelectionColor >> 16) & 0xFF;
SelectionBackgroundPixel.Blue = (SelectionColor >> 8) & 0xFF;
SelectionBackgroundPixel.Reserved = (SelectionColor >> 0) & 0xFF;
//TODO make SelectionImages to be XIcon
DBG("assign selections\n");
SelectionImages[0] = GetIcon(BUILTIN_SELECTION_BIG).GetBest(!Daylight);
SelectionImages[2] = GetIcon(BUILTIN_SELECTION_SMALL).GetBest(!Daylight);
SelectionImages[4] = GetIcon(BUILTIN_ICON_SELECTION).GetBest(!Daylight);
SelectionImages[0] = GetIcon(BUILTIN_SELECTION_BIG);
SelectionImages[2] = GetIcon(BUILTIN_SELECTION_SMALL);
SelectionImages[4] = GetIcon(BUILTIN_ICON_SELECTION);
DBG("assign buttons\n");
//buttons
for (INTN i = BUILTIN_RADIO_BUTTON; i <= BUILTIN_CHECKBOX_CHECKED; ++i) {
Buttons[i - BUILTIN_RADIO_BUTTON] = GetIcon(i);
Buttons[i - BUILTIN_RADIO_BUTTON] = GetIcon(i).GetBest(!Daylight);
}
DBG("done!\n");
//for (int i=0 ; i<6 ; i+=2 ) {
//SelectionImages[i].Draw(i*100, 0);
//}

View File

@ -88,7 +88,7 @@ EFI_STATUS XPointer::MouseBirth()
PointerImage = nullptr;
}
// Now update image because of other theme has other image
PointerImage = new XImage(ThemeX.GetIcon(BUILTIN_ICON_POINTER));
PointerImage = new XImage(ThemeX.GetIcon(BUILTIN_ICON_POINTER).GetBest(!ThemeX.Daylight));
oldImage.setSizeInPixels(PointerImage->GetWidth(), PointerImage->GetHeight());
LastClickTime = 0;
@ -107,8 +107,8 @@ EFI_STATUS XPointer::MouseBirth()
VOID XPointer::Draw()
{
oldPlace = newPlace;
// CopyMem(&oldPlace, &newPlace, sizeof(EG_RECT)); //can we use oldPlace = newPlace; ?
// take background image for later to restore background
// take background image for later to restore background
newPlace.Width = PointerImage->GetWidth();
newPlace.Height = PointerImage->GetHeight();
oldImage.GetArea(newPlace); //GetArea will resize oldImage, so correct newPlace

View File

@ -88,21 +88,22 @@ const INTN IconsNamesSize = sizeof(IconsNames) / sizeof(IconsNames[0]);
//icons class
//if ImageNight is not set then Image should be used
#define DEC_BUILTIN_ICON(id, ico) { \
Image.FromPNG(ACCESS_EMB_DATA(ico), ACCESS_EMB_SIZE(ico)); \
Empty = EFI_ERROR(Image.FromPNG(ACCESS_EMB_DATA(ico), ACCESS_EMB_SIZE(ico))); \
}
#define DEC_BUILTIN_ICON2(id, ico, dark) { \
Image.FromPNG(ACCESS_EMB_DATA(ico), ACCESS_EMB_SIZE(ico)); \
Empty = EFI_ERROR(Image.FromPNG(ACCESS_EMB_DATA(ico), ACCESS_EMB_SIZE(ico))); \
ImageNight.FromPNG(ACCESS_EMB_DATA(dark), ACCESS_EMB_SIZE(dark)); \
}
Icon::Icon(INTN Index, bool TakeEmbedded) : Image(), ImageNight()
XIcon::XIcon(INTN Index, bool TakeEmbedded) : Id(Index), Name(), Image(), ImageNight(), Native(false),
ImageSVG(nullptr), ImageSVGnight(nullptr)
{
Id = Index;
Name.setEmpty();
Native = false;
ImageSVG = nullptr;
ImageSVGnight = nullptr;
// Id = Index;
// Name.setEmpty();
// Native = false;
// ImageSVG = nullptr;
// ImageSVGnight = nullptr;
if (Index >= BUILTIN_ICON_FUNC_ABOUT && Index < IconsNamesSize) { //full table
Name.takeValueFrom(IconsNames[Index]);
}
@ -111,19 +112,24 @@ Icon::Icon(INTN Index, bool TakeEmbedded) : Image(), ImageNight()
}
}
Icon& Icon::operator=(const Icon& src)
XIcon& XIcon::operator=(const XIcon& src)
{
Id = src.Id;
Name = src.Name;
Image = src.Image;
ImageNight = src.ImageNight;
//this mment we copy pointers. Later it will be class variables
ImageSVG = src.ImageSVG;
ImageSVGnight = src.ImageSVGnight;
if (!src.isEmpty()) {
Image = src.Image;
if (!src.ImageNight.isEmpty()) {
ImageNight = src.ImageNight;
}
setFilled();
//this moment we copy pointers. Later it will be class variables
ImageSVG = src.ImageSVG;
ImageSVGnight = src.ImageSVGnight;
}
return *this;
}
void Icon::GetEmbedded()
void XIcon::GetEmbedded()
{
switch (Id) {
case BUILTIN_ICON_FUNC_ABOUT:
@ -216,7 +222,33 @@ void Icon::GetEmbedded()
//something to do else?
}
Icon::~Icon() {}
XIcon::~XIcon() {}
//copy from XImage for our purpose
EFI_STATUS XIcon::LoadXImage(EFI_FILE *BaseDir, const char* IconName)
{
return LoadXImage(BaseDir, XStringW().takeValueFrom(IconName));
}
EFI_STATUS XIcon::LoadXImage(EFI_FILE *BaseDir, const wchar_t* LIconName)
{
return LoadXImage(BaseDir, XStringW().takeValueFrom(LIconName));
}
//dont call this procedure for SVG theme BaseDir == NULL?
//it can be used for other files
EFI_STATUS XIcon::LoadXImage(EFI_FILE *BaseDir, const XStringW& IconName)
{
EFI_STATUS Status = Image.LoadXImage(BaseDir, IconName);
ImageNight.LoadXImage(BaseDir, IconName + L"_night"_XSW);
if (!EFI_ERROR(Status)) setFilled();
return Status;
}
const XImage& XIcon::GetBest(bool night) const
{
const XImage& RetImage = (night && !ImageNight.isEmpty())? ImageNight : Image;
return RetImage;
}
//xtheme class
XTheme::XTheme() {
@ -311,10 +343,10 @@ void XTheme::Init()
//}
static XImage NullImage;
static XImage DummyIcon;
static Icon NullIcon;
static XIcon DummyIcon;
static XIcon NullIcon;
const XImage& XTheme::GetIcon(const XString8& Name)
const XIcon& XTheme::GetIcon(const XString8& Name)
{
for (size_t i = 0; i < Icons.size(); i++)
{
@ -323,7 +355,7 @@ const XImage& XTheme::GetIcon(const XString8& Name)
return GetIcon(Icons[i].Id);
}
}
return NullImage; //if name is not found
return NullIcon; //if name is not found
}
bool XTheme::CheckNative(INTN Id)
@ -338,30 +370,18 @@ bool XTheme::CheckNative(INTN Id)
return false;
}
const XImage& XTheme::GetIcon(INTN Id)
const XIcon& XTheme::GetIcon(INTN Id)
{
return GetIconAlt(Id, -1);
}
const Icon& XTheme::TakeIcon(INTN Id)
{
for (size_t i = 0; i < Icons.size(); i++)
{
if (Icons[i].Id == Id)
{
return Icons[i];
}
}
return NullIcon;
}
/*
* Get Icon with this ID=id, for example VOL_INTERNAL_HFS
* if not found then search for ID=Alt with Native attribute set, for example VOL_INTERNAL
* if not found then check embedded with ID=Id
* if not found then check embedded with ID=Alt
*/
const XImage& XTheme::GetIconAlt(INTN Id, INTN Alt) //if not found then take embedded
const XIcon& XTheme::GetIconAlt(INTN Id, INTN Alt) //if not found then take embedded
{
INTN IdFound = -1;
INTN AltFound = -1;
@ -382,79 +402,84 @@ const XImage& XTheme::GetIconAlt(INTN Id, INTN Alt) //if not found then take emb
// using Alt icon
Icons[IdFound].Image = Icons[AltFound].Image;
Icons[IdFound].ImageNight = Icons[AltFound].ImageNight;
Icons[IdFound].setFilled();
} else {
// check for embedded with ID=Id
Icon *NewIcon = new Icon(Id, true);
XIcon *NewIcon = new XIcon(Id, true);
if (NewIcon->Image.isEmpty()) {
// check for embedded with ID=Alt
NewIcon = new Icon(Alt, true);
NewIcon = new XIcon(Alt, true);
}
if (!NewIcon->Image.isEmpty()) {
// using Embedded icon
Icons[IdFound].Image = NewIcon->Image;
Icons[IdFound].ImageNight = NewIcon->ImageNight;
Icons[IdFound].setFilled();
}
}
}
if (IdFound >= 0 && !Icons[IdFound].Image.isEmpty()) {
// icon not empty, return it
if (!Daylight && !Icons[IdFound].ImageNight.isEmpty()) {
DBG("got night icon %lld name{%s}\n", Id, IconsNames[IdFound]);
return Icons[IdFound].ImageNight;
}
// if (!Daylight && !Icons[IdFound].ImageNight.isEmpty()) {
// DBG("got night icon %lld name{%s}\n", Id, IconsNames[IdFound]);
// return Icons[IdFound].ImageNight;
// }
//if daylight or night icon absent
DBG("got day icon %lld name{%s}\n", Id, IconsNames[IdFound]);
return Icons[IdFound].Image;
// DBG("got day icon %lld name{%s}\n", Id, IconsNames[IdFound]);
// return Icons[IdFound].Image;
return Icons[IdFound]; //check daylight at draw
}
return NullImage; //such Id is not found in the database
return NullIcon; //such Id is not found in the database
}
const XImage& XTheme::LoadOSIcon(const CHAR16* OSIconName)
const XIcon& XTheme::LoadOSIcon(const CHAR16* OSIconName)
{
return LoadOSIcon(XString8().takeValueFrom(OSIconName));
}
const XImage& XTheme::LoadOSIcon(const XString8& Full)
const XIcon& XTheme::LoadOSIcon(const XString8& Full)
{
// input value can be L"win", L"ubuntu,linux", L"moja,mac" set by GetOSIconName (OSVersion)
XString8 First;
XString8 Second;
XString8 Third;
const XImage *ReturnImage;
const XIcon *ReturnIcon;
UINTN Comma = Full.indexOf(',');
UINTN Size = Full.length();
DBG("IconName=%s comma=%lld size=%lld\n", Full.c_str(), Comma, Size);
if (Comma != MAX_XSIZE) { //Comma
First = "os_"_XS8 + Full.subString(0, Comma);
ReturnImage = &GetIcon(First);
ReturnIcon = &GetIcon(First);
DBG(" first=%s\n", First.c_str());
if (!ReturnImage->isEmpty()) return *ReturnImage;
if (!ReturnIcon->isEmpty()) return *ReturnIcon;
//else search second name
Second = "os_"_XS8 + Full.subString(Comma + 1, Size - Comma - 1);
//moreover names can be triple L"chrome,grub,linux"
UINTN SecondComma = Second.indexOf(',');
if (Comma == MAX_XSIZE) {
ReturnImage = &GetIcon(Second);
if (!ReturnImage->isEmpty()) return *ReturnImage;
ReturnIcon = &GetIcon(Second);
if (!ReturnIcon->isEmpty()) return *ReturnIcon;
} else {
First = Second.subString(0, SecondComma);
ReturnImage = &GetIcon(First);
if (!ReturnImage->isEmpty()) return *ReturnImage;
ReturnIcon = &GetIcon(First);
if (!ReturnIcon->isEmpty()) return *ReturnIcon;
Third = "os_"_XS8 + Second.subString(SecondComma + 1, Size - SecondComma - 1);
ReturnImage = &GetIcon(Third);
if (!ReturnImage->isEmpty()) return *ReturnImage;
ReturnIcon = &GetIcon(Third);
if (!ReturnIcon->isEmpty()) return *ReturnIcon;
}
DBG(" Second=%s\n", Second.c_str());
if (!ReturnImage->isEmpty()) return *ReturnImage;
if (!ReturnIcon->isEmpty()) return *ReturnIcon;
} else {
ReturnImage = &GetIcon("os_"_XS8 + Full);
ReturnIcon = &GetIcon("os_"_XS8 + Full);
DBG(" Full=%s\n", Full.c_str());
if (!ReturnImage->isEmpty()) return *ReturnImage;
if (!ReturnIcon->isEmpty()) return *ReturnIcon;
}
// else something
if (DummyIcon.isEmpty()) //initialize once per session
DummyIcon.DummyImage(MainEntriesSize);
if (DummyIcon.isEmpty()) { //initialize once per session
DummyIcon.Image.DummyImage(MainEntriesSize);
DummyIcon.setFilled();
}
return DummyIcon;
}
@ -468,7 +493,7 @@ void XTheme::FillByEmbedded()
Icons.Empty();
for (INTN i = 0; i < BUILTIN_ICON_COUNT; ++i) { //this is embedded icon count
Icon* NewIcon = new Icon(i, true);
XIcon* NewIcon = new XIcon(i, true);
Icons.AddReference(NewIcon, true);
}
@ -628,7 +653,7 @@ void XTheme::FillByDir() //assume ThemeDir is defined by InitTheme() procedure
Icons.Empty();
for (INTN i = 0; i < IconsNamesSize; ++i) { //scan full table
Status = EFI_NOT_FOUND;
Icon* NewIcon = new Icon(i); //initialize without embedded
XIcon* NewIcon = new XIcon(i); //initialize without embedded
switch (i) {
case BUILTIN_SELECTION_SMALL:
Status = NewIcon->Image.LoadXImage(ThemeDir, SelectionSmallFileName);
@ -642,6 +667,7 @@ void XTheme::FillByDir() //assume ThemeDir is defined by InitTheme() procedure
}
NewIcon->Native = !EFI_ERROR(Status);
if (!EFI_ERROR(Status)) {
NewIcon->setFilled();
NewIcon->ImageNight.LoadXImage(ThemeDir, SWPrintf("%s_night", IconsNames[i]));
}
Icons.AddReference(NewIcon, true);
@ -652,10 +678,10 @@ void XTheme::FillByDir() //assume ThemeDir is defined by InitTheme() procedure
} else if (i == BUILTIN_SELECTION_BIG) {
GetIconAlt(i, BUILTIN_SELECTION_SMALL);
}
}
}
}
if (BootCampStyle) {
Icon *NewIcon = new Icon(BUILTIN_ICON_SELECTION);
XIcon *NewIcon = new XIcon(BUILTIN_ICON_SELECTION);
// load indicator selection image
Status = NewIcon->Image.LoadXImage(ThemeDir, SelectionIndicatorName);
if (EFI_ERROR(Status)) {
@ -668,18 +694,18 @@ void XTheme::FillByDir() //assume ThemeDir is defined by InitTheme() procedure
SelectionBackgroundPixel.Green = (SelectionColor >> 16) & 0xFF;
SelectionBackgroundPixel.Blue = (SelectionColor >> 8) & 0xFF;
SelectionBackgroundPixel.Reserved = (SelectionColor >> 0) & 0xFF;
SelectionImages[2] = GetIcon(BUILTIN_SELECTION_SMALL);
SelectionImages[0] = GetIcon(BUILTIN_SELECTION_BIG);
//TODO - make them XIcon
SelectionImages[2] = GetIcon(BUILTIN_SELECTION_SMALL).GetBest(!Daylight);
SelectionImages[0] = GetIcon(BUILTIN_SELECTION_BIG).GetBest(!Daylight);
if (BootCampStyle) {
SelectionImages[4] = GetIcon(BUILTIN_ICON_SELECTION);
SelectionImages[4] = GetIcon(BUILTIN_ICON_SELECTION).GetBest(!Daylight);
}
//and buttons
Buttons[0] = GetIcon(BUILTIN_RADIO_BUTTON);
Buttons[1] = GetIcon(BUILTIN_RADIO_BUTTON_SELECTED);
Buttons[2] = GetIcon(BUILTIN_CHECKBOX);
Buttons[3] = GetIcon(BUILTIN_CHECKBOX_CHECKED);
Buttons[0] = GetIcon(BUILTIN_RADIO_BUTTON).GetBest(!Daylight);
Buttons[1] = GetIcon(BUILTIN_RADIO_BUTTON_SELECTED).GetBest(!Daylight);
Buttons[2] = GetIcon(BUILTIN_CHECKBOX).GetBest(!Daylight);
Buttons[3] = GetIcon(BUILTIN_CHECKBOX_CHECKED).GetBest(!Daylight);
//load banner and background
Banner.LoadXImage(ThemeDir, BannerFileName);
@ -705,14 +731,14 @@ void XTheme::InitBar()
UpButtonImage.LoadXImage(ThemeDir, "scrollbar\\up_button");
DownButtonImage.LoadXImage(ThemeDir, "scrollbar\\down_button");
} else {
ScrollbarBackgroundImage = GetIcon("scrollbar_background"_XS8);
ScrollbarBackgroundImage = GetIcon("scrollbar_background"_XS8).GetBest(!Daylight);
BarStartImage.setEmpty();
BarEndImage.setEmpty();
ScrollbarImage = GetIcon("scrollbar_holder"_XS8); //"_night" is already accounting
ScrollStartImage = GetIcon("scrollbar_start"_XS8);
ScrollEndImage = GetIcon("scrollbar_end"_XS8);
UpButtonImage = GetIcon("scrollbar_up_button"_XS8);
DownButtonImage = GetIcon("scrollbar_down_button"_XS8);
ScrollbarImage = GetIcon("scrollbar_holder"_XS8).GetBest(!Daylight); //"_night" is already accounting
ScrollStartImage = GetIcon("scrollbar_start"_XS8).GetBest(!Daylight);
ScrollEndImage = GetIcon("scrollbar_end"_XS8).GetBest(!Daylight);
UpButtonImage = GetIcon("scrollbar_up_button"_XS8).GetBest(!Daylight);
DownButtonImage = GetIcon("scrollbar_down_button"_XS8).GetBest(!Daylight);
}
//some help with embedded scroll

View File

@ -11,7 +11,7 @@
extern const INTN IconsNamesSize;
#define INDICATOR_SIZE (52)
class Icon
class XIcon
{
public:
INTN Id; //for example BUILTIN_ICON_POINTER
@ -21,22 +21,33 @@ public:
bool Native;
void *ImageSVG; //NSVGimage*
void *ImageSVGnight;
Icon(): Id(0), Name(), Image(), ImageNight(), Native(false), ImageSVG(nullptr), ImageSVGnight(nullptr)
protected:
bool Empty;
public:
XIcon(): Id(0), Name(), Image(), ImageNight(), Native(false), ImageSVG(nullptr), ImageSVGnight(nullptr), Empty(true)
{};
Icon(INTN Id, bool Embedded = false);
~Icon();
XIcon(INTN Id, bool Embedded = false);
~XIcon();
bool isEmpty() const { return Empty; }
void setFilled() { Empty = false; }
void setEmpty() { Empty = true; }
EFI_STATUS LoadXImage(EFI_FILE *Dir, const XStringW& FileName); //for example LoadImage(ThemeDir, L"icons\\" + Name);
EFI_STATUS LoadXImage(EFI_FILE *Dir, const wchar_t* LIconName);
EFI_STATUS LoadXImage(EFI_FILE *Dir, const char* IconName);
// Default are not valid, as usual. We delete them. If needed, proper ones can be created
// Icon(const Icon&) = delete;
Icon& operator=(const Icon&); // = delete;
XIcon& operator=(const XIcon&); // = delete;
void GetEmbedded();
const XImage& GetBest(bool night) const;
};
class XTheme
{
public:
XObjArray<Icon> Icons;
XObjArray<XIcon> Icons;
EFI_FILE *ThemeDir;
// UINTN DisableFlags;
@ -130,14 +141,13 @@ public:
//fill the theme
// const XImage& GetIcon(const char* Name);
// const XImage& GetIcon(const CHAR16* Name);
const XImage& GetIcon(const XString8& Name); //get by name
const XImage& GetIcon(INTN Id); //get by id
const XImage& GetIconAlt(INTN Id, INTN Alt); //if id not found
const XImage& LoadOSIcon(const CHAR16* OSIconName); //TODO make XString provider
const XImage& LoadOSIcon(const XString8& Full);
const XIcon& GetIcon(const XString8& Name); //get by name
const XIcon& GetIcon(INTN Id); //get by id
const XIcon& GetIconAlt(INTN Id, INTN Alt); //if id not found
const XIcon& LoadOSIcon(const CHAR16* OSIconName); //TODO make XString provider
const XIcon& LoadOSIcon(const XString8& Full);
bool CheckNative(INTN Id);
const Icon& TakeIcon(INTN Id);
//fonts
void LoadFontImage(IN BOOLEAN UseEmbedded, IN INTN Rows, IN INTN Cols);
void PrepareFont();
@ -150,7 +160,7 @@ public:
VOID MeasureText(IN const XStringW& Text, OUT INTN *Width, OUT INTN *Height);
// void AddIcon(Icon& NewIcon); //return EFI_STATUS?
// void AddIcon(XIcon& NewIcon); //return EFI_STATUS?
void FillByEmbedded();
void FillByDir();
EFI_STATUS GetThemeTagSettings(void* DictPointer);

View File

@ -698,15 +698,15 @@ VOID LOADER_ENTRY::StartLoader()
if (InstallerVersion != NULL) { // string was found
InstallerVersion += 9; // advance to version location
if (AsciiStrnCmp(InstallerVersion, "10.7", 4) &&
AsciiStrnCmp(InstallerVersion, "10.8", 4) &&
AsciiStrnCmp(InstallerVersion, "10.9", 4) &&
AsciiStrnCmp(InstallerVersion, "10.10", 5) &&
AsciiStrnCmp(InstallerVersion, "10.11", 5) &&
AsciiStrnCmp(InstallerVersion, "10.12", 5) &&
AsciiStrnCmp(InstallerVersion, "10.13", 5) &&
AsciiStrnCmp(InstallerVersion, "10.14", 5) &&
AsciiStrnCmp(InstallerVersion, "10.15", 5)) {
if (strncmp(InstallerVersion, "10.7", 4) &&
strncmp(InstallerVersion, "10.8", 4) &&
strncmp(InstallerVersion, "10.9", 4) &&
strncmp(InstallerVersion, "10.10", 5) &&
strncmp(InstallerVersion, "10.11", 5) &&
strncmp(InstallerVersion, "10.12", 5) &&
strncmp(InstallerVersion, "10.13", 5) &&
strncmp(InstallerVersion, "10.14", 5) &&
strncmp(InstallerVersion, "10.15", 5)) {
InstallerVersion = NULL; // flag known version was not found
}
if (InstallerVersion != NULL) { // known version was found in image
@ -2494,12 +2494,15 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
MenuEntryOptions.Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_OPTIONS);
DBG("Options: IconID=%lld name=%s empty=%s\n", MenuEntryOptions.Image.Id, MenuEntryOptions.Image.Name.c_str(),
MenuEntryOptions.Image.isEmpty()?"пусто":"нет");
if (gSettings.DisableCloverHotkeys)
MenuEntryOptions.ShortcutLetter = 0x00;
MainMenu.AddMenuEntry(&MenuEntryOptions, false);
MenuEntryAbout.Image = ThemeX.GetIcon((INTN)BUILTIN_ICON_FUNC_ABOUT);
DBG("About: IconID=%lld name=%s empty=%s\n", MenuEntryAbout.Image.Id, MenuEntryAbout.Image.Name.c_str(),
MenuEntryAbout.Image.isEmpty()?"пусто":"нет");
if (gSettings.DisableCloverHotkeys)
MenuEntryAbout.ShortcutLetter = 0x00;
MainMenu.AddMenuEntry(&MenuEntryAbout, false);

View File

@ -1209,7 +1209,7 @@ VOID AboutRefit(VOID)
{
if (AboutMenu.Entries.size() == 0) {
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) {
AboutMenu.TitleImage = ThemeX.TakeIcon(BUILTIN_ICON_FUNC_ABOUT);
AboutMenu.TitleImage = ThemeX.GetIcon(BUILTIN_ICON_FUNC_ABOUT);
}
// else {
// AboutMenu.TitleImage.setEmpty(); //done in the constructor
@ -1263,7 +1263,7 @@ VOID HelpRefit(VOID)
{
if (HelpMenu.Entries.size() == 0) {
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) {
HelpMenu.TitleImage = ThemeX.TakeIcon(BUILTIN_ICON_FUNC_HELP);
HelpMenu.TitleImage = ThemeX.GetIcon(BUILTIN_ICON_FUNC_HELP);
}
//else {
// HelpMenu.TitleImage.setEmpty();
@ -1662,14 +1662,14 @@ REFIT_ABSTRACT_MENU_ENTRY* NewEntry_(REFIT_ABSTRACT_MENU_ENTRY *Entry, REFIT_MEN
if (CTitle) Entry->Title.takeValueFrom(CTitle);
else Entry->Title.setEmpty();
Entry->Image = OptionMenu.TitleImage.Image;
Entry->Image = OptionMenu.TitleImage;
Entry->AtClick = AtClick;
// create the submenu
// *SubScreen = (__typeof_am__(*SubScreen))AllocateZeroPool(sizeof(**SubScreen));
*SubScreen = new REFIT_MENU_SCREEN();
// (*SubScreen)->Title = EfiStrDuplicate(Entry->Title);
(*SubScreen)->Title = Entry->Title;
(*SubScreen)->TitleImage.Image = Entry->Image;
(*SubScreen)->TitleImage = Entry->Image;
(*SubScreen)->ID = ID;
(*SubScreen)->GetAnime();
Entry->SubScreen = *SubScreen;
@ -1702,7 +1702,6 @@ VOID ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry)
REFIT_ABSTRACT_MENU_ENTRY *SubMenuGraphics()
{
UINTN i, N, Ven = 97;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
@ -1715,10 +1714,10 @@ REFIT_ABSTRACT_MENU_ENTRY *SubMenuGraphics()
SubScreen->AddMenuItemInput(112, "Intel Max Backlight:", TRUE); //gSettings.IntelMaxValue
for (i = 0; i < NGFX; i++) {
for (UINTN i = 0; i < NGFX; i++) {
SubScreen->AddMenuInfo_f("----------------------");
SubScreen->AddMenuInfo_f("Card DeviceID=%04hx", gGraphics[i].DeviceID);
N = 20 + i * 6;
UINTN N = 20 + i * 6;
SubScreen->AddMenuItemInput(N, "Model:", TRUE);
if (gGraphics[i].Vendor == Nvidia) {
@ -1731,11 +1730,12 @@ REFIT_ABSTRACT_MENU_ENTRY *SubMenuGraphics()
SubScreen->AddMenuItemInput(N+1, "InjectX3", FALSE);
}
UINTN Ven = 97; //it can be used for non Ati, Nvidia, Intel in QEMU for example
if (gGraphics[i].Vendor == Nvidia) {
Ven = 95;
} else if (gGraphics[i].Vendor == Ati) {
Ven = 94;
} else /*if (gGraphics[i].Vendor == Intel)*/ {
} else if (gGraphics[i].Vendor == Intel) {
Ven = 96;
}
@ -2736,7 +2736,7 @@ VOID OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry)
if (OptionMenu.Entries.size() == 0) {
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) {
OptionMenu.TitleImage = ThemeX.TakeIcon(BUILTIN_ICON_FUNC_OPTIONS);
OptionMenu.TitleImage = ThemeX.GetIcon(BUILTIN_ICON_FUNC_OPTIONS);
}
//else {
// OptionMenu.TitleImage.setEmpty();