From ff4c90bc99b3152e059488714d967733235f03bb Mon Sep 17 00:00:00 2001 From: jief666 Date: Tue, 23 Mar 2021 11:32:57 +0300 Subject: [PATCH] Finish refactoring of custom entries settings. --- .../CloverMock/rEFIt_UEFI/Platform/Platform.h | 6 + .../project.pbxproj | 1 + rEFIt_UEFI/Platform/Settings.cpp | 159 +++++++++++------- rEFIt_UEFI/Platform/Settings.h | 87 +++++++--- rEFIt_UEFI/entry_scan/loader.cpp | 34 ++-- 5 files changed, 188 insertions(+), 99 deletions(-) diff --git a/Xcode/CloverX64TestNewParser/CloverMock/rEFIt_UEFI/Platform/Platform.h b/Xcode/CloverX64TestNewParser/CloverMock/rEFIt_UEFI/Platform/Platform.h index fe82df0a1..e36e38c46 100644 --- a/Xcode/CloverX64TestNewParser/CloverMock/rEFIt_UEFI/Platform/Platform.h +++ b/Xcode/CloverX64TestNewParser/CloverMock/rEFIt_UEFI/Platform/Platform.h @@ -50,6 +50,12 @@ typedef uint16_t char16_t; typedef uint8_t bool; #endif +// Replacement of uintptr_t to avoid warning in printf. It needs macro _UINTPTR_T to avoid to standard definition +typedef unsigned long long uintptr_t; +#undef PRIuPTR +#define PRIuPTR "llu" +//#define _UINTPTR_T + #include "../../../rEFIt_UEFI/Platform/Posix/abort.h" #include "../../../rEFIt_UEFI/cpp_foundation/unicode_conversions.h" diff --git a/Xcode/CloverX64TestNewParser/CloverX64TestNewParser.xcodeproj/project.pbxproj b/Xcode/CloverX64TestNewParser/CloverX64TestNewParser.xcodeproj/project.pbxproj index 2a2e530c9..656187352 100644 --- a/Xcode/CloverX64TestNewParser/CloverX64TestNewParser.xcodeproj/project.pbxproj +++ b/Xcode/CloverX64TestNewParser/CloverX64TestNewParser.xcodeproj/project.pbxproj @@ -16132,6 +16132,7 @@ "wcsstr=wcsstr_fixed", "sprintf=__sprintf_is_disabled__", "___NOT___ENABLE_SECURE_BOOT", + _UINTPTR_T, ); GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; diff --git a/rEFIt_UEFI/Platform/Settings.cpp b/rEFIt_UEFI/Platform/Settings.cpp index 40a313e7a..f7a16a442 100755 --- a/rEFIt_UEFI/Platform/Settings.cpp +++ b/rEFIt_UEFI/Platform/Settings.cpp @@ -187,7 +187,48 @@ CONST CHAR8* AudioOutputNames[] = { "Other" }; +const XString8 defaultInstallTitle = "Install macOS"_XS8; +const XString8 defaultRecoveryTitle = "Recovery"_XS8; +const XStringW defaultRecoveryImagePath = L"mac"_XSW; +const XStringW defaultRecoveryDriveImagePath = L"mac"_XSW; +CUSTOM_LOADER_ENTRY::CUSTOM_LOADER_ENTRY(const CUSTOM_LOADER_ENTRY_SETTINGS& _settings) : settings(_settings) +{ + if ( settings.ImageData.notEmpty() ) { + if ( !EFI_ERROR(Image.Image.FromPNG(settings.ImageData.data(), settings.ImageData.size())) ) { + Image.setFilled(); + } + } + if ( settings.DriveImageData.notEmpty() ) { + if ( !EFI_ERROR(DriveImage.Image.FromPNG(settings.DriveImageData.data(), settings.DriveImageData.size())) ) { + DriveImage.setFilled(); + } + } + + if ( settings.CustomLogoTypeSettings == CUSTOM_BOOT_USER && settings.CustomLogoAsXString8.notEmpty() ) { + CustomLogoImage.LoadXImage(&self.getSelfVolumeRootDir(), settings.CustomLogoAsXString8); + if (CustomLogoImage.isEmpty()) { + DBG("Custom boot logo not found at path '%s'!\n", settings.CustomLogoAsXString8.c_str()); + CustomLogoType = CUSTOM_BOOT_DISABLED; + } + } else if ( settings.CustomLogoTypeSettings == CUSTOM_BOOT_USER && settings.CustomLogoAsData.notEmpty() ) { + CustomLogoImage.FromPNG(settings.CustomLogoAsData.data(), settings.CustomLogoAsData.size()); + if (CustomLogoImage.isEmpty()) { + DBG("Custom boot logo not decoded from data!\n"); + CustomLogoType = CUSTOM_BOOT_DISABLED; + } + } + DBG("Sub entry custom boot %s (0x%llX)\n", CustomBootModeToStr(settings.CustomLogoTypeSettings), (uintptr_t)&CustomLogoImage); + + for ( size_t idx = 0 ; idx < settings.SubEntriesSettings.size() ; ++idx ) { + const CUSTOM_LOADER_SUBENTRY_SETTINGS& CustomEntrySettings = settings.SubEntriesSettings[idx]; + CUSTOM_LOADER_SUBENTRY* entry = new CUSTOM_LOADER_SUBENTRY(*this, CustomEntrySettings); + SubEntries.AddReference(entry, true); + } + + KernelAndKextPatches = gSettings.KernelAndKextPatches; // Jief : why do we have a duplicated KernelAndKextPatches var inside CUSTOM_LOADER_ENTRY ? + +} XString8Array CUSTOM_LOADER_SUBENTRY::getLoadOptions() const { @@ -206,6 +247,10 @@ UINT8 CUSTOM_LOADER_SUBENTRY::getFlags(bool NoCachesDefault) const { UINT8 Flags = parent.getFlags(NoCachesDefault); if ( settings.m_Arguments.isDefined() ) Flags = OSFLAG_SET(Flags, OSFLAG_NODEFAULTARGS); + if ( settings.m_NoCaches.isDefined() ) { + if ( settings.m_NoCaches.value() ) Flags = OSFLAG_SET(Flags, OSFLAG_NOCACHES); + else Flags = OSFLAG_UNSET(Flags, OSFLAG_NOCACHES); + } return Flags; } @@ -224,7 +269,7 @@ XString8Array CUSTOM_LOADER_ENTRY::getLoadOptions() const const XString8& CUSTOM_LOADER_SUBENTRY::getTitle() const { if ( settings.m_Title.isDefined() ) return settings.m_Title.value(); if ( settings.m_FullTitle.isDefined() ) return NullXString8; - return parent.settings.Title; + return parent.settings.dgetTitle(); }; const XString8& CUSTOM_LOADER_SUBENTRY::getFullTitle() const { if ( settings.m_FullTitle.isDefined() ) return settings.m_FullTitle.value(); @@ -1710,10 +1755,12 @@ FillinCustomSubEntry ( if (Prop != NULL) { if (IsPropertyNotNullAndTrue(Prop)) { // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NOCACHES); + Entry->m_NoCaches = true; } else { // Use global settings if (gSettings.NoCaches) { // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NOCACHES); + Entry->m_NoCaches = false; } } } @@ -1788,7 +1835,7 @@ FillinCustomSubEntry ( return TRUE; } -STATIC + BOOLEAN FillinCustomEntry ( IN OUT CUSTOM_LOADER_ENTRY_SETTINGS *Entry, @@ -1843,20 +1890,21 @@ FillinCustomEntry ( } Prop = DictPointer->propertyForKey("Title"); if (Prop != NULL && (Prop->isString())) { - Entry->Title = Prop->getString()->stringValue(); + Entry->m_Title = Prop->getString()->stringValue(); } Prop = DictPointer->propertyForKey("FullTitle"); if (Prop != NULL && (Prop->isString())) { Entry->FullTitle = Prop->getString()->stringValue(); } + Entry->m_ImagePath.setEmpty(); Entry->ImageData.setEmpty(); Prop = DictPointer->propertyForKey("Image"); if (Prop != NULL) { - Entry->ImagePath.setEmpty(); - Entry->Image.setEmpty(); + Entry->m_ImagePath.setEmpty(); +// Entry->Image.setEmpty(); if (Prop->isString()) { - Entry->ImagePath = SWPrintf("%s", Prop->getString()->stringValue().c_str()); + Entry->m_ImagePath = SWPrintf("%s", Prop->getString()->stringValue().c_str()); } // we can't load the file yet, as ThemeDir is not initialized } else { @@ -1864,20 +1912,19 @@ FillinCustomEntry ( 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(); - } +// if (!EFI_ERROR(Entry->Image.Image.FromPNG(TmpData, DataLen))) { +// Entry->Image.setFilled(); +// } } } + Entry->m_DriveImagePath.setEmpty(); Entry->DriveImageData.setEmpty(); Prop = DictPointer->propertyForKey("DriveImage"); if (Prop != NULL) { - Entry->DriveImagePath.setEmpty(); - Entry->DriveImage.setEmpty(); +// Entry->DriveImage.setEmpty(); if (Prop->isString()) { - Entry->DriveImagePath = SWPrintf("%s", Prop->getString()->stringValue().c_str()); + Entry->m_DriveImagePath = SWPrintf("%s", Prop->getString()->stringValue().c_str()); } // we can't load the file yet, as ThemeDir is not initialized } else { @@ -1885,11 +1932,10 @@ FillinCustomEntry ( 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(); - } - FreePool(TmpData); +// if (!EFI_ERROR(Entry->DriveImage.Image.FromPNG(TmpData, DataLen))) { +// Entry->DriveImage.setFilled(); +// } +// FreePool(TmpData); } } @@ -1904,40 +1950,38 @@ FillinCustomEntry ( Prop = DictPointer->propertyForKey("CustomLogo"); if (Prop != NULL) { if (IsPropertyNotNullAndTrue(Prop)) { - Entry->CustomLogoType = CUSTOM_BOOT_APPLE; + Entry->CustomLogoTypeSettings = CUSTOM_BOOT_APPLE; } else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) { Entry->CustomLogoAsXString8 = Prop->getString()->stringValue(); if (Prop->getString()->stringValue().equalIC("Apple")) { - Entry->CustomLogoType = CUSTOM_BOOT_APPLE; + Entry->CustomLogoTypeSettings = CUSTOM_BOOT_APPLE; } else if (Prop->getString()->stringValue().equalIC("Alternate")) { - Entry->CustomLogoType = CUSTOM_BOOT_ALT_APPLE; + Entry->CustomLogoTypeSettings = CUSTOM_BOOT_ALT_APPLE; } else if (Prop->getString()->stringValue().equalIC("Theme")) { - Entry->CustomLogoType = CUSTOM_BOOT_THEME; + Entry->CustomLogoTypeSettings = CUSTOM_BOOT_THEME; } else { XStringW customLogo = XStringW() = Prop->getString()->stringValue(); - 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->CustomLogoType = CUSTOM_BOOT_DISABLED; - } + Entry->CustomLogoTypeSettings = CUSTOM_BOOT_USER; +// Entry->CustomLogoImage.LoadXImage(&self.getSelfVolumeRootDir(), customLogo); +// if (Entry->CustomLogoImage.isEmpty()) { +// DBG("Custom boot logo not found at path `%ls`!\n", customLogo.wc_str()); +// Entry->CustomLogoType = CUSTOM_BOOT_DISABLED; +// } } } else if ( Prop->isData() && Prop->getData()->dataLenValue() > 0 ) { - Entry->CustomLogoType = CUSTOM_BOOT_USER; + Entry->CustomLogoTypeSettings = 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->CustomLogoType = CUSTOM_BOOT_DISABLED; - } +// 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->CustomLogoType = CUSTOM_BOOT_DISABLED; +// } } else { - Entry->CustomLogoType = CUSTOM_BOOT_USER_DISABLED; + Entry->CustomLogoTypeSettings = CUSTOM_BOOT_USER_DISABLED; } - DBG("Custom entry boot %s LogoWidth = (0x%lld)\n", CustomBootModeToStr(Entry->CustomLogoType), Entry->CustomLogoImage.GetWidth()); + DBG("Custom entry boot %s\n", CustomBootModeToStr(Entry->CustomLogoTypeSettings)); } else { - Entry->CustomLogoType = CUSTOM_BOOT_DISABLED; + Entry->CustomLogoTypeSettings = CUSTOM_BOOT_DISABLED; } Prop = DictPointer->propertyForKey("BootBgColor"); @@ -1982,7 +2026,6 @@ 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; @@ -2003,23 +2046,23 @@ FillinCustomEntry ( // Entry->LoadOptions.Add("-s"); // Entry->LoadOptions.Add("-h"); // } - if (Entry->Title.isEmpty()) { - if (OSTYPE_IS_OSX_RECOVERY(Entry->Type)) { - Entry->Title = L"Recovery"_XSW; - } else if (OSTYPE_IS_OSX_INSTALLER(Entry->Type)) { - Entry->Title = L"Install macOS"_XSW; - } - } - if (Entry->Image.isEmpty() && (Entry->ImagePath.isEmpty())) { - if (OSTYPE_IS_OSX_RECOVERY(Entry->Type)) { - Entry->ImagePath = L"mac"_XSW; - } - } - if (Entry->DriveImage.isEmpty() && (Entry->DriveImagePath.isEmpty())) { - if (OSTYPE_IS_OSX_RECOVERY(Entry->Type)) { - Entry->DriveImagePath = L"recovery"_XSW; - } - } +// if (Entry->Title.isEmpty()) { +// if (OSTYPE_IS_OSX_RECOVERY(Entry->Type)) { +// Entry->Title = L"Recovery"_XSW; +// } else if (OSTYPE_IS_OSX_INSTALLER(Entry->Type)) { +// Entry->Title = L"Install macOS"_XSW; +// } +// } +// if (Entry->Image.isEmpty() && (Entry->ImagePath.isEmpty())) { +// if (OSTYPE_IS_OSX_RECOVERY(Entry->Type)) { +// Entry->ImagePath = L"mac"_XSW; +// } +// } +// if (Entry->DriveImage.isEmpty() && (Entry->DriveImagePath.isEmpty())) { +// if (OSTYPE_IS_OSX_RECOVERY(Entry->Type)) { +// Entry->DriveImagePath = L"recovery"_XSW; +// } +// } // OS Specific flags if (OSTYPE_IS_OSX(Entry->Type) || OSTYPE_IS_OSX_RECOVERY(Entry->Type) || OSTYPE_IS_OSX_INSTALLER(Entry->Type)) { @@ -2078,7 +2121,7 @@ FillinCustomEntry ( // (KERNEL_AND_KEXT_PATCHES *)(((UINTN)&gSettings) + OFFSET_OF(SETTINGS_DATA, KernelAndKextPatches))); // CopyKernelAndKextPatches(&Entry->KernelAndKextPatches, &gSettings.KernelAndKextPatches); - Entry->KernelAndKextPatches = gSettings.KernelAndKextPatches; +// Entry->KernelAndKextPatches = gSettings.KernelAndKextPatches; //#ifdef DUMP_KERNEL_KEXT_PATCHES // DumpKernelAndKextPatches ((KERNEL_AND_KEXT_PATCHES *)(((UINTN)Entry) + OFFSET_OF(CUSTOM_LOADER_ENTRY, KernelAndKextPatches))); diff --git a/rEFIt_UEFI/Platform/Settings.h b/rEFIt_UEFI/Platform/Settings.h index 080f8e26d..9198e8f72 100644 --- a/rEFIt_UEFI/Platform/Settings.h +++ b/rEFIt_UEFI/Platform/Settings.h @@ -151,13 +151,13 @@ public: ~ACPI_DROP_TABLE() {} }; +class CUSTOM_LOADER_SUBENTRY_SETTINGS; +class CUSTOM_LOADER_SUBENTRY; + class GUI_Custom_SubEntry_Class; template class XmlArray; -//class XmlArray; -class CUSTOM_LOADER_SUBENTRY_SETTINGS; void CompareCustomSubEntries(const XString8& label, const XObjArray& olDCustomEntries, const XmlArray& newCustomEntries); -class CUSTOM_LOADER_SUBENTRY; BOOLEAN FillinCustomSubEntry(UINT8 parentType, IN OUT CUSTOM_LOADER_SUBENTRY_SETTINGS *Entry, const TagDict* DictPointer, IN BOOLEAN SubEntry); class CUSTOM_LOADER_SUBENTRY_SETTINGS @@ -172,6 +172,8 @@ protected: undefinable_XString8 m_FullTitle = undefinable_XString8(); undefinable_XString8 m_Title = undefinable_XString8(); + undefinable_bool m_NoCaches = undefinable_bool(); + public: friend void ::CompareCustomSubEntries(const XString8& label, const XObjArray& olDCustomEntries, const XmlArray& newCustomEntries); @@ -196,24 +198,38 @@ public: const XString8& getFullTitle() const; }; +class GUI_Custom_Entry_Class; +class CUSTOM_LOADER_ENTRY_SETTINGS; + +void CompareCustomEntries(const XString8& label, const XObjArray& olDCustomEntries, const XmlArray& newCustomEntries); +BOOLEAN FillinCustomEntry(IN OUT CUSTOM_LOADER_ENTRY_SETTINGS *Entry, const TagDict* DictPointer, IN BOOLEAN SubEntry); + +extern const XString8 defaultInstallTitle; +extern const XString8 defaultRecoveryTitle; +extern const XStringW defaultRecoveryImagePath; +extern const XStringW defaultRecoveryDriveImagePath; + class CUSTOM_LOADER_ENTRY_SETTINGS { public: bool Disabled = 0; XObjArray SubEntriesSettings = XObjArray(); - XIcon Image = XIcon(); // todo remove - XStringW ImagePath = XStringW(); +protected: + XStringW m_ImagePath = XStringW(); +public: XBuffer ImageData = XBuffer(); - XIcon DriveImage = XIcon(); - XStringW DriveImagePath = XStringW(); +protected: + XStringW m_DriveImagePath = XStringW(); +public: XBuffer DriveImageData = XBuffer(); XStringW Volume = XStringW(); XStringW Path = XStringW(); undefinable_XString8 Arguments = undefinable_XString8(); XString8 AddArguments = XString8(); -// XString8Array LoadOptions = XString8Array(); XString8 FullTitle = XStringW(); - XString8 Title = XStringW(); +protected: + XString8 m_Title = XStringW(); +public: XStringW Settings = XStringW(); // path of a config.plist that'll be read at the beginning of startloader CHAR16 Hotkey = 0; BOOLEAN CommonSettings = 0; @@ -223,20 +239,42 @@ public: UINT8 Type = 0; UINT8 VolumeType = 0; UINT8 KernelScan = KERNEL_SCAN_ALL; - UINT8 CustomLogoType = 0; +protected: + UINT8 CustomLogoTypeSettings = 0; +public: 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; undefinable_bool NoCaches = undefinable_bool(); -// CUSTOM_LOADER_ENTRY() {} -// -// // Not sure if default are valid. Delete them. If needed, proper ones can be created -// CUSTOM_LOADER_ENTRY(const CUSTOM_LOADER_ENTRY&) = delete; -// CUSTOM_LOADER_ENTRY& operator=(const CUSTOM_LOADER_ENTRY&) = delete; + friend class ::CUSTOM_LOADER_ENTRY; + friend void ::CompareCustomEntries(const XString8& label, const XObjArray& olDCustomEntries, const XmlArray& newCustomEntries); + friend BOOLEAN FillinCustomEntry(IN OUT CUSTOM_LOADER_ENTRY_SETTINGS *Entry, const TagDict* DictPointer, IN BOOLEAN SubEntry); + + + const XString8& dgetTitle() const { + if ( m_Title.notEmpty() ) return m_Title; + if (OSTYPE_IS_OSX_RECOVERY(Type)) { + return defaultRecoveryTitle; + } else if (OSTYPE_IS_OSX_INSTALLER(Type)) { + return defaultInstallTitle; + } + return NullXString8; + } + + const XStringW& dgetImagePath() const { + if ( m_ImagePath.notEmpty() ) return m_ImagePath; + if ( ImageData.notEmpty() ) return NullXStringW; + if (OSTYPE_IS_OSX_RECOVERY(Type)) return defaultRecoveryImagePath; + return NullXStringW; + } + const XStringW& dgetDriveImagePath() const { + if ( m_DriveImagePath.notEmpty() ) return m_DriveImagePath; + if ( DriveImageData.notEmpty() ) return NullXStringW; + if (OSTYPE_IS_OSX_RECOVERY(Type)) return defaultRecoveryDriveImagePath; + return NullXStringW; + } }; @@ -245,15 +283,16 @@ class CUSTOM_LOADER_ENTRY public: const CUSTOM_LOADER_ENTRY_SETTINGS& settings = CUSTOM_LOADER_ENTRY_SETTINGS(); XObjArray SubEntries = XObjArray(); + XIcon Image = XIcon(); + XIcon DriveImage = XIcon(); + XImage CustomLogoImage = XImage(); // Todo : remove from settings. + UINT8 CustomLogoType = 0; + KERNEL_AND_KEXT_PATCHES KernelAndKextPatches = KERNEL_AND_KEXT_PATCHES(); + + CUSTOM_LOADER_ENTRY(const CUSTOM_LOADER_ENTRY_SETTINGS& _settings); - CUSTOM_LOADER_ENTRY(const CUSTOM_LOADER_ENTRY_SETTINGS& _settings) : settings(_settings) { - for ( size_t idx = 0 ; idx < settings.SubEntriesSettings.size() ; ++idx ) { - const CUSTOM_LOADER_SUBENTRY_SETTINGS& CustomEntrySettings = settings.SubEntriesSettings[idx]; - CUSTOM_LOADER_SUBENTRY* entry = new CUSTOM_LOADER_SUBENTRY(*this, CustomEntrySettings); - SubEntries.AddReference(entry, true); - } - } XString8Array getLoadOptions() const; + UINT8 getFlags(bool NoCachesDefault) const { UINT8 Flags = 0; if ( settings.Arguments.isDefined() ) Flags = OSFLAG_SET(Flags, OSFLAG_NODEFAULTARGS); diff --git a/rEFIt_UEFI/entry_scan/loader.cpp b/rEFIt_UEFI/entry_scan/loader.cpp index 6d486f2ee..9d76be1ff 100644 --- a/rEFIt_UEFI/entry_scan/loader.cpp +++ b/rEFIt_UEFI/entry_scan/loader.cpp @@ -2009,8 +2009,8 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, for (VolumeIndex = 0; VolumeIndex < Volumes.size(); ++VolumeIndex) { LOADER_ENTRY *Entry = NULL; - XIcon Image = Custom.settings.Image; - XIcon DriveImage = Custom.settings.DriveImage; + XIcon Image = Custom.Image; + XIcon DriveImage = Custom.DriveImage; EFI_GUID *Guid = NULL; UINT64 VolumeSize; @@ -2098,16 +2098,16 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, } // Change to custom image if needed - if (Image.isEmpty() && Custom.settings.ImagePath.notEmpty()) { - Image.LoadXImage(&ThemeX.getThemeDir(), Custom.settings.ImagePath); + if (Image.isEmpty() && Custom.settings.dgetImagePath().notEmpty()) { + Image.LoadXImage(&ThemeX.getThemeDir(), Custom.settings.dgetImagePath()); if (Image.isEmpty()) { - Image.LoadXImage(&ThemeX.getThemeDir(), L"os_"_XSW + Custom.settings.ImagePath); + Image.LoadXImage(&ThemeX.getThemeDir(), L"os_"_XSW + Custom.settings.dgetImagePath()); if (Image.isEmpty()) { - Image.LoadXImage(&self.getCloverDir(), Custom.settings.ImagePath); + Image.LoadXImage(&self.getCloverDir(), Custom.settings.dgetImagePath()); if (Image.isEmpty()) { - Image.LoadXImage(&self.getSelfVolumeRootDir(), Custom.settings.ImagePath); + Image.LoadXImage(&self.getSelfVolumeRootDir(), Custom.settings.dgetImagePath()); if (Image.isEmpty()) { - Image.LoadXImage(Volume->RootDir, Custom.settings.ImagePath); + Image.LoadXImage(Volume->RootDir, Custom.settings.dgetImagePath()); } } } @@ -2115,14 +2115,14 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, } // Change to custom drive image if needed - if (DriveImage.isEmpty() && Custom.settings.DriveImagePath.notEmpty()) { - DriveImage.LoadXImage(&ThemeX.getThemeDir(), Custom.settings.DriveImagePath); + if (DriveImage.isEmpty() && Custom.settings.dgetDriveImagePath().notEmpty()) { + DriveImage.LoadXImage(&ThemeX.getThemeDir(), Custom.settings.dgetDriveImagePath()); if (DriveImage.isEmpty()) { - DriveImage.LoadXImage(&self.getCloverDir(), Custom.settings.ImagePath); + DriveImage.LoadXImage(&self.getCloverDir(), Custom.settings.dgetImagePath()); if (DriveImage.isEmpty()) { - DriveImage.LoadXImage(&self.getSelfVolumeRootDir(), Custom.settings.ImagePath); + DriveImage.LoadXImage(&self.getSelfVolumeRootDir(), Custom.settings.dgetImagePath()); if (DriveImage.isEmpty()) { - DriveImage.LoadXImage(Volume->RootDir, Custom.settings.ImagePath); + DriveImage.LoadXImage(Volume->RootDir, Custom.settings.dgetImagePath()); } } } @@ -2258,9 +2258,9 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, DBG("match!\n"); // Create an entry for this volume - Entry = CreateLoaderEntry(CustomPath, CustomOptions, Custom.settings.FullTitle, Custom.settings.Title, Volume, + Entry = CreateLoaderEntry(CustomPath, CustomOptions, Custom.settings.FullTitle, Custom.settings.dgetTitle(), Volume, (Image.isEmpty() ? NULL : &Image), (DriveImage.isEmpty() ? NULL : &DriveImage), - Custom.settings.Type, newCustomFlags, Custom.settings.Hotkey, Custom.settings.BootBgColor, Custom.settings.CustomLogoType, Custom.settings.CustomLogoImage, + Custom.settings.Type, newCustomFlags, Custom.settings.Hotkey, Custom.settings.BootBgColor, Custom.CustomLogoType, Custom.CustomLogoImage, /*(KERNEL_AND_KEXT_PATCHES *)(((UINTN)Custom) + OFFSET_OF(CUSTOM_LOADER_ENTRY, KernelAndKextPatches))*/ NULL, TRUE); if (Entry != NULL) { if ( Custom.settings.Settings.notEmpty() ) DBG("Custom settings: %ls.plist will %s be applied\n", Custom.settings.Settings.wc_str(), Custom.settings.CommonSettings?"not":""); @@ -2273,7 +2273,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, UINTN CustomSubIndex = 0; // Add subscreen REFIT_MENU_SCREEN *SubScreen = new REFIT_MENU_SCREEN; - SubScreen->Title.SWPrintf("Boot Options for %ls on %ls", (Custom.settings.Title.notEmpty()) ? XStringW(Custom.settings.Title).wc_str() : CustomPath.wc_str(), Entry->DisplayedVolName.wc_str()); + SubScreen->Title.SWPrintf("Boot Options for %ls on %ls", (Custom.settings.dgetTitle().notEmpty()) ? XStringW(Custom.settings.dgetTitle()).wc_str() : CustomPath.wc_str(), Entry->DisplayedVolName.wc_str()); SubScreen->TitleImage = Entry->Image; SubScreen->ID = Custom.settings.Type + 20; SubScreen->GetAnime(); @@ -2324,7 +2324,7 @@ void AddCustomEntries(void) // Traverse the custom entries for (size_t i = 0 ; i < GlobalConfig.CustomEntries.size(); ++i) { CUSTOM_LOADER_ENTRY& Custom = GlobalConfig.CustomEntries[i]; - DBG("- [00]: '%s'\n", Custom.settings.FullTitle.isEmpty() ? Custom.settings.Title.c_str() : Custom.settings.FullTitle.c_str() ); + DBG("- [00]: '%s'\n", Custom.settings.FullTitle.isEmpty() ? Custom.settings.dgetTitle().c_str() : Custom.settings.FullTitle.c_str() ); if ( Custom.settings.Disabled ) { DBG(" Disabled\n"); continue; // before, disabled entries settings weren't loaded.