diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 85ef49eb1..fbfc104fa 100644 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -2587,16 +2587,16 @@ RELEASE_XCODE8_*_MTOC_FLAGS = -align 0x20 # -Wno-varargs # -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) - RELEASE_XCODE8_X64_CC_FLAGS = -Os DEF(XCODE8_COMMON_FLAGS) -Werror - DEBUG_XCODE8_X64_CXX_FLAGS = -g -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) + 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) -target x86_64-pc-win32-macho "-DEFIAPI=__attribute__((ms_abi))" 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_*_ASLDLINK_FLAGS = -nostdlib -Wl,-e,_ReferenceAcpiTable,-preload,-segalign,0x20,-pie,-seg1addr,0x260,-read_only_relocs,suppress,-map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map diff --git a/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj b/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj index dcb8f1f32..594ed488f 100644 --- a/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj +++ b/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj @@ -93,6 +93,11 @@ 9A4C5778255ACAE8004F0B21 /* MacOsVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A4C5776255ACAE8004F0B21 /* MacOsVersion.h */; }; 9A4F68622449D4CB004B2F7E /* 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 */; }; 9A61B3012522165100AEE0FA /* Self.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A61B2FF2522165100AEE0FA /* Self.h */; }; 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 = ""; }; 9A4C5775255ACAE7004F0B21 /* MacOsVersion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacOsVersion.cpp; sourceTree = ""; }; 9A4C5776255ACAE8004F0B21 /* MacOsVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacOsVersion.h; sourceTree = ""; }; + 9A54699426063AB000CBC3DE /* XmlLiteParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlLiteParser.h; sourceTree = ""; }; + 9A54699526063AB000CBC3DE /* XmlLiteSimpleTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlLiteSimpleTypes.h; sourceTree = ""; }; + 9A54699626063AB000CBC3DE /* XmlLiteCompositeTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XmlLiteCompositeTypes.cpp; sourceTree = ""; }; + 9A54699726063AB000CBC3DE /* undefinable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = undefinable.h; sourceTree = ""; }; + 9A54699826063AB000CBC3DE /* XmlLiteParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XmlLiteParser.cpp; sourceTree = ""; }; + 9A54699926063AB000CBC3DE /* XmlLiteSimpleTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XmlLiteSimpleTypes.cpp; sourceTree = ""; }; + 9A54699A26063AB000CBC3DE /* XmlLiteCompositeTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlLiteCompositeTypes.h; sourceTree = ""; }; 9A61B2FE2522165100AEE0FA /* Self.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Self.cpp; sourceTree = ""; }; 9A61B2FF2522165100AEE0FA /* Self.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Self.h; sourceTree = ""; }; 9A63C6CA24EBEF78000EB836 /* Version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Version.h; path = ../../Version.h; sourceTree = ""; }; @@ -979,6 +991,20 @@ /* End PBXFrameworksBuildPhase 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 = ""; + }; 9AA3912D25CC65820099DC1F /* Posix */ = { isa = PBXGroup; children = ( @@ -1068,6 +1094,7 @@ 9AC77EC924176C04005CDD5C /* rEFIt_UEFI */ = { isa = PBXGroup; children = ( + 9A54699326063AB000CBC3DE /* cpp_lib */, 9AC77FAB24176C04005CDD5C /* cpp_foundation */, 9AC77ECA24176C04005CDD5C /* cpp_unit_test */, 9AC77F9F24176C04005CDD5C /* cpp_util */, @@ -1423,6 +1450,7 @@ 9AEFE64624E2A7D1005D56D8 /* XIcon.h in Headers */, 9A105B2D24464A830006DE06 /* BmLib.h in Headers */, 9AF4173F242F15CC00D2644C /* BootLog.h in Headers */, + 9A5469A126063AB000CBC3DE /* XmlLiteCompositeTypes.h in Headers */, 9AC77FC024176C04005CDD5C /* XObjArray_tests.h in Headers */, 9AC7801D24176C04005CDD5C /* Events.h in Headers */, 9AF41562242BABC700D2644C /* printlib-test-cpp_conf.h in Headers */, @@ -1465,6 +1493,7 @@ 9AC7807A24176C04005CDD5C /* lib.h in Headers */, 9AC7803524176C04005CDD5C /* b64cdecode.h in Headers */, 9AC7805224176C04005CDD5C /* EfiFileLib.h in Headers */, + 9A54699B26063AB000CBC3DE /* XmlLiteParser.h in Headers */, 9AEFE64D24E2C64B005D56D8 /* XRBuffer.h in Headers */, 9AC7807324176C04005CDD5C /* menu_globals.h in Headers */, 9AC7809824176C04005CDD5C /* XObjArray.h in Headers */, @@ -1533,7 +1562,9 @@ 9AD469552452B63300D6D0DB /* XToolsConf.h in Headers */, 9AD469512452B5A600D6D0DB /* Devices.h in Headers */, 9A28CC98241AB34800F3D247 /* XString_test.h in Headers */, + 9A54699E26063AB000CBC3DE /* undefinable.h in Headers */, 9AA3917D25CC65830099DC1F /* plist.h in Headers */, + 9A54699C26063AB000CBC3DE /* XmlLiteSimpleTypes.h in Headers */, 9A80B49F2540175E00E56B08 /* OC.h in Headers */, 9AA3916225CC65830099DC1F /* posix.h in Headers */, 9A61B3012522165100AEE0FA /* Self.h in Headers */, @@ -2012,6 +2043,7 @@ 9AC7804C24176C04005CDD5C /* VectorGraphics.cpp in Sources */, 9AC7805E24176C04005CDD5C /* common.cpp in Sources */, 9AA3917225CC65830099DC1F /* TagDict.cpp in Sources */, + 9A54699F26063AB000CBC3DE /* XmlLiteParser.cpp in Sources */, 9AC7804924176C04005CDD5C /* egemb_icons.cpp in Sources */, 9AC7801124176C04005CDD5C /* Edid.cpp in Sources */, 9A61B3002522165100AEE0FA /* Self.cpp in Sources */, diff --git a/rEFIt_UEFI/Platform/Settings.cpp b/rEFIt_UEFI/Platform/Settings.cpp index 5b8f165be..2940fb551 100755 --- a/rEFIt_UEFI/Platform/Settings.cpp +++ b/rEFIt_UEFI/Platform/Settings.cpp @@ -559,40 +559,40 @@ LoadUserSettings ( return Status; } -STATIC BOOLEAN AddCustomLoaderEntry(IN CUSTOM_LOADER_ENTRY *Entry) -{ - if (Entry == NULL) return FALSE; - gSettings.GUI.CustomEntries.AddReference(Entry, true); - return TRUE; -} +//STATIC BOOLEAN AddCustomLoaderEntry(IN CUSTOM_LOADER_ENTRY *Entry) +//{ +// if (Entry == NULL) return FALSE; +// gSettings.GUI.CustomEntries.AddReference(Entry, true); +// return TRUE; +//} -STATIC BOOLEAN AddCustomLegacyEntry (IN CUSTOM_LEGACY_ENTRY *Entry) -{ - if (Entry == NULL) return FALSE; - gSettings.GUI.CustomLegacy.AddReference(Entry, true); - return TRUE; -} -STATIC -BOOLEAN -AddCustomToolEntry ( - IN CUSTOM_TOOL_ENTRY *Entry - ) -{ - if (Entry == NULL) return FALSE; - gSettings.GUI.CustomTool.AddReference(Entry, true); - return TRUE; -} +//STATIC BOOLEAN AddCustomLegacyEntry (IN CUSTOM_LEGACY_ENTRY *Entry) +//{ +// if (Entry == NULL) return FALSE; +// gSettings.GUI.CustomLegacy.AddReference(Entry, true); +// return TRUE; +//} +//STATIC +//BOOLEAN +//AddCustomToolEntry ( +// IN CUSTOM_TOOL_ENTRY *Entry +// ) +//{ +// if (Entry == NULL) return FALSE; +// gSettings.GUI.CustomTool.AddReference(Entry, true); +// return TRUE; +//} -STATIC -BOOLEAN -AddCustomSubEntry ( - IN OUT CUSTOM_LOADER_ENTRY *Entry, - IN CUSTOM_LOADER_ENTRY *SubEntry) -{ - if ((Entry == NULL) || (SubEntry == NULL)) return FALSE; - Entry->SubEntries.AddReference(Entry, true); - return TRUE; -} +//STATIC +//BOOLEAN +//AddCustomSubEntry ( +// IN OUT CUSTOM_LOADER_ENTRY *Entry, +// IN CUSTOM_LOADER_ENTRY *SubEntry) +//{ +// if ((Entry == NULL) || (SubEntry == NULL)) return FALSE; +// Entry->SubEntries.AddReference(Entry, true); +// return TRUE; +//} STATIC @@ -622,8 +622,10 @@ CUSTOM_LOADER_ENTRY DuplicateEntry->Type = Entry->Type; DuplicateEntry->VolumeType = Entry->VolumeType; DuplicateEntry->KernelScan = Entry->KernelScan; - DuplicateEntry->CustomBoot = Entry->CustomBoot; - DuplicateEntry->CustomLogo = Entry->CustomLogo; + DuplicateEntry->CustomLogoType = Entry->CustomLogoType; + DuplicateEntry->CustomLogoAsXString8 = Entry->CustomLogoAsXString8; + DuplicateEntry->CustomLogoAsData = Entry->CustomLogoAsData; + DuplicateEntry->CustomLogoImage = Entry->CustomLogoImage; // CopyKernelAndKextPatches (&DuplicateEntry->KernelAndKextPatches, &Entry->KernelAndKextPatches); DuplicateEntry->KernelAndKextPatches = Entry->KernelAndKextPatches; } @@ -1420,14 +1422,11 @@ FillinCustomEntry ( { const TagStruct* Prop; - if ((Entry == NULL) || (DictPointer == NULL)) { - return FALSE; - } + if ( Entry == NULL ) panic("Entry == NULL"); + if ( DictPointer == NULL ) panic("DictPointer == NULL"); Prop = DictPointer->propertyForKey("Disabled"); - if (IsPropertyNotNullAndTrue(Prop)) { - return FALSE; - } + Entry->Disabled = IsPropertyNotNullAndTrue(Prop); Prop = DictPointer->propertyForKey("Volume"); if (Prop != NULL && (Prop->isString())) { @@ -1473,6 +1472,7 @@ FillinCustomEntry ( Entry->FullTitle = Prop->getString()->stringValue(); } + Entry->ImageData.setEmpty(); Prop = DictPointer->propertyForKey("Image"); if (Prop != NULL) { Entry->ImagePath.setEmpty(); @@ -1485,13 +1485,15 @@ FillinCustomEntry ( UINTN DataLen = 0; UINT8 *TmpData = GetDataSetting (DictPointer, "ImageData", &DataLen); if (TmpData) { + Entry->ImageData.stealValueFrom(TmpData, DataLen); +// TODO remove from settings if (!EFI_ERROR(Entry->Image.Image.FromPNG(TmpData, DataLen))) { Entry->Image.setFilled(); } - FreePool(TmpData); } } + Entry->DriveImageData.setEmpty(); Prop = DictPointer->propertyForKey("DriveImage"); if (Prop != NULL) { Entry->DriveImagePath.setEmpty(); @@ -1504,6 +1506,8 @@ FillinCustomEntry ( UINTN DataLen = 0; UINT8 *TmpData = GetDataSetting (DictPointer, "DriveImageData", &DataLen); if (TmpData) { + Entry->DriveImageData.stealValueFrom(TmpData, DataLen); +// TODO remove from settings if (!EFI_ERROR(Entry->DriveImage.Image.FromPNG(TmpData, DataLen))) { Entry->DriveImage.setFilled(); } @@ -1522,36 +1526,40 @@ FillinCustomEntry ( Prop = DictPointer->propertyForKey("CustomLogo"); if (Prop != NULL) { if (IsPropertyNotNullAndTrue(Prop)) { - Entry->CustomBoot = CUSTOM_BOOT_APPLE; + Entry->CustomLogoType = CUSTOM_BOOT_APPLE; } else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) { + Entry->CustomLogoAsXString8 = Prop->getString()->stringValue(); if (Prop->getString()->stringValue().equalIC("Apple")) { - Entry->CustomBoot = CUSTOM_BOOT_APPLE; + Entry->CustomLogoType = CUSTOM_BOOT_APPLE; } 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")) { - Entry->CustomBoot = CUSTOM_BOOT_THEME; + Entry->CustomLogoType = CUSTOM_BOOT_THEME; } else { XStringW customLogo = XStringW() = Prop->getString()->stringValue(); - Entry->CustomBoot = CUSTOM_BOOT_USER; - Entry->CustomLogo.LoadXImage(&self.getSelfVolumeRootDir(), customLogo); - if (Entry->CustomLogo.isEmpty()) { + Entry->CustomLogoType = CUSTOM_BOOT_USER; +// TODO : remove reading of image from settings + Entry->CustomLogoImage.LoadXImage(&self.getSelfVolumeRootDir(), customLogo); + if (Entry->CustomLogoImage.isEmpty()) { 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 ) { - Entry->CustomBoot = CUSTOM_BOOT_USER; - Entry->CustomLogo.FromPNG(Prop->getData()->dataValue(), Prop->getData()->dataLenValue()); - if (Entry->CustomLogo.isEmpty()) { + Entry->CustomLogoType = CUSTOM_BOOT_USER; + Entry->CustomLogoAsData = Prop->getData()->data(); +// 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()*/); - Entry->CustomBoot = CUSTOM_BOOT_DISABLED; + Entry->CustomLogoType = CUSTOM_BOOT_DISABLED; } } 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 { - Entry->CustomBoot = CUSTOM_BOOT_DISABLED; + Entry->CustomLogoType = CUSTOM_BOOT_DISABLED; } Prop = DictPointer->propertyForKey("BootBgColor"); @@ -1595,6 +1603,7 @@ FillinCustomEntry ( Entry->Type = OSTYPE_WINEFI; } else if (Prop->getString()->stringValue().equalIC("Linux")) { Entry->Type = OSTYPE_LIN; +// TODO remove from here Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NODEFAULTARGS); } else if (Prop->getString()->stringValue().equalIC("LinuxKernel")) { Entry->Type = OSTYPE_LINEFI; @@ -1642,16 +1651,21 @@ FillinCustomEntry ( Prop = DictPointer->propertyForKey("InjectKexts"); if (Prop != NULL) { if ( Prop->isTrueOrYes() ) { + Entry->InjectKexts = 1; Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS); } else if ( Prop->isFalseOrNn() ) { + Entry->InjectKexts = 0; // nothing to do } 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_WITHKEXTS); } else { + Entry->InjectKexts = -1; DBG("** Warning: unknown custom entry InjectKexts value '%s'\n", Prop->getString()->stringValue().c_str()); } } else { + Entry->InjectKexts = -1; // Use global settings if (gSettings.WithKexts) { Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS); @@ -1733,10 +1747,10 @@ FillinCustomEntry ( // Allocate a sub entry CustomSubEntry = DuplicateCustomEntry (Entry); if (CustomSubEntry) { - if (!FillinCustomEntry (CustomSubEntry, Dict, TRUE) || !AddCustomSubEntry (Entry, CustomSubEntry)) { - if (CustomSubEntry) { - FreePool(CustomSubEntry); - } + if ( FillinCustomEntry(CustomSubEntry, Dict, TRUE) ) { + Entry->SubEntries.AddReference(CustomSubEntry, true); + }else{ + delete CustomSubEntry; } } } @@ -1937,10 +1951,18 @@ FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY *Entry, const TagDict* DictPointer) 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 static void GetEDIDSettings(const TagDict* DictPointer, SETTINGS_DATA& gSettings) { + #pragma GCC diagnostic pop const TagStruct* Prop; const TagDict* Dict; UINTN j = 128; @@ -2259,17 +2281,17 @@ EFI_STATUS GetEarlyUserSettings ( Prop = BootDict->propertyForKey("CustomLogo"); if (Prop != NULL) { if (IsPropertyNotNullAndTrue(Prop)) { - gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_APPLE; + gSettings.Boot.CustomLogoType = CUSTOM_BOOT_APPLE; } else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) { gSettings.Boot.CustomLogoAsXString8 = Prop->getString()->stringValue(); 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")) { - gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_ALT_APPLE; + gSettings.Boot.CustomLogoType = CUSTOM_BOOT_ALT_APPLE; } else if (Prop->getString()->stringValue().equalIC("Theme")) { - gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_THEME; + gSettings.Boot.CustomLogoType = CUSTOM_BOOT_THEME; } else { - gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_USER; + gSettings.Boot.CustomLogoType = CUSTOM_BOOT_USER; // if (settingsData.Boot.CustomLogo != NULL) { // delete settingsData.Boot.CustomLogo; // } @@ -2282,7 +2304,7 @@ EFI_STATUS GetEarlyUserSettings ( } } else if ( Prop->isData() && Prop->getData()->dataLenValue() > 0 ) { gSettings.Boot.CustomLogoAsData = Prop->getData()->data(); - gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_USER; + gSettings.Boot.CustomLogoType = CUSTOM_BOOT_USER; // if (settingsData.Boot.CustomLogo != NULL) { // delete settingsData.Boot.CustomLogo; // } @@ -2293,10 +2315,10 @@ EFI_STATUS GetEarlyUserSettings ( // settingsData.Boot.CustomBoot = CUSTOM_BOOT_DISABLED; // } } else { - gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_USER_DISABLED; + gSettings.Boot.CustomLogoType = CUSTOM_BOOT_USER_DISABLED; } } else { - gSettings.Boot.CustomBootSetting = CUSTOM_BOOT_DISABLED; + gSettings.Boot.CustomLogoType = CUSTOM_BOOT_DISABLED; } } @@ -2583,7 +2605,9 @@ EFI_STATUS GetEarlyUserSettings ( // Allocate an entry CUSTOM_LOADER_ENTRY* Entry = new CUSTOM_LOADER_ENTRY; // Fill it in - if ( !FillinCustomEntry(Entry, Dict3, FALSE) || !AddCustomLoaderEntry(Entry) ) { + if ( FillinCustomEntry(Entry, Dict3, FALSE) ) { + gSettings.GUI.CustomEntries.AddReference(Entry, true); + }else{ delete Entry; } } @@ -2600,7 +2624,9 @@ EFI_STATUS GetEarlyUserSettings ( // Allocate an entry Entry = new CUSTOM_LEGACY_ENTRY; // Fill it in - if (!FillingCustomLegacy(Entry, Dict3) || !AddCustomLegacyEntry(Entry)) { + if ( FillingCustomLegacy(Entry, Dict3) ) { + gSettings.GUI.CustomLegacy.AddReference(Entry, true); + }else{ delete Entry; } } @@ -2617,7 +2643,9 @@ EFI_STATUS GetEarlyUserSettings ( // Allocate an entry Entry = new CUSTOM_TOOL_ENTRY; // Fill it in - if (!FillingCustomTool(Entry, Dict3) || !AddCustomToolEntry(Entry)) { + if ( FillingCustomTool(Entry, Dict3) ) { + gSettings.GUI.CustomTool.AddReference(Entry, true); + }else{ 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) { + #pragma GCC diagnostic pop const TagDict* ACPIDict = CfgDict->dictPropertyForKey("ACPI"); if (ACPIDict) { const TagArray* DropTablesArray = ACPIDict->arrayPropertyForKey("DropTables"); // array of dict diff --git a/rEFIt_UEFI/Platform/Settings.h b/rEFIt_UEFI/Platform/Settings.h index 59e22aceb..3a5c1e472 100644 --- a/rEFIt_UEFI/Platform/Settings.h +++ b/rEFIt_UEFI/Platform/Settings.h @@ -10,7 +10,7 @@ #include "KERNEL_AND_KEXT_PATCHES.h" #include "../libeg/XIcon.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') @@ -153,11 +153,14 @@ public: class CUSTOM_LOADER_ENTRY { public: + bool Disabled = 0; XObjArray SubEntries = XObjArray(); - XIcon Image = XIcon(); - XIcon DriveImage = XIcon(); + XIcon Image = XIcon(); // todo remove XStringW ImagePath = XStringW(); + XBuffer ImageData = XBuffer(); + XIcon DriveImage = XIcon(); XStringW DriveImagePath = XStringW(); + XBuffer DriveImageData = XBuffer(); XStringW Volume = XStringW(); XStringW Path = XStringW(); XString8Array LoadOptions = XString8Array(); @@ -171,12 +174,15 @@ public: bool Hidden = 0; UINT8 Type = 0; UINT8 VolumeType = 0; - UINT8 KernelScan = 0; - UINT8 CustomBoot = 0; - XImage CustomLogo = XImage(); + UINT8 KernelScan = KERNEL_SCAN_ALL; +// UINT8 CustomBoot = 0; + UINT8 CustomLogoType = 0; + XString8 CustomLogoAsXString8 = XString8(); + XBuffer CustomLogoAsData = XBuffer(); + XImage CustomLogoImage = XImage(); // Todo : remove from settings. EFI_GRAPHICS_OUTPUT_BLT_PIXEL BootBgColor = EFI_GRAPHICS_OUTPUT_BLT_PIXEL({0,0,0,0}); KERNEL_AND_KEXT_PATCHES KernelAndKextPatches = KERNEL_AND_KEXT_PATCHES(); - + INT8 InjectKexts = -1; // CUSTOM_LOADER_ENTRY() {} // // // Not sure if default are valid. Delete them. If needed, proper ones can be created @@ -313,7 +319,7 @@ public: // LegacyBoot XStringW LegacyBoot = XStringW(); UINT16 LegacyBiosDefaultEntry = 0; - UINT8 CustomBootSetting = 0; + UINT8 CustomLogoType = 0; XString8 CustomLogoAsXString8 = XString8(); XBuffer CustomLogoAsData = XBuffer(); } Boot = BootClass(); @@ -955,7 +961,7 @@ public: BOOLEAN NeedPMfix = FALSE; 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; bool DropSSDT = 0; // init with gSettings.Boot.DropSSDTSetting. Put back to false is one table is dropped (see afterGetUserSettings) diff --git a/rEFIt_UEFI/cpp_unit_test/config-test.cpp b/rEFIt_UEFI/cpp_unit_test/config-test.cpp index 201789402..cee6d9c11 100755 --- a/rEFIt_UEFI/cpp_unit_test/config-test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/config-test.cpp @@ -3,7 +3,7 @@ #include "../cpp_foundation/XStringArray.h" #include "../cpp_foundation/unicode_conversions.h" #include "../Platform/plist/plist.h" -#include "../cpp_lib/xmlLiteSimpleTypes.h" +#include "../cpp_lib/XmlLiteSimpleTypes.h" #include "../cpp_lib/XmlLiteParser.h" #include "../Platform/ConfigPlist/ConfigPlist.h" diff --git a/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp b/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp index 011e586c0..5dec537db 100755 --- a/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp @@ -4,7 +4,7 @@ //#include "../cpp_foundation/unicode_conversions.h" //#include "../Platform/plist/plist.h" -#include "../cpp_lib/xmlLiteSimpleTypes.h" +#include "../cpp_lib/XmlLiteSimpleTypes.h" #include "../cpp_lib/XmlLiteCompositeTypes.h" #include "../cpp_lib/XmlLiteParser.h" diff --git a/rEFIt_UEFI/entry_scan/bootscreen.cpp b/rEFIt_UEFI/entry_scan/bootscreen.cpp index 4ca726bb0..7cb1e69ae 100644 --- a/rEFIt_UEFI/entry_scan/bootscreen.cpp +++ b/rEFIt_UEFI/entry_scan/bootscreen.cpp @@ -733,7 +733,7 @@ EFI_STATUS InitBootScreen(IN LOADER_ENTRY *Entry) if (customBoot == CUSTOM_BOOT_USER) { logo = Entry->CustomLogo; } else if (customBoot == CUSTOM_BOOT_DISABLED) { - customBoot = GlobalConfig.CustomBoot; + customBoot = GlobalConfig.CustomLogoType; if (customBoot == CUSTOM_BOOT_USER) { logo = *GlobalConfig.CustomLogo; } diff --git a/rEFIt_UEFI/entry_scan/loader.cpp b/rEFIt_UEFI/entry_scan/loader.cpp index 9ec1e9318..3ecf55e1d 100644 --- a/rEFIt_UEFI/entry_scan/loader.cpp +++ b/rEFIt_UEFI/entry_scan/loader.cpp @@ -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 for (size_t CustomIndex = 0 ; CustomIndex < gSettings.GUI.CustomEntries.size() ; ++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 if ( OSFLAG_ISSET(Custom.Flags, OSFLAG_DISABLED) || Custom.Hidden ) { @@ -2030,35 +2031,36 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, if (!IsSubEntry) { BOOLEAN BetterMatch = FALSE; 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 - if (Ptr == &Custom) { + if (&CustomEntry == &Custom) { continue; } // Can only match the same types - if (Custom.Type != Ptr->Type) { + if (Custom.Type != CustomEntry.Type) { continue; } // Check if the volume string matches - if (Custom.Volume != Ptr->Volume) { - if (Ptr->Volume.isEmpty()) { + if (Custom.Volume != CustomEntry.Volume) { + if (CustomEntry.Volume.isEmpty()) { // Less precise volume match - if (Custom.Path != Ptr->Path) { + if (Custom.Path != CustomEntry.Path) { // Better path match - BetterMatch = ((Ptr->Path.notEmpty()) && CustomPath.equal(Ptr->Path) && - ((Custom.VolumeType == Ptr->VolumeType) || + BetterMatch = ((CustomEntry.Path.notEmpty()) && CustomPath.equal(CustomEntry.Path) && + ((Custom.VolumeType == CustomEntry.VolumeType) || ((1ull<DiskKind) & Custom.VolumeType) != 0)); } } 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))) { if (Custom.Volume.isEmpty()) { // More precise volume match - if (Custom.Path != Ptr->Path) { + if (Custom.Path != CustomEntry.Path) { // Better path match - BetterMatch = ((Ptr->Path.notEmpty()) && CustomPath.equal(Ptr->Path) && - ((Custom.VolumeType == Ptr->VolumeType) || + BetterMatch = ((CustomEntry.Path.notEmpty()) && CustomPath.equal(CustomEntry.Path) && + ((Custom.VolumeType == CustomEntry.VolumeType) || ((1ull<DiskKind) & Custom.VolumeType) != 0)); - } else if (Custom.VolumeType != Ptr->VolumeType) { + } else if (Custom.VolumeType != CustomEntry.VolumeType) { // More precise volume type match BetterMatch = ((Custom.VolumeType == 0) && ((1ull<DiskKind) & Custom.VolumeType) != 0); @@ -2067,13 +2069,13 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, BetterMatch = TRUE; } // Duplicate volume match - } else if (Custom.Path != Ptr->Path) { + } else if (Custom.Path != CustomEntry.Path) { // Better path match - BetterMatch = ((Ptr->Path.notEmpty()) && CustomPath.equal(Ptr->Path) && - ((Custom.VolumeType == Ptr->VolumeType) || + BetterMatch = ((CustomEntry.Path.notEmpty()) && CustomPath.equal(CustomEntry.Path) && + ((Custom.VolumeType == CustomEntry.VolumeType) || ((1ull<DiskKind) & Custom.VolumeType) != 0)); // Duplicate path match - } else if (Custom.VolumeType != Ptr->VolumeType) { + } else if (Custom.VolumeType != CustomEntry.VolumeType) { // More precise volume type match BetterMatch = ((Custom.VolumeType == 0) && ((1ull<DiskKind) & Custom.VolumeType) != 0); @@ -2083,17 +2085,17 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, } } // Duplicate volume match - } else if (Custom.Path != Ptr->Path) { - if (Ptr->Path.isEmpty()) { + } else if (Custom.Path != CustomEntry.Path) { + if (CustomEntry.Path.isEmpty()) { // Less precise path match - BetterMatch = ((Custom.VolumeType != Ptr->VolumeType) && + BetterMatch = ((Custom.VolumeType != CustomEntry.VolumeType) && ((1ull<DiskKind) & Custom.VolumeType) != 0); - } else if (CustomPath.equal(Ptr->Path)) { + } else if (CustomPath.equal(CustomEntry.Path)) { if (Custom.Path.isEmpty()) { // More precise path and volume type match - BetterMatch = ((Custom.VolumeType == Ptr->VolumeType) || + BetterMatch = ((Custom.VolumeType == CustomEntry.VolumeType) || ((1ull<DiskKind) & Custom.VolumeType) != 0); - } else if (Custom.VolumeType != Ptr->VolumeType) { + } else if (Custom.VolumeType != CustomEntry.VolumeType) { // More precise volume type match BetterMatch = ((Custom.VolumeType == 0) && ((1ull<DiskKind) & Custom.VolumeType) != 0); @@ -2103,7 +2105,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, } } // Duplicate path match - } else if (Custom.VolumeType != Ptr->VolumeType) { + } else if (Custom.VolumeType != CustomEntry.VolumeType) { // More precise volume type match BetterMatch = ((Custom.VolumeType == 0) && ((1ull<DiskKind) & Custom.VolumeType) != 0); @@ -2125,7 +2127,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, // Create an entry for this volume Entry = CreateLoaderEntry(CustomPath, CustomOptions, Custom.FullTitle, Custom.Title, Volume, (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); if (Entry != NULL) { 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 for (size_t i = 0 ; i < gSettings.GUI.CustomEntries.size(); ++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 (OSTYPE_IS_OSX(Custom.Type)) { AddCustomEntry(i, MACOSX_LOADER_PATH, Custom, Custom.Settings, NULL); diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index f02fc5b04..f662894ae 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -2589,7 +2589,7 @@ void afterGetUserSettings(const SETTINGS_DATA& gSettings) } // Whether or not to draw boot screen - GlobalConfig.CustomBoot = gSettings.Boot.CustomBootSetting; + GlobalConfig.CustomLogoType = gSettings.Boot.CustomLogoType; if ( gSettings.Boot.CustomLogoAsXString8.notEmpty() ) { if (GlobalConfig.CustomLogo != NULL) { delete GlobalConfig.CustomLogo; @@ -2598,7 +2598,7 @@ void afterGetUserSettings(const SETTINGS_DATA& gSettings) GlobalConfig.CustomLogo->LoadXImage(&self.getSelfVolumeRootDir(), gSettings.Boot.CustomLogoAsXString8); if (GlobalConfig.CustomLogo->isEmpty()) { 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() ) { 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()); if (GlobalConfig.CustomLogo->isEmpty()) { 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.EnableC4 = gSettings.getEnableC4();