Adapt compiler options for compilation as a macOs app.

Rename CustomBoot to CustomLogoType, CustomLogo to CustomLogoImage.
This commit is contained in:
jief666 2021-03-20 17:29:34 +03:00
parent 2a029bd298
commit 11ca2c36c6
9 changed files with 193 additions and 116 deletions

View File

@ -2587,16 +2587,16 @@ RELEASE_XCODE8_*_MTOC_FLAGS = -align 0x20
# -Wno-varargs # -Wno-varargs
# -Wno-unused-const-variable # -Wno-unused-const-variable
DEFINE XCODE8_COMMON_FLAGS = -nostdinc -target x86_64-pc-win32-macho -c -Wall -Wextra -include AutoGen.h -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mms-bitfields -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings -mno-red-zone -fno-common -fdata-sections -ffreestanding -ffunction-sections -fno-asynchronous-unwind-tables -m64 -mabi=ms -mcmodel=small -DNO_MSABI_VA_FUNCS "-DEFIAPI=__attribute__((ms_abi))" -fno-strict-aliasing -Wno-unused-parameter DEFINE XCODE8_COMMON_FLAGS = -nostdinc -c -Wall -Wextra -include AutoGen.h -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mms-bitfields -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings -mno-red-zone -fno-common -fdata-sections -ffreestanding -ffunction-sections -fno-asynchronous-unwind-tables -m64 -mabi=ms -mcmodel=small -DNO_MSABI_VA_FUNCS -fno-strict-aliasing -Wno-unused-parameter
DEBUG_XCODE8_X64_CC_FLAGS = -g -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) DEBUG_XCODE8_X64_CC_FLAGS = -g -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) -target x86_64-pc-win32-macho "-DEFIAPI=__attribute__((ms_abi))"
DEBUGMACOS_XCODE8_X64_CC_FLAGS = -g -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) DEBUGMACOS_XCODE8_X64_CC_FLAGS = -g -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS)
RELEASE_XCODE8_X64_CC_FLAGS = -Os DEF(XCODE8_COMMON_FLAGS) -Werror RELEASE_XCODE8_X64_CC_FLAGS = -Os DEF(XCODE8_COMMON_FLAGS) -target x86_64-pc-win32-macho "-DEFIAPI=__attribute__((ms_abi))" -Werror
DEBUG_XCODE8_X64_CXX_FLAGS = -g -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) DEBUG_XCODE8_X64_CXX_FLAGS = -g -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) -target x86_64-pc-win32-macho "-DEFIAPI=__attribute__((ms_abi))"
DEBUGMACOS_XCODE8_X64_CXX_FLAGS = -g -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) DEBUGMACOS_XCODE8_X64_CXX_FLAGS = -g -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS)
RELEASE_XCODE8_X64_CXX_FLAGS = -Os DEF(XCODE8_COMMON_FLAGS) -Werror RELEASE_XCODE8_X64_CXX_FLAGS = -Os DEF(XCODE8_COMMON_FLAGS) -target x86_64-pc-win32-macho "-DEFIAPI=__attribute__((ms_abi))" -Werror
*_XCODE8_*_ASLCC_FLAGS = -x c -save-temps -g -O0 -fshort-wchar -fno-strict-aliasing -Wall -Werror -c -include AutoGen.h *_XCODE8_*_ASLCC_FLAGS = -x c -save-temps -g -O0 -fshort-wchar -fno-strict-aliasing -Wall -Werror -c -include AutoGen.h
*_XCODE8_*_ASLDLINK_FLAGS = -nostdlib -Wl,-e,_ReferenceAcpiTable,-preload,-segalign,0x20,-pie,-seg1addr,0x260,-read_only_relocs,suppress,-map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map *_XCODE8_*_ASLDLINK_FLAGS = -nostdlib -Wl,-e,_ReferenceAcpiTable,-preload,-segalign,0x20,-pie,-seg1addr,0x260,-read_only_relocs,suppress,-map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map

View File

@ -93,6 +93,11 @@
9A4C5778255ACAE8004F0B21 /* MacOsVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A4C5776255ACAE8004F0B21 /* MacOsVersion.h */; }; 9A4C5778255ACAE8004F0B21 /* MacOsVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A4C5776255ACAE8004F0B21 /* MacOsVersion.h */; };
9A4F68622449D4CB004B2F7E /* APFS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A105B4624483AE30006DE06 /* APFS.cpp */; }; 9A4F68622449D4CB004B2F7E /* APFS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A105B4624483AE30006DE06 /* APFS.cpp */; };
9A4F68652449D533004B2F7E /* APFS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A105B4624483AE30006DE06 /* APFS.cpp */; }; 9A4F68652449D533004B2F7E /* APFS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A105B4624483AE30006DE06 /* APFS.cpp */; };
9A54699B26063AB000CBC3DE /* XmlLiteParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A54699426063AB000CBC3DE /* XmlLiteParser.h */; };
9A54699C26063AB000CBC3DE /* XmlLiteSimpleTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A54699526063AB000CBC3DE /* XmlLiteSimpleTypes.h */; };
9A54699E26063AB000CBC3DE /* undefinable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A54699726063AB000CBC3DE /* undefinable.h */; };
9A54699F26063AB000CBC3DE /* XmlLiteParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A54699826063AB000CBC3DE /* XmlLiteParser.cpp */; };
9A5469A126063AB000CBC3DE /* XmlLiteCompositeTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A54699A26063AB000CBC3DE /* XmlLiteCompositeTypes.h */; };
9A61B3002522165100AEE0FA /* Self.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A61B2FE2522165100AEE0FA /* Self.cpp */; }; 9A61B3002522165100AEE0FA /* Self.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A61B2FE2522165100AEE0FA /* Self.cpp */; };
9A61B3012522165100AEE0FA /* Self.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A61B2FF2522165100AEE0FA /* Self.h */; }; 9A61B3012522165100AEE0FA /* Self.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A61B2FF2522165100AEE0FA /* Self.h */; };
9A637AE82430D927000B9474 /* XTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E3262F2428F4EE002240E8 /* XTheme.cpp */; }; 9A637AE82430D927000B9474 /* XTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E3262F2428F4EE002240E8 /* XTheme.cpp */; };
@ -719,6 +724,13 @@
9A4185B52439F29D00BEAFB8 /* LoadOptions_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadOptions_test.cpp; sourceTree = "<group>"; }; 9A4185B52439F29D00BEAFB8 /* LoadOptions_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadOptions_test.cpp; sourceTree = "<group>"; };
9A4C5775255ACAE7004F0B21 /* MacOsVersion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacOsVersion.cpp; sourceTree = "<group>"; }; 9A4C5775255ACAE7004F0B21 /* MacOsVersion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacOsVersion.cpp; sourceTree = "<group>"; };
9A4C5776255ACAE8004F0B21 /* MacOsVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacOsVersion.h; sourceTree = "<group>"; }; 9A4C5776255ACAE8004F0B21 /* MacOsVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacOsVersion.h; sourceTree = "<group>"; };
9A54699426063AB000CBC3DE /* XmlLiteParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlLiteParser.h; sourceTree = "<group>"; };
9A54699526063AB000CBC3DE /* XmlLiteSimpleTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlLiteSimpleTypes.h; sourceTree = "<group>"; };
9A54699626063AB000CBC3DE /* XmlLiteCompositeTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XmlLiteCompositeTypes.cpp; sourceTree = "<group>"; };
9A54699726063AB000CBC3DE /* undefinable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = undefinable.h; sourceTree = "<group>"; };
9A54699826063AB000CBC3DE /* XmlLiteParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XmlLiteParser.cpp; sourceTree = "<group>"; };
9A54699926063AB000CBC3DE /* XmlLiteSimpleTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XmlLiteSimpleTypes.cpp; sourceTree = "<group>"; };
9A54699A26063AB000CBC3DE /* XmlLiteCompositeTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlLiteCompositeTypes.h; sourceTree = "<group>"; };
9A61B2FE2522165100AEE0FA /* Self.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Self.cpp; sourceTree = "<group>"; }; 9A61B2FE2522165100AEE0FA /* Self.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Self.cpp; sourceTree = "<group>"; };
9A61B2FF2522165100AEE0FA /* Self.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Self.h; sourceTree = "<group>"; }; 9A61B2FF2522165100AEE0FA /* Self.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Self.h; sourceTree = "<group>"; };
9A63C6CA24EBEF78000EB836 /* Version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Version.h; path = ../../Version.h; sourceTree = "<group>"; }; 9A63C6CA24EBEF78000EB836 /* Version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Version.h; path = ../../Version.h; sourceTree = "<group>"; };
@ -979,6 +991,20 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
9A54699326063AB000CBC3DE /* cpp_lib */ = {
isa = PBXGroup;
children = (
9A54699726063AB000CBC3DE /* undefinable.h */,
9A54699426063AB000CBC3DE /* XmlLiteParser.h */,
9A54699526063AB000CBC3DE /* XmlLiteSimpleTypes.h */,
9A54699626063AB000CBC3DE /* XmlLiteCompositeTypes.cpp */,
9A54699826063AB000CBC3DE /* XmlLiteParser.cpp */,
9A54699926063AB000CBC3DE /* XmlLiteSimpleTypes.cpp */,
9A54699A26063AB000CBC3DE /* XmlLiteCompositeTypes.h */,
);
path = cpp_lib;
sourceTree = "<group>";
};
9AA3912D25CC65820099DC1F /* Posix */ = { 9AA3912D25CC65820099DC1F /* Posix */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -1068,6 +1094,7 @@
9AC77EC924176C04005CDD5C /* rEFIt_UEFI */ = { 9AC77EC924176C04005CDD5C /* rEFIt_UEFI */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9A54699326063AB000CBC3DE /* cpp_lib */,
9AC77FAB24176C04005CDD5C /* cpp_foundation */, 9AC77FAB24176C04005CDD5C /* cpp_foundation */,
9AC77ECA24176C04005CDD5C /* cpp_unit_test */, 9AC77ECA24176C04005CDD5C /* cpp_unit_test */,
9AC77F9F24176C04005CDD5C /* cpp_util */, 9AC77F9F24176C04005CDD5C /* cpp_util */,
@ -1423,6 +1450,7 @@
9AEFE64624E2A7D1005D56D8 /* XIcon.h in Headers */, 9AEFE64624E2A7D1005D56D8 /* XIcon.h in Headers */,
9A105B2D24464A830006DE06 /* BmLib.h in Headers */, 9A105B2D24464A830006DE06 /* BmLib.h in Headers */,
9AF4173F242F15CC00D2644C /* BootLog.h in Headers */, 9AF4173F242F15CC00D2644C /* BootLog.h in Headers */,
9A5469A126063AB000CBC3DE /* XmlLiteCompositeTypes.h in Headers */,
9AC77FC024176C04005CDD5C /* XObjArray_tests.h in Headers */, 9AC77FC024176C04005CDD5C /* XObjArray_tests.h in Headers */,
9AC7801D24176C04005CDD5C /* Events.h in Headers */, 9AC7801D24176C04005CDD5C /* Events.h in Headers */,
9AF41562242BABC700D2644C /* printlib-test-cpp_conf.h in Headers */, 9AF41562242BABC700D2644C /* printlib-test-cpp_conf.h in Headers */,
@ -1465,6 +1493,7 @@
9AC7807A24176C04005CDD5C /* lib.h in Headers */, 9AC7807A24176C04005CDD5C /* lib.h in Headers */,
9AC7803524176C04005CDD5C /* b64cdecode.h in Headers */, 9AC7803524176C04005CDD5C /* b64cdecode.h in Headers */,
9AC7805224176C04005CDD5C /* EfiFileLib.h in Headers */, 9AC7805224176C04005CDD5C /* EfiFileLib.h in Headers */,
9A54699B26063AB000CBC3DE /* XmlLiteParser.h in Headers */,
9AEFE64D24E2C64B005D56D8 /* XRBuffer.h in Headers */, 9AEFE64D24E2C64B005D56D8 /* XRBuffer.h in Headers */,
9AC7807324176C04005CDD5C /* menu_globals.h in Headers */, 9AC7807324176C04005CDD5C /* menu_globals.h in Headers */,
9AC7809824176C04005CDD5C /* XObjArray.h in Headers */, 9AC7809824176C04005CDD5C /* XObjArray.h in Headers */,
@ -1533,7 +1562,9 @@
9AD469552452B63300D6D0DB /* XToolsConf.h in Headers */, 9AD469552452B63300D6D0DB /* XToolsConf.h in Headers */,
9AD469512452B5A600D6D0DB /* Devices.h in Headers */, 9AD469512452B5A600D6D0DB /* Devices.h in Headers */,
9A28CC98241AB34800F3D247 /* XString_test.h in Headers */, 9A28CC98241AB34800F3D247 /* XString_test.h in Headers */,
9A54699E26063AB000CBC3DE /* undefinable.h in Headers */,
9AA3917D25CC65830099DC1F /* plist.h in Headers */, 9AA3917D25CC65830099DC1F /* plist.h in Headers */,
9A54699C26063AB000CBC3DE /* XmlLiteSimpleTypes.h in Headers */,
9A80B49F2540175E00E56B08 /* OC.h in Headers */, 9A80B49F2540175E00E56B08 /* OC.h in Headers */,
9AA3916225CC65830099DC1F /* posix.h in Headers */, 9AA3916225CC65830099DC1F /* posix.h in Headers */,
9A61B3012522165100AEE0FA /* Self.h in Headers */, 9A61B3012522165100AEE0FA /* Self.h in Headers */,
@ -2012,6 +2043,7 @@
9AC7804C24176C04005CDD5C /* VectorGraphics.cpp in Sources */, 9AC7804C24176C04005CDD5C /* VectorGraphics.cpp in Sources */,
9AC7805E24176C04005CDD5C /* common.cpp in Sources */, 9AC7805E24176C04005CDD5C /* common.cpp in Sources */,
9AA3917225CC65830099DC1F /* TagDict.cpp in Sources */, 9AA3917225CC65830099DC1F /* TagDict.cpp in Sources */,
9A54699F26063AB000CBC3DE /* XmlLiteParser.cpp in Sources */,
9AC7804924176C04005CDD5C /* egemb_icons.cpp in Sources */, 9AC7804924176C04005CDD5C /* egemb_icons.cpp in Sources */,
9AC7801124176C04005CDD5C /* Edid.cpp in Sources */, 9AC7801124176C04005CDD5C /* Edid.cpp in Sources */,
9A61B3002522165100AEE0FA /* Self.cpp in Sources */, 9A61B3002522165100AEE0FA /* Self.cpp in Sources */,

View File

@ -559,40 +559,40 @@ LoadUserSettings (
return Status; return Status;
} }
STATIC BOOLEAN AddCustomLoaderEntry(IN CUSTOM_LOADER_ENTRY *Entry) //STATIC BOOLEAN AddCustomLoaderEntry(IN CUSTOM_LOADER_ENTRY *Entry)
{ //{
if (Entry == NULL) return FALSE; // if (Entry == NULL) return FALSE;
gSettings.GUI.CustomEntries.AddReference(Entry, true); // gSettings.GUI.CustomEntries.AddReference(Entry, true);
return TRUE; // return TRUE;
} //}
STATIC BOOLEAN AddCustomLegacyEntry (IN CUSTOM_LEGACY_ENTRY *Entry) //STATIC BOOLEAN AddCustomLegacyEntry (IN CUSTOM_LEGACY_ENTRY *Entry)
{ //{
if (Entry == NULL) return FALSE; // if (Entry == NULL) return FALSE;
gSettings.GUI.CustomLegacy.AddReference(Entry, true); // gSettings.GUI.CustomLegacy.AddReference(Entry, true);
return TRUE; // return TRUE;
} //}
STATIC //STATIC
BOOLEAN //BOOLEAN
AddCustomToolEntry ( //AddCustomToolEntry (
IN CUSTOM_TOOL_ENTRY *Entry // IN CUSTOM_TOOL_ENTRY *Entry
) // )
{ //{
if (Entry == NULL) return FALSE; // if (Entry == NULL) return FALSE;
gSettings.GUI.CustomTool.AddReference(Entry, true); // gSettings.GUI.CustomTool.AddReference(Entry, true);
return TRUE; // return TRUE;
} //}
STATIC //STATIC
BOOLEAN //BOOLEAN
AddCustomSubEntry ( //AddCustomSubEntry (
IN OUT CUSTOM_LOADER_ENTRY *Entry, // IN OUT CUSTOM_LOADER_ENTRY *Entry,
IN CUSTOM_LOADER_ENTRY *SubEntry) // IN CUSTOM_LOADER_ENTRY *SubEntry)
{ //{
if ((Entry == NULL) || (SubEntry == NULL)) return FALSE; // if ((Entry == NULL) || (SubEntry == NULL)) return FALSE;
Entry->SubEntries.AddReference(Entry, true); // Entry->SubEntries.AddReference(Entry, true);
return TRUE; // return TRUE;
} //}
STATIC STATIC
@ -622,8 +622,10 @@ CUSTOM_LOADER_ENTRY
DuplicateEntry->Type = Entry->Type; DuplicateEntry->Type = Entry->Type;
DuplicateEntry->VolumeType = Entry->VolumeType; DuplicateEntry->VolumeType = Entry->VolumeType;
DuplicateEntry->KernelScan = Entry->KernelScan; DuplicateEntry->KernelScan = Entry->KernelScan;
DuplicateEntry->CustomBoot = Entry->CustomBoot; DuplicateEntry->CustomLogoType = Entry->CustomLogoType;
DuplicateEntry->CustomLogo = Entry->CustomLogo; DuplicateEntry->CustomLogoAsXString8 = Entry->CustomLogoAsXString8;
DuplicateEntry->CustomLogoAsData = Entry->CustomLogoAsData;
DuplicateEntry->CustomLogoImage = Entry->CustomLogoImage;
// CopyKernelAndKextPatches (&DuplicateEntry->KernelAndKextPatches, &Entry->KernelAndKextPatches); // CopyKernelAndKextPatches (&DuplicateEntry->KernelAndKextPatches, &Entry->KernelAndKextPatches);
DuplicateEntry->KernelAndKextPatches = Entry->KernelAndKextPatches; DuplicateEntry->KernelAndKextPatches = Entry->KernelAndKextPatches;
} }
@ -1420,14 +1422,11 @@ FillinCustomEntry (
{ {
const TagStruct* Prop; const TagStruct* Prop;
if ((Entry == NULL) || (DictPointer == NULL)) { if ( Entry == NULL ) panic("Entry == NULL");
return FALSE; if ( DictPointer == NULL ) panic("DictPointer == NULL");
}
Prop = DictPointer->propertyForKey("Disabled"); Prop = DictPointer->propertyForKey("Disabled");
if (IsPropertyNotNullAndTrue(Prop)) { Entry->Disabled = IsPropertyNotNullAndTrue(Prop);
return FALSE;
}
Prop = DictPointer->propertyForKey("Volume"); Prop = DictPointer->propertyForKey("Volume");
if (Prop != NULL && (Prop->isString())) { if (Prop != NULL && (Prop->isString())) {
@ -1473,6 +1472,7 @@ FillinCustomEntry (
Entry->FullTitle = Prop->getString()->stringValue(); Entry->FullTitle = Prop->getString()->stringValue();
} }
Entry->ImageData.setEmpty();
Prop = DictPointer->propertyForKey("Image"); Prop = DictPointer->propertyForKey("Image");
if (Prop != NULL) { if (Prop != NULL) {
Entry->ImagePath.setEmpty(); Entry->ImagePath.setEmpty();
@ -1485,13 +1485,15 @@ FillinCustomEntry (
UINTN DataLen = 0; UINTN DataLen = 0;
UINT8 *TmpData = GetDataSetting (DictPointer, "ImageData", &DataLen); UINT8 *TmpData = GetDataSetting (DictPointer, "ImageData", &DataLen);
if (TmpData) { if (TmpData) {
Entry->ImageData.stealValueFrom(TmpData, DataLen);
// TODO remove from settings
if (!EFI_ERROR(Entry->Image.Image.FromPNG(TmpData, DataLen))) { if (!EFI_ERROR(Entry->Image.Image.FromPNG(TmpData, DataLen))) {
Entry->Image.setFilled(); Entry->Image.setFilled();
} }
FreePool(TmpData);
} }
} }
Entry->DriveImageData.setEmpty();
Prop = DictPointer->propertyForKey("DriveImage"); Prop = DictPointer->propertyForKey("DriveImage");
if (Prop != NULL) { if (Prop != NULL) {
Entry->DriveImagePath.setEmpty(); Entry->DriveImagePath.setEmpty();
@ -1504,6 +1506,8 @@ FillinCustomEntry (
UINTN DataLen = 0; UINTN DataLen = 0;
UINT8 *TmpData = GetDataSetting (DictPointer, "DriveImageData", &DataLen); UINT8 *TmpData = GetDataSetting (DictPointer, "DriveImageData", &DataLen);
if (TmpData) { if (TmpData) {
Entry->DriveImageData.stealValueFrom(TmpData, DataLen);
// TODO remove from settings
if (!EFI_ERROR(Entry->DriveImage.Image.FromPNG(TmpData, DataLen))) { if (!EFI_ERROR(Entry->DriveImage.Image.FromPNG(TmpData, DataLen))) {
Entry->DriveImage.setFilled(); Entry->DriveImage.setFilled();
} }
@ -1522,36 +1526,40 @@ FillinCustomEntry (
Prop = DictPointer->propertyForKey("CustomLogo"); Prop = DictPointer->propertyForKey("CustomLogo");
if (Prop != NULL) { if (Prop != NULL) {
if (IsPropertyNotNullAndTrue(Prop)) { if (IsPropertyNotNullAndTrue(Prop)) {
Entry->CustomBoot = CUSTOM_BOOT_APPLE; Entry->CustomLogoType = CUSTOM_BOOT_APPLE;
} else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) { } else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
Entry->CustomLogoAsXString8 = Prop->getString()->stringValue();
if (Prop->getString()->stringValue().equalIC("Apple")) { if (Prop->getString()->stringValue().equalIC("Apple")) {
Entry->CustomBoot = CUSTOM_BOOT_APPLE; Entry->CustomLogoType = CUSTOM_BOOT_APPLE;
} else if (Prop->getString()->stringValue().equalIC("Alternate")) { } else if (Prop->getString()->stringValue().equalIC("Alternate")) {
Entry->CustomBoot = CUSTOM_BOOT_ALT_APPLE; Entry->CustomLogoType = CUSTOM_BOOT_ALT_APPLE;
} else if (Prop->getString()->stringValue().equalIC("Theme")) { } else if (Prop->getString()->stringValue().equalIC("Theme")) {
Entry->CustomBoot = CUSTOM_BOOT_THEME; Entry->CustomLogoType = CUSTOM_BOOT_THEME;
} else { } else {
XStringW customLogo = XStringW() = Prop->getString()->stringValue(); XStringW customLogo = XStringW() = Prop->getString()->stringValue();
Entry->CustomBoot = CUSTOM_BOOT_USER; Entry->CustomLogoType = CUSTOM_BOOT_USER;
Entry->CustomLogo.LoadXImage(&self.getSelfVolumeRootDir(), customLogo); // TODO : remove reading of image from settings
if (Entry->CustomLogo.isEmpty()) { Entry->CustomLogoImage.LoadXImage(&self.getSelfVolumeRootDir(), customLogo);
if (Entry->CustomLogoImage.isEmpty()) {
DBG("Custom boot logo not found at path `%ls`!\n", customLogo.wc_str()); DBG("Custom boot logo not found at path `%ls`!\n", customLogo.wc_str());
Entry->CustomBoot = CUSTOM_BOOT_DISABLED; Entry->CustomLogoType = CUSTOM_BOOT_DISABLED;
} }
} }
} else if ( Prop->isData() && Prop->getData()->dataLenValue() > 0 ) { } else if ( Prop->isData() && Prop->getData()->dataLenValue() > 0 ) {
Entry->CustomBoot = CUSTOM_BOOT_USER; Entry->CustomLogoType = CUSTOM_BOOT_USER;
Entry->CustomLogo.FromPNG(Prop->getData()->dataValue(), Prop->getData()->dataLenValue()); Entry->CustomLogoAsData = Prop->getData()->data();
if (Entry->CustomLogo.isEmpty()) { // TODO : remove reading of image from settings
Entry->CustomLogoImage.FromPNG(Prop->getData()->dataValue(), Prop->getData()->dataLenValue());
if (Entry->CustomLogoImage.isEmpty()) {
DBG("Custom boot logo not decoded from data!\n"/*, Prop->getString()->stringValue().c_str()*/); DBG("Custom boot logo not decoded from data!\n"/*, Prop->getString()->stringValue().c_str()*/);
Entry->CustomBoot = CUSTOM_BOOT_DISABLED; Entry->CustomLogoType = CUSTOM_BOOT_DISABLED;
} }
} else { } else {
Entry->CustomBoot = CUSTOM_BOOT_USER_DISABLED; Entry->CustomLogoType = CUSTOM_BOOT_USER_DISABLED;
} }
DBG("Custom entry boot %s LogoWidth = (0x%lld)\n", CustomBootModeToStr(Entry->CustomBoot), Entry->CustomLogo.GetWidth()); DBG("Custom entry boot %s LogoWidth = (0x%lld)\n", CustomBootModeToStr(Entry->CustomLogoType), Entry->CustomLogoImage.GetWidth());
} else { } else {
Entry->CustomBoot = CUSTOM_BOOT_DISABLED; Entry->CustomLogoType = CUSTOM_BOOT_DISABLED;
} }
Prop = DictPointer->propertyForKey("BootBgColor"); Prop = DictPointer->propertyForKey("BootBgColor");
@ -1595,6 +1603,7 @@ FillinCustomEntry (
Entry->Type = OSTYPE_WINEFI; Entry->Type = OSTYPE_WINEFI;
} else if (Prop->getString()->stringValue().equalIC("Linux")) { } else if (Prop->getString()->stringValue().equalIC("Linux")) {
Entry->Type = OSTYPE_LIN; Entry->Type = OSTYPE_LIN;
// TODO remove from here
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NODEFAULTARGS); Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NODEFAULTARGS);
} else if (Prop->getString()->stringValue().equalIC("LinuxKernel")) { } else if (Prop->getString()->stringValue().equalIC("LinuxKernel")) {
Entry->Type = OSTYPE_LINEFI; Entry->Type = OSTYPE_LINEFI;
@ -1642,16 +1651,21 @@ FillinCustomEntry (
Prop = DictPointer->propertyForKey("InjectKexts"); Prop = DictPointer->propertyForKey("InjectKexts");
if (Prop != NULL) { if (Prop != NULL) {
if ( Prop->isTrueOrYes() ) { if ( Prop->isTrueOrYes() ) {
Entry->InjectKexts = 1;
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS); Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS);
} else if ( Prop->isFalseOrNn() ) { } else if ( Prop->isFalseOrNn() ) {
Entry->InjectKexts = 0;
// nothing to do // nothing to do
} else if ( Prop->isString() && Prop->getString()->stringValue().equalIC("Detect") ) { } else if ( Prop->isString() && Prop->getString()->stringValue().equalIC("Detect") ) {
Entry->InjectKexts = 2;
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_CHECKFAKESMC); Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_CHECKFAKESMC);
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS); Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS);
} else { } else {
Entry->InjectKexts = -1;
DBG("** Warning: unknown custom entry InjectKexts value '%s'\n", Prop->getString()->stringValue().c_str()); DBG("** Warning: unknown custom entry InjectKexts value '%s'\n", Prop->getString()->stringValue().c_str());
} }
} else { } else {
Entry->InjectKexts = -1;
// Use global settings // Use global settings
if (gSettings.WithKexts) { if (gSettings.WithKexts) {
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS); Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS);
@ -1733,10 +1747,10 @@ FillinCustomEntry (
// Allocate a sub entry // Allocate a sub entry
CustomSubEntry = DuplicateCustomEntry (Entry); CustomSubEntry = DuplicateCustomEntry (Entry);
if (CustomSubEntry) { if (CustomSubEntry) {
if (!FillinCustomEntry (CustomSubEntry, Dict, TRUE) || !AddCustomSubEntry (Entry, CustomSubEntry)) { if ( FillinCustomEntry(CustomSubEntry, Dict, TRUE) ) {
if (CustomSubEntry) { Entry->SubEntries.AddReference(CustomSubEntry, true);
FreePool(CustomSubEntry); }else{
} delete CustomSubEntry;
} }
} }
} }
@ -1937,10 +1951,18 @@ FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY *Entry, const TagDict* DictPointer)
return TRUE; return TRUE;
} }
/*
* To ease copy/paste and text replacement from GetUserSettings, the parameter has the same name as the global
* and is passed by non-const reference.
* This temporary during the refactoring
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
// EDID reworked by Sherlocks // EDID reworked by Sherlocks
static void static void
GetEDIDSettings(const TagDict* DictPointer, SETTINGS_DATA& gSettings) GetEDIDSettings(const TagDict* DictPointer, SETTINGS_DATA& gSettings)
{ {
#pragma GCC diagnostic pop
const TagStruct* Prop; const TagStruct* Prop;
const TagDict* Dict; const TagDict* Dict;
UINTN j = 128; UINTN j = 128;
@ -2259,17 +2281,17 @@ EFI_STATUS GetEarlyUserSettings (
Prop = BootDict->propertyForKey("CustomLogo"); Prop = BootDict->propertyForKey("CustomLogo");
if (Prop != NULL) { if (Prop != NULL) {
if (IsPropertyNotNullAndTrue(Prop)) { if (IsPropertyNotNullAndTrue(Prop)) {
gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_APPLE; gSettings.Boot.CustomLogoType = CUSTOM_BOOT_APPLE;
} else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) { } else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
gSettings.Boot.CustomLogoAsXString8 = Prop->getString()->stringValue(); gSettings.Boot.CustomLogoAsXString8 = Prop->getString()->stringValue();
if (Prop->getString()->stringValue().equalIC("Apple")) { if (Prop->getString()->stringValue().equalIC("Apple")) {
gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_APPLE; gSettings.Boot.CustomLogoType = CUSTOM_BOOT_APPLE;
} else if (Prop->getString()->stringValue().equalIC("Alternate")) { } else if (Prop->getString()->stringValue().equalIC("Alternate")) {
gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_ALT_APPLE; gSettings.Boot.CustomLogoType = CUSTOM_BOOT_ALT_APPLE;
} else if (Prop->getString()->stringValue().equalIC("Theme")) { } else if (Prop->getString()->stringValue().equalIC("Theme")) {
gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_THEME; gSettings.Boot.CustomLogoType = CUSTOM_BOOT_THEME;
} else { } else {
gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_USER; gSettings.Boot.CustomLogoType = CUSTOM_BOOT_USER;
// if (settingsData.Boot.CustomLogo != NULL) { // if (settingsData.Boot.CustomLogo != NULL) {
// delete settingsData.Boot.CustomLogo; // delete settingsData.Boot.CustomLogo;
// } // }
@ -2282,7 +2304,7 @@ EFI_STATUS GetEarlyUserSettings (
} }
} else if ( Prop->isData() && Prop->getData()->dataLenValue() > 0 ) { } else if ( Prop->isData() && Prop->getData()->dataLenValue() > 0 ) {
gSettings.Boot.CustomLogoAsData = Prop->getData()->data(); gSettings.Boot.CustomLogoAsData = Prop->getData()->data();
gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_USER; gSettings.Boot.CustomLogoType = CUSTOM_BOOT_USER;
// if (settingsData.Boot.CustomLogo != NULL) { // if (settingsData.Boot.CustomLogo != NULL) {
// delete settingsData.Boot.CustomLogo; // delete settingsData.Boot.CustomLogo;
// } // }
@ -2293,10 +2315,10 @@ EFI_STATUS GetEarlyUserSettings (
// settingsData.Boot.CustomBoot = CUSTOM_BOOT_DISABLED; // settingsData.Boot.CustomBoot = CUSTOM_BOOT_DISABLED;
// } // }
} else { } else {
gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_USER_DISABLED; gSettings.Boot.CustomLogoType = CUSTOM_BOOT_USER_DISABLED;
} }
} else { } else {
gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_DISABLED; gSettings.Boot.CustomLogoType = CUSTOM_BOOT_DISABLED;
} }
} }
@ -2583,7 +2605,9 @@ EFI_STATUS GetEarlyUserSettings (
// Allocate an entry // Allocate an entry
CUSTOM_LOADER_ENTRY* Entry = new CUSTOM_LOADER_ENTRY; CUSTOM_LOADER_ENTRY* Entry = new CUSTOM_LOADER_ENTRY;
// Fill it in // Fill it in
if ( !FillinCustomEntry(Entry, Dict3, FALSE) || !AddCustomLoaderEntry(Entry) ) { if ( FillinCustomEntry(Entry, Dict3, FALSE) ) {
gSettings.GUI.CustomEntries.AddReference(Entry, true);
}else{
delete Entry; delete Entry;
} }
} }
@ -2600,7 +2624,9 @@ EFI_STATUS GetEarlyUserSettings (
// Allocate an entry // Allocate an entry
Entry = new CUSTOM_LEGACY_ENTRY; Entry = new CUSTOM_LEGACY_ENTRY;
// Fill it in // Fill it in
if (!FillingCustomLegacy(Entry, Dict3) || !AddCustomLegacyEntry(Entry)) { if ( FillingCustomLegacy(Entry, Dict3) ) {
gSettings.GUI.CustomLegacy.AddReference(Entry, true);
}else{
delete Entry; delete Entry;
} }
} }
@ -2617,7 +2643,9 @@ EFI_STATUS GetEarlyUserSettings (
// Allocate an entry // Allocate an entry
Entry = new CUSTOM_TOOL_ENTRY; Entry = new CUSTOM_TOOL_ENTRY;
// Fill it in // Fill it in
if (!FillingCustomTool(Entry, Dict3) || !AddCustomToolEntry(Entry)) { if ( FillingCustomTool(Entry, Dict3) ) {
gSettings.GUI.CustomTool.AddReference(Entry, true);
}else{
delete Entry; delete Entry;
} }
} }
@ -3372,8 +3400,16 @@ ParseSMBIOSSettings(
} }
} }
/*
* To ease copy/paste and text replacement from GetUserSettings, the parameter has the same name as the global
* and is passed by non-const reference.
* This temporary during the refactoring
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
static void getACPISettings(const TagDict *CfgDict, SETTINGS_DATA& gSettings) static void getACPISettings(const TagDict *CfgDict, SETTINGS_DATA& gSettings)
{ {
#pragma GCC diagnostic pop
const TagDict* ACPIDict = CfgDict->dictPropertyForKey("ACPI"); const TagDict* ACPIDict = CfgDict->dictPropertyForKey("ACPI");
if (ACPIDict) { if (ACPIDict) {
const TagArray* DropTablesArray = ACPIDict->arrayPropertyForKey("DropTables"); // array of dict const TagArray* DropTablesArray = ACPIDict->arrayPropertyForKey("DropTables"); // array of dict

View File

@ -10,7 +10,7 @@
#include "KERNEL_AND_KEXT_PATCHES.h" #include "KERNEL_AND_KEXT_PATCHES.h"
#include "../libeg/XIcon.h" #include "../libeg/XIcon.h"
#include "../cpp_lib/undefinable.h" #include "../cpp_lib/undefinable.h"
#include "../entry_scan/loader.h" // for KERNEL_SCAN_xxx constants
#define CLOVER_SIGN SIGNATURE_32('C','l','v','r') #define CLOVER_SIGN SIGNATURE_32('C','l','v','r')
@ -153,11 +153,14 @@ public:
class CUSTOM_LOADER_ENTRY class CUSTOM_LOADER_ENTRY
{ {
public: public:
bool Disabled = 0;
XObjArray<CUSTOM_LOADER_ENTRY> SubEntries = XObjArray<CUSTOM_LOADER_ENTRY>(); XObjArray<CUSTOM_LOADER_ENTRY> SubEntries = XObjArray<CUSTOM_LOADER_ENTRY>();
XIcon Image = XIcon(); XIcon Image = XIcon(); // todo remove
XIcon DriveImage = XIcon();
XStringW ImagePath = XStringW(); XStringW ImagePath = XStringW();
XBuffer<UINT8> ImageData = XBuffer<UINT8>();
XIcon DriveImage = XIcon();
XStringW DriveImagePath = XStringW(); XStringW DriveImagePath = XStringW();
XBuffer<UINT8> DriveImageData = XBuffer<UINT8>();
XStringW Volume = XStringW(); XStringW Volume = XStringW();
XStringW Path = XStringW(); XStringW Path = XStringW();
XString8Array LoadOptions = XString8Array(); XString8Array LoadOptions = XString8Array();
@ -171,12 +174,15 @@ public:
bool Hidden = 0; bool Hidden = 0;
UINT8 Type = 0; UINT8 Type = 0;
UINT8 VolumeType = 0; UINT8 VolumeType = 0;
UINT8 KernelScan = 0; UINT8 KernelScan = KERNEL_SCAN_ALL;
UINT8 CustomBoot = 0; // UINT8 CustomBoot = 0;
XImage CustomLogo = XImage(); UINT8 CustomLogoType = 0;
XString8 CustomLogoAsXString8 = XString8();
XBuffer<UINT8> CustomLogoAsData = XBuffer<UINT8>();
XImage CustomLogoImage = XImage(); // Todo : remove from settings.
EFI_GRAPHICS_OUTPUT_BLT_PIXEL BootBgColor = EFI_GRAPHICS_OUTPUT_BLT_PIXEL({0,0,0,0}); EFI_GRAPHICS_OUTPUT_BLT_PIXEL BootBgColor = EFI_GRAPHICS_OUTPUT_BLT_PIXEL({0,0,0,0});
KERNEL_AND_KEXT_PATCHES KernelAndKextPatches = KERNEL_AND_KEXT_PATCHES(); KERNEL_AND_KEXT_PATCHES KernelAndKextPatches = KERNEL_AND_KEXT_PATCHES();
INT8 InjectKexts = -1;
// CUSTOM_LOADER_ENTRY() {} // CUSTOM_LOADER_ENTRY() {}
// //
// // Not sure if default are valid. Delete them. If needed, proper ones can be created // // Not sure if default are valid. Delete them. If needed, proper ones can be created
@ -313,7 +319,7 @@ public:
// LegacyBoot // LegacyBoot
XStringW LegacyBoot = XStringW(); XStringW LegacyBoot = XStringW();
UINT16 LegacyBiosDefaultEntry = 0; UINT16 LegacyBiosDefaultEntry = 0;
UINT8 CustomBootSetting = 0; UINT8 CustomLogoType = 0;
XString8 CustomLogoAsXString8 = XString8(); XString8 CustomLogoAsXString8 = XString8();
XBuffer<UINT8> CustomLogoAsData = XBuffer<UINT8>(); XBuffer<UINT8> CustomLogoAsData = XBuffer<UINT8>();
} Boot = BootClass(); } Boot = BootClass();
@ -955,7 +961,7 @@ public:
BOOLEAN NeedPMfix = FALSE; BOOLEAN NeedPMfix = FALSE;
ACPI_DROP_TABLE *ACPIDropTables = NULL; ACPI_DROP_TABLE *ACPIDropTables = NULL;
UINT8 CustomBoot = 0; // this will be initialized with gSettings.Boot.CustomBoot and set back to CUSTOM_BOOT_DISABLED if CustomLogo could not be loaded or decoded (see afterGetUserSettings) UINT8 CustomLogoType = 0; // this will be initialized with gSettings.Boot.CustomBoot and set back to CUSTOM_BOOT_DISABLED if CustomLogo could not be loaded or decoded (see afterGetUserSettings)
XImage *CustomLogo = 0; XImage *CustomLogo = 0;
bool DropSSDT = 0; // init with gSettings.Boot.DropSSDTSetting. Put back to false is one table is dropped (see afterGetUserSettings) bool DropSSDT = 0; // init with gSettings.Boot.DropSSDTSetting. Put back to false is one table is dropped (see afterGetUserSettings)

View File

@ -3,7 +3,7 @@
#include "../cpp_foundation/XStringArray.h" #include "../cpp_foundation/XStringArray.h"
#include "../cpp_foundation/unicode_conversions.h" #include "../cpp_foundation/unicode_conversions.h"
#include "../Platform/plist/plist.h" #include "../Platform/plist/plist.h"
#include "../cpp_lib/xmlLiteSimpleTypes.h" #include "../cpp_lib/XmlLiteSimpleTypes.h"
#include "../cpp_lib/XmlLiteParser.h" #include "../cpp_lib/XmlLiteParser.h"
#include "../Platform/ConfigPlist/ConfigPlist.h" #include "../Platform/ConfigPlist/ConfigPlist.h"

View File

@ -4,7 +4,7 @@
//#include "../cpp_foundation/unicode_conversions.h" //#include "../cpp_foundation/unicode_conversions.h"
//#include "../Platform/plist/plist.h" //#include "../Platform/plist/plist.h"
#include "../cpp_lib/xmlLiteSimpleTypes.h" #include "../cpp_lib/XmlLiteSimpleTypes.h"
#include "../cpp_lib/XmlLiteCompositeTypes.h" #include "../cpp_lib/XmlLiteCompositeTypes.h"
#include "../cpp_lib/XmlLiteParser.h" #include "../cpp_lib/XmlLiteParser.h"

View File

@ -733,7 +733,7 @@ EFI_STATUS InitBootScreen(IN LOADER_ENTRY *Entry)
if (customBoot == CUSTOM_BOOT_USER) { if (customBoot == CUSTOM_BOOT_USER) {
logo = Entry->CustomLogo; logo = Entry->CustomLogo;
} else if (customBoot == CUSTOM_BOOT_DISABLED) { } else if (customBoot == CUSTOM_BOOT_DISABLED) {
customBoot = GlobalConfig.CustomBoot; customBoot = GlobalConfig.CustomLogoType;
if (customBoot == CUSTOM_BOOT_USER) { if (customBoot == CUSTOM_BOOT_USER) {
logo = *GlobalConfig.CustomLogo; logo = *GlobalConfig.CustomLogo;
} }

View File

@ -512,6 +512,7 @@ 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 // If this isn't a custom entry make sure it's not hidden by a custom entry
for (size_t CustomIndex = 0 ; CustomIndex < gSettings.GUI.CustomEntries.size() ; ++CustomIndex ) { for (size_t CustomIndex = 0 ; CustomIndex < gSettings.GUI.CustomEntries.size() ; ++CustomIndex ) {
CUSTOM_LOADER_ENTRY& Custom = gSettings.GUI.CustomEntries[CustomIndex]; CUSTOM_LOADER_ENTRY& Custom = gSettings.GUI.CustomEntries[CustomIndex];
if ( Custom.Disabled ) continue; // before, disabled entries settings weren't loaded.
// Check if the custom entry is hidden or disabled // Check if the custom entry is hidden or disabled
if ( OSFLAG_ISSET(Custom.Flags, OSFLAG_DISABLED) || Custom.Hidden ) { if ( OSFLAG_ISSET(Custom.Flags, OSFLAG_DISABLED) || Custom.Hidden ) {
@ -2030,35 +2031,36 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex,
if (!IsSubEntry) { if (!IsSubEntry) {
BOOLEAN BetterMatch = FALSE; BOOLEAN BetterMatch = FALSE;
for (size_t i = 0 ; i < gSettings.GUI.CustomEntries.size() ; ++i ) { for (size_t i = 0 ; i < gSettings.GUI.CustomEntries.size() ; ++i ) {
CUSTOM_LOADER_ENTRY* Ptr = &gSettings.GUI.CustomEntries[i]; CUSTOM_LOADER_ENTRY& CustomEntry = gSettings.GUI.CustomEntries[i];
if ( CustomEntry.Disabled ) continue; // before, disabled entries settings weren't loaded.
// Don't match against this custom // Don't match against this custom
if (Ptr == &Custom) { if (&CustomEntry == &Custom) {
continue; continue;
} }
// Can only match the same types // Can only match the same types
if (Custom.Type != Ptr->Type) { if (Custom.Type != CustomEntry.Type) {
continue; continue;
} }
// Check if the volume string matches // Check if the volume string matches
if (Custom.Volume != Ptr->Volume) { if (Custom.Volume != CustomEntry.Volume) {
if (Ptr->Volume.isEmpty()) { if (CustomEntry.Volume.isEmpty()) {
// Less precise volume match // Less precise volume match
if (Custom.Path != Ptr->Path) { if (Custom.Path != CustomEntry.Path) {
// Better path match // Better path match
BetterMatch = ((Ptr->Path.notEmpty()) && CustomPath.equal(Ptr->Path) && BetterMatch = ((CustomEntry.Path.notEmpty()) && CustomPath.equal(CustomEntry.Path) &&
((Custom.VolumeType == Ptr->VolumeType) || ((Custom.VolumeType == CustomEntry.VolumeType) ||
((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0)); ((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0));
} }
} else if ((StrStr(Volume->DevicePathString.wc_str(), Custom.Volume.wc_str()) == NULL) && } else if ((StrStr(Volume->DevicePathString.wc_str(), Custom.Volume.wc_str()) == NULL) &&
((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom.Volume.wc_str()) == NULL))) { ((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom.Volume.wc_str()) == NULL))) {
if (Custom.Volume.isEmpty()) { if (Custom.Volume.isEmpty()) {
// More precise volume match // More precise volume match
if (Custom.Path != Ptr->Path) { if (Custom.Path != CustomEntry.Path) {
// Better path match // Better path match
BetterMatch = ((Ptr->Path.notEmpty()) && CustomPath.equal(Ptr->Path) && BetterMatch = ((CustomEntry.Path.notEmpty()) && CustomPath.equal(CustomEntry.Path) &&
((Custom.VolumeType == Ptr->VolumeType) || ((Custom.VolumeType == CustomEntry.VolumeType) ||
((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0)); ((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0));
} else if (Custom.VolumeType != Ptr->VolumeType) { } else if (Custom.VolumeType != CustomEntry.VolumeType) {
// More precise volume type match // More precise volume type match
BetterMatch = ((Custom.VolumeType == 0) && BetterMatch = ((Custom.VolumeType == 0) &&
((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0); ((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0);
@ -2067,13 +2069,13 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex,
BetterMatch = TRUE; BetterMatch = TRUE;
} }
// Duplicate volume match // Duplicate volume match
} else if (Custom.Path != Ptr->Path) { } else if (Custom.Path != CustomEntry.Path) {
// Better path match // Better path match
BetterMatch = ((Ptr->Path.notEmpty()) && CustomPath.equal(Ptr->Path) && BetterMatch = ((CustomEntry.Path.notEmpty()) && CustomPath.equal(CustomEntry.Path) &&
((Custom.VolumeType == Ptr->VolumeType) || ((Custom.VolumeType == CustomEntry.VolumeType) ||
((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0)); ((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0));
// Duplicate path match // Duplicate path match
} else if (Custom.VolumeType != Ptr->VolumeType) { } else if (Custom.VolumeType != CustomEntry.VolumeType) {
// More precise volume type match // More precise volume type match
BetterMatch = ((Custom.VolumeType == 0) && BetterMatch = ((Custom.VolumeType == 0) &&
((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0); ((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0);
@ -2083,17 +2085,17 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex,
} }
} }
// Duplicate volume match // Duplicate volume match
} else if (Custom.Path != Ptr->Path) { } else if (Custom.Path != CustomEntry.Path) {
if (Ptr->Path.isEmpty()) { if (CustomEntry.Path.isEmpty()) {
// Less precise path match // Less precise path match
BetterMatch = ((Custom.VolumeType != Ptr->VolumeType) && BetterMatch = ((Custom.VolumeType != CustomEntry.VolumeType) &&
((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0); ((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0);
} else if (CustomPath.equal(Ptr->Path)) { } else if (CustomPath.equal(CustomEntry.Path)) {
if (Custom.Path.isEmpty()) { if (Custom.Path.isEmpty()) {
// More precise path and volume type match // More precise path and volume type match
BetterMatch = ((Custom.VolumeType == Ptr->VolumeType) || BetterMatch = ((Custom.VolumeType == CustomEntry.VolumeType) ||
((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0); ((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0);
} else if (Custom.VolumeType != Ptr->VolumeType) { } else if (Custom.VolumeType != CustomEntry.VolumeType) {
// More precise volume type match // More precise volume type match
BetterMatch = ((Custom.VolumeType == 0) && BetterMatch = ((Custom.VolumeType == 0) &&
((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0); ((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0);
@ -2103,7 +2105,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex,
} }
} }
// Duplicate path match // Duplicate path match
} else if (Custom.VolumeType != Ptr->VolumeType) { } else if (Custom.VolumeType != CustomEntry.VolumeType) {
// More precise volume type match // More precise volume type match
BetterMatch = ((Custom.VolumeType == 0) && BetterMatch = ((Custom.VolumeType == 0) &&
((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0); ((1ull<<Volume->DiskKind) & Custom.VolumeType) != 0);
@ -2125,7 +2127,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex,
// Create an entry for this volume // Create an entry for this volume
Entry = CreateLoaderEntry(CustomPath, CustomOptions, Custom.FullTitle, Custom.Title, Volume, Entry = CreateLoaderEntry(CustomPath, CustomOptions, Custom.FullTitle, Custom.Title, Volume,
(Image.isEmpty() ? NULL : &Image), (DriveImage.isEmpty() ? NULL : &DriveImage), (Image.isEmpty() ? NULL : &Image), (DriveImage.isEmpty() ? NULL : &DriveImage),
Custom.Type, newCustomFlags, Custom.Hotkey, Custom.BootBgColor, Custom.CustomBoot, Custom.CustomLogo, Custom.Type, newCustomFlags, Custom.Hotkey, Custom.BootBgColor, Custom.CustomLogoType, Custom.CustomLogoImage,
/*(KERNEL_AND_KEXT_PATCHES *)(((UINTN)Custom) + OFFSET_OF(CUSTOM_LOADER_ENTRY, KernelAndKextPatches))*/ NULL, TRUE); /*(KERNEL_AND_KEXT_PATCHES *)(((UINTN)Custom) + OFFSET_OF(CUSTOM_LOADER_ENTRY, KernelAndKextPatches))*/ NULL, TRUE);
if (Entry != NULL) { if (Entry != NULL) {
DBG("Custom settings: %ls.plist will %s be applied\n", Custom.Settings.wc_str(), Custom.CommonSettings?"not":""); DBG("Custom settings: %ls.plist will %s be applied\n", Custom.Settings.wc_str(), Custom.CommonSettings?"not":"");
@ -2190,6 +2192,7 @@ void AddCustomEntries(void)
// Traverse the custom entries // Traverse the custom entries
for (size_t i = 0 ; i < gSettings.GUI.CustomEntries.size(); ++i) { for (size_t i = 0 ; i < gSettings.GUI.CustomEntries.size(); ++i) {
CUSTOM_LOADER_ENTRY& Custom = gSettings.GUI.CustomEntries[i]; CUSTOM_LOADER_ENTRY& Custom = gSettings.GUI.CustomEntries[i];
if ( Custom.Disabled ) continue; // before, disabled entries settings weren't loaded.
if ((Custom.Path.isEmpty()) && (Custom.Type != 0)) { if ((Custom.Path.isEmpty()) && (Custom.Type != 0)) {
if (OSTYPE_IS_OSX(Custom.Type)) { if (OSTYPE_IS_OSX(Custom.Type)) {
AddCustomEntry(i, MACOSX_LOADER_PATH, Custom, Custom.Settings, NULL); AddCustomEntry(i, MACOSX_LOADER_PATH, Custom, Custom.Settings, NULL);

View File

@ -2589,7 +2589,7 @@ void afterGetUserSettings(const SETTINGS_DATA& gSettings)
} }
// Whether or not to draw boot screen // Whether or not to draw boot screen
GlobalConfig.CustomBoot = gSettings.Boot.CustomBootSetting; GlobalConfig.CustomLogoType = gSettings.Boot.CustomLogoType;
if ( gSettings.Boot.CustomLogoAsXString8.notEmpty() ) { if ( gSettings.Boot.CustomLogoAsXString8.notEmpty() ) {
if (GlobalConfig.CustomLogo != NULL) { if (GlobalConfig.CustomLogo != NULL) {
delete GlobalConfig.CustomLogo; delete GlobalConfig.CustomLogo;
@ -2598,7 +2598,7 @@ void afterGetUserSettings(const SETTINGS_DATA& gSettings)
GlobalConfig.CustomLogo->LoadXImage(&self.getSelfVolumeRootDir(), gSettings.Boot.CustomLogoAsXString8); GlobalConfig.CustomLogo->LoadXImage(&self.getSelfVolumeRootDir(), gSettings.Boot.CustomLogoAsXString8);
if (GlobalConfig.CustomLogo->isEmpty()) { if (GlobalConfig.CustomLogo->isEmpty()) {
DBG("Custom boot logo not found at path '%s'!\n", gSettings.Boot.CustomLogoAsXString8.c_str()); DBG("Custom boot logo not found at path '%s'!\n", gSettings.Boot.CustomLogoAsXString8.c_str());
GlobalConfig.CustomBoot = CUSTOM_BOOT_DISABLED; GlobalConfig.CustomLogoType = CUSTOM_BOOT_DISABLED;
} }
} else if ( gSettings.Boot.CustomLogoAsData.notEmpty() ) { } else if ( gSettings.Boot.CustomLogoAsData.notEmpty() ) {
if (GlobalConfig.CustomLogo != NULL) { if (GlobalConfig.CustomLogo != NULL) {
@ -2608,10 +2608,10 @@ void afterGetUserSettings(const SETTINGS_DATA& gSettings)
GlobalConfig.CustomLogo->FromPNG(gSettings.Boot.CustomLogoAsData.data(), gSettings.Boot.CustomLogoAsData.size()); GlobalConfig.CustomLogo->FromPNG(gSettings.Boot.CustomLogoAsData.data(), gSettings.Boot.CustomLogoAsData.size());
if (GlobalConfig.CustomLogo->isEmpty()) { if (GlobalConfig.CustomLogo->isEmpty()) {
DBG("Custom boot logo not decoded from data!\n"/*, Prop->getString()->stringValue().c_str()*/); DBG("Custom boot logo not decoded from data!\n"/*, Prop->getString()->stringValue().c_str()*/);
GlobalConfig.CustomBoot = CUSTOM_BOOT_DISABLED; GlobalConfig.CustomLogoType = CUSTOM_BOOT_DISABLED;
} }
} }
DBG("Custom boot %s (0x%llX)\n", CustomBootModeToStr(GlobalConfig.CustomBoot), (uintptr_t)GlobalConfig.CustomLogo); DBG("Custom boot %s (0x%llX)\n", CustomBootModeToStr(GlobalConfig.CustomLogoType), (uintptr_t)GlobalConfig.CustomLogo);
GlobalConfig.EnableC6 = gSettings.getEnableC6(); GlobalConfig.EnableC6 = gSettings.getEnableC6();
GlobalConfig.EnableC4 = gSettings.getEnableC4(); GlobalConfig.EnableC4 = gSettings.getEnableC4();