From 7babc6fe9b3cc091b892cac79abe4a843c889997 Mon Sep 17 00:00:00 2001 From: jief666 Date: Sun, 11 Apr 2021 08:18:52 +0300 Subject: [PATCH] Do not use OC quirks struct anymore in settings. Fix Disabled property in Smbios/Block config. Move flagstate in GlobalConfig. Remove gSettings.Smbios.REV, ECPI, RBr and RPlt. Create getRBr() and getRPlt(). Operator == and isEqual in XArray, XObjArray, SETTINGS_DATA. Rename equal to isEqual in XString and XStringArray. Operator == in INPUT_ITEM, undefinable, ABSTRACT_PATCH (and derived) and RAM_SLOT_INFO class. Clean b64cdecode.h. --- Include/Library/VideoBiosPatchLib.h | 6 +- rEFIt_UEFI/Platform/APFS.cpp | 2 +- rEFIt_UEFI/Platform/DataHubCpu.cpp | 37 +- rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.h | 116 ++- rEFIt_UEFI/Platform/Nvram.cpp | 2 +- rEFIt_UEFI/Platform/Self.cpp | 2 +- rEFIt_UEFI/Platform/Settings.cpp | 262 ++--- rEFIt_UEFI/Platform/Settings.h | 917 +++++++++++++++++- rEFIt_UEFI/Platform/b64cdecode.cpp | 23 +- rEFIt_UEFI/Platform/b64cdecode.h | 33 +- rEFIt_UEFI/Platform/platformdata.cpp | 307 +++--- rEFIt_UEFI/Platform/platformdata.h | 6 +- rEFIt_UEFI/Platform/plist/TagDict.cpp | 2 +- rEFIt_UEFI/Platform/plist/plist.cpp | 2 +- rEFIt_UEFI/Platform/smbios.h | 15 + rEFIt_UEFI/PlatformPOSIX/include/Platform.h | 19 +- rEFIt_UEFI/cpp_foundation/XArray.h | 26 +- rEFIt_UEFI/cpp_foundation/XObjArray.h | 20 + rEFIt_UEFI/cpp_foundation/XStringAbstract.h | 10 +- rEFIt_UEFI/cpp_foundation/XStringArray.h | 6 +- rEFIt_UEFI/cpp_lib/undefinable.h | 8 + rEFIt_UEFI/entry_scan/common.cpp | 2 +- rEFIt_UEFI/entry_scan/legacy.cpp | 2 +- rEFIt_UEFI/entry_scan/loader.cpp | 48 +- rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp | 2 +- rEFIt_UEFI/libeg/VectorGraphics.cpp | 8 +- rEFIt_UEFI/libeg/XTheme.cpp | 18 +- rEFIt_UEFI/libeg/libeg.h | 12 + rEFIt_UEFI/refit/lib.cpp | 4 +- rEFIt_UEFI/refit/main.cpp | 63 +- rEFIt_UEFI/refit/menu.cpp | 42 +- 31 files changed, 1549 insertions(+), 473 deletions(-) diff --git a/Include/Library/VideoBiosPatchLib.h b/Include/Library/VideoBiosPatchLib.h index 0637303b2..f8cec0dad 100644 --- a/Include/Library/VideoBiosPatchLib.h +++ b/Include/Library/VideoBiosPatchLib.h @@ -11,9 +11,11 @@ Set of Search & replace bytes for VideoBiosPatchBytes(). **/ typedef struct _VBIOS_PATCH_BYTES { - VOID *Find; - VOID *Replace; + JCONST VOID *Find; + JCONST VOID *Replace; UINTN NumberOfBytes; + + } VBIOS_PATCH_BYTES; diff --git a/rEFIt_UEFI/Platform/APFS.cpp b/rEFIt_UEFI/Platform/APFS.cpp index a65b978c7..d198c0411 100644 --- a/rEFIt_UEFI/Platform/APFS.cpp +++ b/rEFIt_UEFI/Platform/APFS.cpp @@ -49,7 +49,7 @@ EFI_GUID *APFSPartitionUUIDExtract( } if (DevicePathType(DevicePath) == MEDIA_DEVICE_PATH && DevicePathSubType (DevicePath) == MEDIA_VENDOR_DP) { //Check that vendor-assigned GUID defines APFS Container Partition - if ( GuidLEToXString8(*(EFI_GUID *)((UINT8 *)DevicePath+0x04)).equalIC(ApfsSignatureUUID) ) { + if ( GuidLEToXString8(*(EFI_GUID *)((UINT8 *)DevicePath+0x04)).isEqualIC(ApfsSignatureUUID) ) { return (EFI_GUID *)((UINT8 *)DevicePath+0x14); } } diff --git a/rEFIt_UEFI/Platform/DataHubCpu.cpp b/rEFIt_UEFI/Platform/DataHubCpu.cpp index 4ae7b0af6..59ed34ea0 100644 --- a/rEFIt_UEFI/Platform/DataHubCpu.cpp +++ b/rEFIt_UEFI/Platform/DataHubCpu.cpp @@ -371,10 +371,10 @@ SetVariablesForOSX(LOADER_ENTRY *Entry) } // ->GetVariable(flagstate, gEfiAppleBootGuid, 0/0, 20, 10FE110) = Not Found - if (gSettings.BootGraphics.flagstate[3] == 0x80) { + if (GlobalConfig.flagstate[3] == 0x80) { DeleteNvramVariable(L"flagstate", &gEfiAppleBootGuid); } else { - SetNvramVariable(L"flagstate", &gEfiAppleBootGuid, Attributes, 32, &gSettings.BootGraphics.flagstate); + SetNvramVariable(L"flagstate", &gEfiAppleBootGuid, Attributes, 32, &GlobalConfig.flagstate); } // Hack for recovery by Asgorath @@ -456,12 +456,12 @@ SetupDataForOSX(BOOLEAN Hibernate) UINT64 ARTFrequency; UINTN Revision; UINT16 Zero = 0; - BOOLEAN isRevLess = (gSettings.Smbios.REV[0] == 0 && - gSettings.Smbios.REV[1] == 0 && - gSettings.Smbios.REV[2] == 0 && - gSettings.Smbios.REV[3] == 0 && - gSettings.Smbios.REV[4] == 0 && - gSettings.Smbios.REV[5] == 0); + BOOLEAN isRevLess = (ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[0] == 0 && + ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[1] == 0 && + ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[2] == 0 && + ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[3] == 0 && + ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[4] == 0 && + ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[5] == 0); Revision = StrDecimalToUintn(gFirmwareRevision); @@ -493,6 +493,11 @@ SetupDataForOSX(BOOLEAN Hibernate) CpuSpeed = gCPUStructure.CPUFrequency; gSettings.CPU.CpuFreqMHz = (UINT32)DivU64x32(CpuSpeed, Mega); + char RBr[8]; + getRBr(GlobalConfig.CurrentModel, RBr); + char RPlt[8]; + getRPlt(GlobalConfig.CurrentModel, gSettings.Smbios.Mobile, RPlt); + // Locate DataHub Protocol Status = gBS->LocateProtocol(&gEfiDataHubProtocolGuid, NULL, (void**)&gDataHub); if (!EFI_ERROR(Status)) { @@ -538,11 +543,11 @@ SetupDataForOSX(BOOLEAN Hibernate) // SMC helper if (!isRevLess) { - LogDataHub(&gEfiMiscSubClassGuid, L"RBr", &gSettings.Smbios.RBr, 8); - LogDataHub(&gEfiMiscSubClassGuid, L"EPCI", &gSettings.Smbios.EPCI, 4); - LogDataHub(&gEfiMiscSubClassGuid, L"REV", &gSettings.Smbios.REV, 6); + LogDataHub(&gEfiMiscSubClassGuid, L"RBr", &RBr, 8); + LogDataHub(&gEfiMiscSubClassGuid, L"EPCI", &ApplePlatformData[GlobalConfig.CurrentModel].smcConfig, 4); + LogDataHub(&gEfiMiscSubClassGuid, L"REV", ApplePlatformData[GlobalConfig.CurrentModel].smcRevision, 6); } - LogDataHub(&gEfiMiscSubClassGuid, L"RPlt", &gSettings.Smbios.RPlt, 8); + LogDataHub(&gEfiMiscSubClassGuid, L"RPlt", RPlt, 8); LogDataHub(&gEfiMiscSubClassGuid, L"BEMB", &gSettings.Smbios.Mobile, 1); // all current settings @@ -555,11 +560,11 @@ SetupDataForOSX(BOOLEAN Hibernate) return; } if (!isRevLess) { - AddSMCkey(SMC_MAKE_KEY('R','B','r',' '), 8, SmcKeyTypeCh8, (SMC_DATA *)&gSettings.Smbios.RBr); - AddSMCkey(SMC_MAKE_KEY('E','P','C','I'), 4, SmcKeyTypeUint32, (SMC_DATA *)&gSettings.Smbios.EPCI); - AddSMCkey(SMC_MAKE_KEY('R','E','V',' '), 6, SmcKeyTypeCh8, (SMC_DATA *)&gSettings.Smbios.REV); + AddSMCkey(SMC_MAKE_KEY('R','B','r',' '), 8, SmcKeyTypeCh8, (SMC_DATA *)&RBr); + AddSMCkey(SMC_MAKE_KEY('E','P','C','I'), 4, SmcKeyTypeUint32, (SMC_DATA *)&ApplePlatformData[GlobalConfig.CurrentModel].smcConfig); + AddSMCkey(SMC_MAKE_KEY('R','E','V',' '), 6, SmcKeyTypeCh8, (SMC_DATA *)&ApplePlatformData[GlobalConfig.CurrentModel].smcRevision); } - AddSMCkey(SMC_MAKE_KEY('R','P','l','t'), 8, SmcKeyTypeCh8, (SMC_DATA *)&gSettings.Smbios.RPlt); + AddSMCkey(SMC_MAKE_KEY('R','P','l','t'), 8, SmcKeyTypeCh8, (SMC_DATA *)&RPlt); AddSMCkey(SMC_MAKE_KEY('B','E','M','B'), 1, SmcKeyTypeFlag, (SMC_DATA *)&gSettings.Smbios.Mobile); //laptop battery keys will be better to import from nvram.plist or read from ACPI(?) //they are needed for FileVault2 who want to draw battery status diff --git a/rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.h b/rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.h index 0d176195f..6fd696ef9 100644 --- a/rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.h +++ b/rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.h @@ -21,7 +21,6 @@ class ABSTRACT_PATCH { public: bool Disabled = bool(); -// XString8 Comment = XString8(); XBuffer Find = XBuffer (); XBuffer Replace = XBuffer (); XBuffer MaskFind = XBuffer (); @@ -33,23 +32,58 @@ public: INTN Skip = INTN(); XString8 MatchOS = XString8(); XString8 MatchBuild = XString8(); + INPUT_ITEM MenuItem = INPUT_ITEM(); // Computed - XString8 Name = XString8(); + virtual XString8 getName() const = 0; XString8 Label = XString8(); // TODO : it's a calculated value from comment field. + virtual ~ABSTRACT_PATCH() {} + + #if __cplusplus > 201703L + bool operator == (const ABSTRACT_PATCH&) const = default; + #endif + bool isEqual(const ABSTRACT_PATCH& other) const + { + if ( !(Disabled == other.Disabled ) ) return false; + if ( !(Find == other.Find ) ) return false; + if ( !(Replace == other.Replace ) ) return false; + if ( !(MaskFind == other.MaskFind ) ) return false; + if ( !(MaskReplace == other.MaskReplace ) ) return false; + if ( !(StartPattern == other.StartPattern ) ) return false; + if ( !(StartMask == other.StartMask ) ) return false; + if ( !(SearchLen == other.SearchLen ) ) return false; + if ( !(Count == other.Count ) ) return false; + if ( !(Skip == other.Skip ) ) return false; + if ( !(MatchOS == other.MatchOS ) ) return false; + if ( !(MatchBuild == other.MatchBuild ) ) return false; + if ( MenuItem != other.MenuItem ) return false; + if ( !(Label == other.Label ) ) return false; + return true; + } + /** Returns a boolean and then enable disable the patch if MachOSEntry have a match for the booted OS. */ bool IsPatchEnabledByBuildNumber(const XString8& Build); bool IsPatchEnabled(const MacOsVersion& CurrOS); + }; class ABSTRACT_KEXT_OR_KERNEL_PATCH : public ABSTRACT_PATCH { public: - bool IsPlistPatch = BOOLEAN(); XString8 ProcedureName = XString8(); //procedure len will be StartPatternLen - INPUT_ITEM MenuItem = INPUT_ITEM(); + + + #if __cplusplus > 201703L + bool operator == (const ABSTRACT_KEXT_OR_KERNEL_PATCH&) const = default; + #endif + bool isEqual(const ABSTRACT_KEXT_OR_KERNEL_PATCH& other) const + { + if ( !ABSTRACT_PATCH::isEqual (other) ) return false; + if ( !(ProcedureName == other.ProcedureName ) ) return false; + return true; + } }; @@ -57,20 +91,53 @@ public: class KEXT_PATCH : public ABSTRACT_KEXT_OR_KERNEL_PATCH { public: + XString8 Name = XString8(); bool IsPlistPatch = BOOLEAN(); - INPUT_ITEM MenuItem = INPUT_ITEM(); + + + virtual XString8 getName() const { return Name; } + + #if __cplusplus > 201703L + bool operator == (const KEXT_PATCH&) const = default; + #endif + bool isEqual(const KEXT_PATCH& other) const + { + if ( !ABSTRACT_KEXT_OR_KERNEL_PATCH::isEqual (other) ) return false; + if ( !(IsPlistPatch == other.IsPlistPatch ) ) return false; + return true; + } }; class KERNEL_PATCH : public ABSTRACT_KEXT_OR_KERNEL_PATCH { public: - INPUT_ITEM MenuItem = INPUT_ITEM(); + + virtual XString8 getName() const { return "kernel"_XS8; } + + #if __cplusplus > 201703L + bool operator == (const KERNEL_PATCH&) const = default; + #endif + bool isEqual(const KERNEL_PATCH& other) const + { + if ( !ABSTRACT_KEXT_OR_KERNEL_PATCH::isEqual (other) ) return false; + return true; + } }; class BOOT_PATCH : public ABSTRACT_PATCH { public: - INPUT_ITEM MenuItem = INPUT_ITEM(); + + virtual XString8 getName() const { return "boot.efi"_XS8; } + + #if __cplusplus > 201703L + bool operator == (const BOOT_PATCH&) const = default; + #endif + bool isEqual(const BOOT_PATCH& other) const + { + if ( !ABSTRACT_PATCH::isEqual (other) ) return false; + return true; + } }; class KERNEL_AND_KEXT_PATCHES @@ -89,10 +156,37 @@ public: XString8 KPATIConnectorsController = XString8(); XBuffer KPATIConnectorsData = XBuffer(); XBuffer KPATIConnectorsPatch = XBuffer(); - XStringWArray ForceKextsToLoad = XStringWArray(); - XObjArray KextPatches = XObjArray(); - XObjArray KernelPatches = XObjArray(); - XObjArray BootPatches = XObjArray(); + XStringWArray ForceKextsToLoad/* = XStringWArray()*/; + XObjArray KextPatches/* = XObjArray()*/; + XObjArray KernelPatches/* = XObjArray()*/; + XObjArray BootPatches/* = XObjArray()*/; + + KERNEL_AND_KEXT_PATCHES() : ForceKextsToLoad(), KextPatches(), KernelPatches(), BootPatches() {} + + #if __cplusplus > 201703L + bool operator == (const KERNEL_AND_KEXT_PATCHES&) const = default; + #endif + bool isEqual(const KERNEL_AND_KEXT_PATCHES& other) const + { + if ( !(KPDebug == other.KPDebug ) ) return false; + if ( !(KPKernelLapic == other.KPKernelLapic ) ) return false; + if ( !(KPKernelXCPM == other.KPKernelXCPM ) ) return false; + if ( !(_KPKernelPm == other._KPKernelPm ) ) return false; + if ( !(KPPanicNoKextDump == other.KPPanicNoKextDump ) ) return false; + if ( !(_KPAppleIntelCPUPM == other._KPAppleIntelCPUPM ) ) return false; + if ( !(KPAppleRTC == other.KPAppleRTC ) ) return false; + if ( !(EightApple == other.EightApple ) ) return false; + if ( !(KPDELLSMBIOS == other.KPDELLSMBIOS ) ) return false; + if ( !(FakeCPUID == other.FakeCPUID ) ) return false; + if ( !(KPATIConnectorsController == other.KPATIConnectorsController ) ) return false; + if ( !(KPATIConnectorsData == other.KPATIConnectorsData ) ) return false; + if ( !(KPATIConnectorsPatch == other.KPATIConnectorsPatch ) ) return false; + if ( !(ForceKextsToLoad == other.ForceKextsToLoad ) ) return false; + if ( !KextPatches.isEqual(other.KextPatches) ) return false; + if ( !KernelPatches.isEqual(other.KernelPatches) ) return false; + if ( !BootPatches.isEqual(other.BootPatches) ) return false; + return true; + } } ; diff --git a/rEFIt_UEFI/Platform/Nvram.cpp b/rEFIt_UEFI/Platform/Nvram.cpp index 4e4ab00af..e2b982806 100755 --- a/rEFIt_UEFI/Platform/Nvram.cpp +++ b/rEFIt_UEFI/Platform/Nvram.cpp @@ -1242,7 +1242,7 @@ FindStartupDiskVolume ( DBG(" checking '%ls'\n", DevicePathToXStringW(Volume->DevicePath).wc_str()); DBG(" '%ls'\n", LoaderPath.wc_str()); // case insensitive cmp - if ( LoaderPath.equalIC(gEfiBootLoaderPath) ) { + if ( LoaderPath.isEqualIC(gEfiBootLoaderPath) ) { // that's the one DBG(" - found entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName.wc_str(), LoaderPath.wc_str()); return Index; diff --git a/rEFIt_UEFI/Platform/Self.cpp b/rEFIt_UEFI/Platform/Self.cpp index 8111d3ba9..3b5f88414 100644 --- a/rEFIt_UEFI/Platform/Self.cpp +++ b/rEFIt_UEFI/Platform/Self.cpp @@ -85,7 +85,7 @@ EFI_STATUS Self::_initialize() m_efiFileName = m_CloverDirFullPath.basename(); // History : if this Clover was started as BootX64.efi, redirect to /EFI/CLOVER - if ( m_CloverDirFullPath.equalIC("\\EFI\\Boot\\BootX64.efi") ) { + if ( m_CloverDirFullPath.isEqualIC("\\EFI\\Boot\\BootX64.efi") ) { m_CloverDirFullPath.takeValueFrom("\\EFI\\CLOVER\\CloverX64.efi"); } #ifdef DEBUG diff --git a/rEFIt_UEFI/Platform/Settings.cpp b/rEFIt_UEFI/Platform/Settings.cpp index 24d8e47fa..07aa0ae51 100755 --- a/rEFIt_UEFI/Platform/Settings.cpp +++ b/rEFIt_UEFI/Platform/Settings.cpp @@ -282,8 +282,8 @@ const XString8& CUSTOM_LOADER_SUBENTRY::getFullTitle() const { bool SETTINGS_DATA::GUIClass::getDarkEmbedded(bool isDaylight) const { - if ( EmbeddedThemeType.equalIC("Dark") ) return true; - if ( EmbeddedThemeType.equalIC("Daytime") ) return !isDaylight; + if ( EmbeddedThemeType.isEqualIC("Dark") ) return true; + if ( EmbeddedThemeType.isEqualIC("Daytime") ) return !isDaylight; return false; } @@ -1183,7 +1183,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches, } DBG(" %s", newKernelPatch.Label.c_str()); - newKernelPatch.Name = "kernel"_XS8; +// newKernelPatch.Name = "kernel"_XS8; prop3 = Prop2->propertyForKey("Disabled"); newKernelPatch.Disabled = IsPropertyNotNullAndTrue(prop3); @@ -1316,7 +1316,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches, } DBG(" %s", newBootPatch.Label.c_str()); - newBootPatch.Name = "boot.efi"_XS8; +// newBootPatch.Name = "boot.efi"_XS8; prop3 = Prop2->propertyForKey("Disabled"); newBootPatch.Disabled = IsPropertyNotNullAndTrue(prop3); @@ -1430,7 +1430,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches, // if ( osToc.size() > 0 && currOStoc.size() > 0 && osToc[0] == "11"_XS8 && currOStoc[0] == "11"_XS8 ) { // if (osToc.size() == 1 ) return true; // if (osToc.size() == 2 ) { -// if ( osToc[1].equalIC("x") ) return true; +// if ( osToc[1].isEqualIC("x") ) return true; // if ( currOStoc.size() == 2 && osToc[1] == currOStoc[1] ) return true; // } // } @@ -1448,7 +1448,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches, // ret = TRUE; // } else if ( osToc[0] == currOStoc[0] // && osToc[1] == currOStoc[1] -// && osToc[2].equalIC("x") ) { +// && osToc[2].isEqualIC("x") ) { // ret = TRUE; // } // } else if (currOStoc.size() == 2) { @@ -1457,7 +1457,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches, // ret = TRUE; // } else if ( osToc[0] == currOStoc[0] // && osToc[1] == currOStoc[1] -// && osToc[2].equalIC("x") == 0 ) { +// && osToc[2].isEqualIC("x") == 0 ) { // ret = TRUE; // } // } @@ -1472,13 +1472,13 @@ static UINT8 CheckVolumeType(UINT8 VolumeType, const TagStruct* Prop) return 0; } UINT8 VolumeTypeTmp = VolumeType; - if (Prop->getString()->stringValue().equalIC("Internal")) { + if (Prop->getString()->stringValue().isEqualIC("Internal")) { VolumeTypeTmp |= VOLTYPE_INTERNAL; - } else if (Prop->getString()->stringValue().equalIC("External")) { + } else if (Prop->getString()->stringValue().isEqualIC("External")) { VolumeTypeTmp |= VOLTYPE_EXTERNAL; - } else if (Prop->getString()->stringValue().equalIC("Optical")) { + } else if (Prop->getString()->stringValue().isEqualIC("Optical")) { VolumeTypeTmp |= VOLTYPE_OPTICAL; - } else if (Prop->getString()->stringValue().equalIC("FireWire")) { + } else if (Prop->getString()->stringValue().isEqualIC("FireWire")) { VolumeTypeTmp |= VOLTYPE_FIREWIRE; } return VolumeTypeTmp; @@ -1611,11 +1611,11 @@ FillinCustomSubEntry ( // Entry->CustomLogoType = CUSTOM_BOOT_APPLE; // } else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) { // Entry->CustomLogoAsXString8 = Prop->getString()->stringValue(); -// if (Prop->getString()->stringValue().equalIC("Apple")) { +// if (Prop->getString()->stringValue().isEqualIC("Apple")) { // Entry->CustomLogoType = CUSTOM_BOOT_APPLE; -// } else if (Prop->getString()->stringValue().equalIC("Alternate")) { +// } else if (Prop->getString()->stringValue().isEqualIC("Alternate")) { // Entry->CustomLogoType = CUSTOM_BOOT_ALT_APPLE; -// } else if (Prop->getString()->stringValue().equalIC("Theme")) { +// } else if (Prop->getString()->stringValue().isEqualIC("Theme")) { // Entry->CustomLogoType = CUSTOM_BOOT_THEME; // } else { // XStringW customLogo = XStringW() = Prop->getString()->stringValue(); @@ -1662,7 +1662,7 @@ FillinCustomSubEntry ( // Prop = DictPointer->propertyForKey("Hidden"); // if (Prop != NULL) { // if ((Prop->isString()) && -// (Prop->getString()->stringValue().equalIC("Always"))) { +// (Prop->getString()->stringValue().isEqualIC("Always"))) { // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED); // } else if (IsPropertyNotNullAndTrue(Prop)) { // DBG(" hiding entry because Hidden flag is YES\n"); @@ -1674,20 +1674,20 @@ FillinCustomSubEntry ( // // Prop = DictPointer->propertyForKey("Type"); // if (Prop != NULL && (Prop->isString())) { -// if ((Prop->getString()->stringValue().equalIC("OSX")) || -// (Prop->getString()->stringValue().equalIC("macOS"))) { +// if ((Prop->getString()->stringValue().isEqualIC("OSX")) || +// (Prop->getString()->stringValue().isEqualIC("macOS"))) { // Entry->Type = OSTYPE_OSX; -// } else if (Prop->getString()->stringValue().equalIC("OSXInstaller")) { +// } else if (Prop->getString()->stringValue().isEqualIC("OSXInstaller")) { // Entry->Type = OSTYPE_OSX_INSTALLER; -// } else if (Prop->getString()->stringValue().equalIC("OSXRecovery")) { +// } else if (Prop->getString()->stringValue().isEqualIC("OSXRecovery")) { // Entry->Type = OSTYPE_RECOVERY; -// } else if (Prop->getString()->stringValue().equalIC("Windows")) { +// } else if (Prop->getString()->stringValue().isEqualIC("Windows")) { // Entry->Type = OSTYPE_WINEFI; -// } else if (Prop->getString()->stringValue().equalIC("Linux")) { +// } else if (Prop->getString()->stringValue().isEqualIC("Linux")) { // Entry->Type = OSTYPE_LIN; //// TODO remove from here // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NODEFAULTARGS); -// } else if (Prop->getString()->stringValue().equalIC("LinuxKernel")) { +// } else if (Prop->getString()->stringValue().isEqualIC("LinuxKernel")) { // Entry->Type = OSTYPE_LINEFI; // } else { // DBG("** Warning: unknown custom entry Type '%s'\n", Prop->getString()->stringValue().c_str()); @@ -1733,7 +1733,7 @@ FillinCustomSubEntry ( // } else if ( Prop->isFalseOrNn() ) { // Entry->InjectKexts = 0; // // nothing to do -// } else if ( Prop->isString() && Prop->getString()->stringValue().equalIC("Detect") ) { +// } else if ( Prop->isString() && Prop->getString()->stringValue().isEqualIC("Detect") ) { // Entry->InjectKexts = 2; // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_CHECKFAKESMC); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS); @@ -1958,11 +1958,11 @@ FillinCustomEntry ( Entry->CustomLogoTypeSettings = CUSTOM_BOOT_APPLE; } else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) { Entry->CustomLogoAsXString8 = Prop->getString()->stringValue(); - if (Prop->getString()->stringValue().equalIC("Apple")) { + if (Prop->getString()->stringValue().isEqualIC("Apple")) { Entry->CustomLogoTypeSettings = CUSTOM_BOOT_APPLE; - } else if (Prop->getString()->stringValue().equalIC("Alternate")) { + } else if (Prop->getString()->stringValue().isEqualIC("Alternate")) { Entry->CustomLogoTypeSettings = CUSTOM_BOOT_ALT_APPLE; - } else if (Prop->getString()->stringValue().equalIC("Theme")) { + } else if (Prop->getString()->stringValue().isEqualIC("Theme")) { Entry->CustomLogoTypeSettings = CUSTOM_BOOT_THEME; } else { XStringW customLogo = XStringW() = Prop->getString()->stringValue(); @@ -2009,7 +2009,7 @@ FillinCustomEntry ( Prop = DictPointer->propertyForKey("Hidden"); if (Prop != NULL) { if ((Prop->isString()) && - (Prop->getString()->stringValue().equalIC("Always"))) { + (Prop->getString()->stringValue().isEqualIC("Always"))) { // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED); Entry->AlwaysHidden = true; } else if (IsPropertyNotNullAndTrue(Prop)) { @@ -2020,19 +2020,19 @@ FillinCustomEntry ( Prop = DictPointer->propertyForKey("Type"); if (Prop != NULL && (Prop->isString())) { - if ((Prop->getString()->stringValue().equalIC("OSX")) || - (Prop->getString()->stringValue().equalIC("macOS"))) { + if ((Prop->getString()->stringValue().isEqualIC("OSX")) || + (Prop->getString()->stringValue().isEqualIC("macOS"))) { Entry->Type = OSTYPE_OSX; - } else if (Prop->getString()->stringValue().equalIC("OSXInstaller")) { + } else if (Prop->getString()->stringValue().isEqualIC("OSXInstaller")) { Entry->Type = OSTYPE_OSX_INSTALLER; - } else if (Prop->getString()->stringValue().equalIC("OSXRecovery")) { + } else if (Prop->getString()->stringValue().isEqualIC("OSXRecovery")) { Entry->Type = OSTYPE_RECOVERY; - } else if (Prop->getString()->stringValue().equalIC("Windows")) { + } else if (Prop->getString()->stringValue().isEqualIC("Windows")) { Entry->Type = OSTYPE_WINEFI; - } else if (Prop->getString()->stringValue().equalIC("Linux")) { + } else if (Prop->getString()->stringValue().isEqualIC("Linux")) { Entry->Type = OSTYPE_LIN; // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NODEFAULTARGS); - } else if (Prop->getString()->stringValue().equalIC("LinuxKernel")) { + } else if (Prop->getString()->stringValue().isEqualIC("LinuxKernel")) { Entry->Type = OSTYPE_LINEFI; } else { DBG("** Warning: unknown custom entry Type '%s'\n", Prop->getString()->stringValue().c_str()); @@ -2083,7 +2083,7 @@ FillinCustomEntry ( } else if ( Prop->isFalseOrNn() ) { Entry->InjectKexts = 0; // nothing to do - } else if ( Prop->isString() && Prop->getString()->stringValue().equalIC("Detect") ) { + } else if ( Prop->isString() && Prop->getString()->stringValue().isEqualIC("Detect") ) { Entry->InjectKexts = 2; // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_CHECKFAKESMC); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS); @@ -2268,7 +2268,7 @@ FillingCustomLegacy ( Prop = DictPointer->propertyForKey("Hidden"); if (Prop != NULL) { if ((Prop->isString()) && - (Prop->getString()->stringValue().equalIC("Always"))) { + (Prop->getString()->stringValue().isEqualIC("Always"))) { // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED); Entry->AlwaysHidden = true; } else if (IsPropertyNotNullAndTrue(Prop)) { @@ -2281,9 +2281,9 @@ FillingCustomLegacy ( Prop = DictPointer->propertyForKey("Type"); if (Prop != NULL && (Prop->isString())) { - if (Prop->getString()->stringValue().equalIC("Windows")) { + if (Prop->getString()->stringValue().isEqualIC("Windows")) { Entry->Type = OSTYPE_WIN; - } else if (Prop->getString()->stringValue().equalIC("Linux")) { + } else if (Prop->getString()->stringValue().isEqualIC("Linux")) { Entry->Type = OSTYPE_LIN; } else { Entry->Type = OSTYPE_OTHER; @@ -2370,7 +2370,7 @@ FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY_SETTINGS *Entry, const TagDict* Dict Prop = DictPointer->propertyForKey("Hidden"); if (Prop != NULL) { if ((Prop->isString()) && - (Prop->getString()->stringValue().equalIC("Always"))) { + (Prop->getString()->stringValue().isEqualIC("Always"))) { // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED); Entry->AlwaysHidden = true; } else if (IsPropertyNotNullAndTrue(Prop)) { @@ -2519,7 +2519,7 @@ EFI_STATUS GetEarlyUserSettings ( if ( Prop->isString() && Prop->getString()->stringValue().notEmpty() ) { gSettings.Boot.DefaultVolume.setEmpty(); // check for special value for remembering boot volume - if (Prop->getString()->stringValue().equalIC("LastBootedVolume")) { + if (Prop->getString()->stringValue().isEqualIC("LastBootedVolume")) { gSettings.Boot.LastBootedVolume = TRUE; } else { gSettings.Boot.DefaultVolume = Prop->getString()->stringValue(); @@ -2539,8 +2539,8 @@ EFI_STATUS GetEarlyUserSettings ( Prop = BootDict->propertyForKey("Debug"); if ( Prop ) { if ( Prop->isString() ) { - if ( Prop->getString()->stringValue().equalIC("true") ) gSettings.Boot.DebugLog = true; - else if ( Prop->getString()->stringValue().equalIC("false") ) gSettings.Boot.DebugLog = false; + if ( Prop->getString()->stringValue().isEqualIC("true") ) gSettings.Boot.DebugLog = true; + else if ( Prop->getString()->stringValue().isEqualIC("false") ) gSettings.Boot.DebugLog = false; else MsgLog("MALFORMED config.plist : property Boot/Debug must be true, false, or scratch\n"); }else if ( Prop->isBool() ) { gSettings.Boot.DebugLog = Prop->getBool()->boolValue(); @@ -2722,11 +2722,11 @@ EFI_STATUS GetEarlyUserSettings ( 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")) { + if (Prop->getString()->stringValue().isEqualIC("Apple")) { gSettings.Boot.CustomLogoType = CUSTOM_BOOT_APPLE; - } else if (Prop->getString()->stringValue().equalIC("Alternate")) { + } else if (Prop->getString()->stringValue().isEqualIC("Alternate")) { gSettings.Boot.CustomLogoType = CUSTOM_BOOT_ALT_APPLE; - } else if (Prop->getString()->stringValue().equalIC("Theme")) { + } else if (Prop->getString()->stringValue().isEqualIC("Theme")) { gSettings.Boot.CustomLogoType = CUSTOM_BOOT_THEME; } else { gSettings.Boot.CustomLogoType = CUSTOM_BOOT_USER; @@ -2771,7 +2771,7 @@ EFI_STATUS GetEarlyUserSettings ( if (IsPropertyNotNullAndTrue(Prop)) { gSettings.SystemParameters.WithKexts = TRUE; } else if ((Prop->isString()) && - (Prop->getString()->stringValue().equalIC("Detect"))) { + (Prop->getString()->stringValue().isEqualIC("Detect"))) { // settingsData.WithKexts = TRUE; gSettings.SystemParameters.WithKextsIfNoFakeSMC = TRUE; } @@ -2817,7 +2817,7 @@ EFI_STATUS GetEarlyUserSettings ( // OldChosenTheme = 0xFFFF; //default for embedded // for (UINTN i = 0; i < ThemeNameArray.size(); i++) { // //now comparison is case sensitive -// if ( gSettings.GUI.Theme.equalIC(ThemeNameArray[i]) ) { +// if ( gSettings.GUI.Theme.isEqualIC(ThemeNameArray[i]) ) { // OldChosenTheme = i; // break; // } @@ -2827,13 +2827,13 @@ EFI_STATUS GetEarlyUserSettings ( Prop = GUIDict->propertyForKey("EmbeddedThemeType"); if (Prop && (Prop->isString()) && Prop->getString()->stringValue().notEmpty()) { gSettings.GUI.EmbeddedThemeType = Prop->getString()->stringValue(); - if (Prop->getString()->stringValue().equalIC("Dark")) { + if (Prop->getString()->stringValue().isEqualIC("Dark")) { // gSettings.GUI.DarkEmbedded = TRUE; //ThemeX.Font = FONT_GRAY; - } else if (Prop->getString()->stringValue().equalIC("Light")) { + } else if (Prop->getString()->stringValue().isEqualIC("Light")) { // gSettings.GUI.DarkEmbedded = FALSE; //ThemeX.Font = FONT_ALFA; - } else if (Prop->getString()->stringValue().equalIC("Daytime")) { + } else if (Prop->getString()->stringValue().isEqualIC("Daytime")) { // gSettings.GUI.DarkEmbedded = !ThemeX.Daylight; //ThemeX.Font = ThemeX.Daylight?FONT_ALFA:FONT_GRAY; } @@ -3199,9 +3199,9 @@ EFI_STATUS GetEarlyUserSettings ( if (RtVariablesDict != NULL) { const TagStruct* Prop = RtVariablesDict->propertyForKey("ROM"); if (Prop != NULL) { - if ( Prop->isString() && Prop->getString()->stringValue().equalIC("UseMacAddr0") ) { + if ( Prop->isString() && Prop->getString()->stringValue().isEqualIC("UseMacAddr0") ) { gSettings.RtVariables.RtROMAsString = Prop->getString()->stringValue(); - } else if ( Prop->isString() && Prop->getString()->stringValue().equalIC("UseMacAddr1") ) { + } else if ( Prop->isString() && Prop->getString()->stringValue().isEqualIC("UseMacAddr1") ) { gSettings.RtVariables.RtROMAsString = Prop->getString()->stringValue(); } else if ( Prop->isString() || Prop->isData() ) { // GetDataSetting accept both UINTN ROMLength = 0; @@ -3223,58 +3223,58 @@ EFI_STATUS GetEarlyUserSettings ( const TagStruct* Prop; Prop = OcQuirksDict->propertyForKey("AvoidRuntimeDefrag"); //if ( !Prop ) panic("Cannot find AvoidRuntimeDefrag in OcQuirks under root (OC booter quirks)"); - gSettings.Quirks.ocBooterQuirks.AvoidRuntimeDefrag = !IsPropertyNotNullAndFalse(Prop); //true if absent so no panic - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.AvoidRuntimeDefrag? QUIRK_DEFRAG:0; + gSettings.Quirks.OcBooterQuirks.AvoidRuntimeDefrag = !IsPropertyNotNullAndFalse(Prop); //true if absent so no panic + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.AvoidRuntimeDefrag? QUIRK_DEFRAG:0; Prop = OcQuirksDict->propertyForKey( "DevirtualiseMmio"); - gSettings.Quirks.ocBooterQuirks.DevirtualiseMmio = IsPropertyNotNullAndTrue(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.DevirtualiseMmio? QUIRK_MMIO:0; + gSettings.Quirks.OcBooterQuirks.DevirtualiseMmio = IsPropertyNotNullAndTrue(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.DevirtualiseMmio? QUIRK_MMIO:0; Prop = OcQuirksDict->propertyForKey( "DisableSingleUser"); - gSettings.Quirks.ocBooterQuirks.DisableSingleUser = IsPropertyNotNullAndTrue(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.DisableSingleUser? QUIRK_SU:0; + gSettings.Quirks.OcBooterQuirks.DisableSingleUser = IsPropertyNotNullAndTrue(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.DisableSingleUser? QUIRK_SU:0; Prop = OcQuirksDict->propertyForKey( "DisableVariableWrite"); - gSettings.Quirks.ocBooterQuirks.DisableVariableWrite = IsPropertyNotNullAndTrue(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.DisableVariableWrite? QUIRK_VAR:0; + gSettings.Quirks.OcBooterQuirks.DisableVariableWrite = IsPropertyNotNullAndTrue(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.DisableVariableWrite? QUIRK_VAR:0; Prop = OcQuirksDict->propertyForKey( "DiscardHibernateMap"); - gSettings.Quirks.ocBooterQuirks.DiscardHibernateMap = IsPropertyNotNullAndTrue(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.DiscardHibernateMap? QUIRK_HIBER:0; + gSettings.Quirks.OcBooterQuirks.DiscardHibernateMap = IsPropertyNotNullAndTrue(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.DiscardHibernateMap? QUIRK_HIBER:0; Prop = OcQuirksDict->propertyForKey( "EnableSafeModeSlide"); - gSettings.Quirks.ocBooterQuirks.EnableSafeModeSlide = !IsPropertyNotNullAndFalse(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.EnableSafeModeSlide? QUIRK_SAFE:0; + gSettings.Quirks.OcBooterQuirks.EnableSafeModeSlide = !IsPropertyNotNullAndFalse(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.EnableSafeModeSlide? QUIRK_SAFE:0; Prop = OcQuirksDict->propertyForKey( "EnableWriteUnprotector"); - gSettings.Quirks.ocBooterQuirks.EnableWriteUnprotector = !IsPropertyNotNullAndFalse(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.EnableWriteUnprotector? QUIRK_UNPROT:0; + gSettings.Quirks.OcBooterQuirks.EnableWriteUnprotector = !IsPropertyNotNullAndFalse(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.EnableWriteUnprotector? QUIRK_UNPROT:0; Prop = OcQuirksDict->propertyForKey( "ForceExitBootServices"); - gSettings.Quirks.ocBooterQuirks.ForceExitBootServices = IsPropertyNotNullAndTrue(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ForceExitBootServices? QUIRK_EXIT:0; + gSettings.Quirks.OcBooterQuirks.ForceExitBootServices = IsPropertyNotNullAndTrue(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.ForceExitBootServices? QUIRK_EXIT:0; Prop = OcQuirksDict->propertyForKey( "ProtectMemoryRegions"); - gSettings.Quirks.ocBooterQuirks.ProtectMemoryRegions = IsPropertyNotNullAndTrue(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ProtectMemoryRegions? QUIRK_REGION:0; + gSettings.Quirks.OcBooterQuirks.ProtectMemoryRegions = IsPropertyNotNullAndTrue(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.ProtectMemoryRegions? QUIRK_REGION:0; Prop = OcQuirksDict->propertyForKey( "ProtectSecureBoot"); - gSettings.Quirks.ocBooterQuirks.ProtectSecureBoot = IsPropertyNotNullAndTrue(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ProtectSecureBoot? QUIRK_SECURE:0; + gSettings.Quirks.OcBooterQuirks.ProtectSecureBoot = IsPropertyNotNullAndTrue(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.ProtectSecureBoot? QUIRK_SECURE:0; Prop = OcQuirksDict->propertyForKey( "ProtectUefiServices"); - gSettings.Quirks.ocBooterQuirks.ProtectUefiServices = IsPropertyNotNullAndTrue(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ProtectUefiServices? QUIRK_UEFI:0; + gSettings.Quirks.OcBooterQuirks.ProtectUefiServices = IsPropertyNotNullAndTrue(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.ProtectUefiServices? QUIRK_UEFI:0; //it is in GUI section // Prop = OcQuirksDict->propertyForKey( "ProvideConsoleGopEnable"); // settingsData.ProvideConsoleGop = !IsPropertyNotNullAndFalse(Prop); Prop = OcQuirksDict->propertyForKey( "ProvideCustomSlide"); - gSettings.Quirks.ocBooterQuirks.ProvideCustomSlide = IsPropertyNotNullAndTrue(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ProvideCustomSlide? QUIRK_CUSTOM:0; + gSettings.Quirks.OcBooterQuirks.ProvideCustomSlide = IsPropertyNotNullAndTrue(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.ProvideCustomSlide? QUIRK_CUSTOM:0; Prop = OcQuirksDict->propertyForKey( "ProvideMaxSlide"); - gSettings.Quirks.ocBooterQuirks.ProvideMaxSlide = (UINT8)GetPropertyAsInteger(Prop, 0); // cast will be safe when the new parser will ensure that the value is UINT8 + gSettings.Quirks.OcBooterQuirks.ProvideMaxSlide = (UINT8)GetPropertyAsInteger(Prop, 0); // cast will be safe when the new parser will ensure that the value is UINT8 Prop = OcQuirksDict->propertyForKey( "RebuildAppleMemoryMap"); - gSettings.Quirks.ocBooterQuirks.RebuildAppleMemoryMap = IsPropertyNotNullAndTrue(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.RebuildAppleMemoryMap? QUIRK_MAP:0; + gSettings.Quirks.OcBooterQuirks.RebuildAppleMemoryMap = IsPropertyNotNullAndTrue(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.RebuildAppleMemoryMap? QUIRK_MAP:0; Prop = OcQuirksDict->propertyForKey( "SetupVirtualMap"); - gSettings.Quirks.ocBooterQuirks.SetupVirtualMap = !IsPropertyNotNullAndFalse(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.SetupVirtualMap? QUIRK_VIRT:0; + gSettings.Quirks.OcBooterQuirks.SetupVirtualMap = !IsPropertyNotNullAndFalse(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.SetupVirtualMap? QUIRK_VIRT:0; Prop = OcQuirksDict->propertyForKey( "SignalAppleOS"); - gSettings.Quirks.ocBooterQuirks.SignalAppleOS = IsPropertyNotNullAndTrue(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.SignalAppleOS? QUIRK_OS:0; + gSettings.Quirks.OcBooterQuirks.SignalAppleOS = IsPropertyNotNullAndTrue(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.SignalAppleOS? QUIRK_OS:0; Prop = OcQuirksDict->propertyForKey( "SyncRuntimePermissions"); - gSettings.Quirks.ocBooterQuirks.SyncRuntimePermissions = !IsPropertyNotNullAndFalse(Prop); - gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.SyncRuntimePermissions? QUIRK_PERM:0; + gSettings.Quirks.OcBooterQuirks.SyncRuntimePermissions = !IsPropertyNotNullAndFalse(Prop); + gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.SyncRuntimePermissions? QUIRK_PERM:0; gSettings.Quirks.mmioWhiteListArray.setEmpty(); const TagArray* Dict2 = OcQuirksDict->arrayPropertyForKey("MmioWhitelist"); // array of dict @@ -3356,7 +3356,7 @@ EFI_STATUS GetEarlyUserSettings ( // Prop = OcQuirksDict->propertyForKey("DisableRtcChecksum"); // settingsData.KernelAndKextPatches.OcKernelQuirks.DisableRtcChecksum = IsPropertyNotNullAndTrue(Prop); - gSettings.Quirks.OcKernelQuirks.DisableRtcChecksum = gSettings.KernelAndKextPatches.KPAppleRTC; +// gSettings.Quirks.OcKernelQuirks.DisableRtcChecksum = gSettings.KernelAndKextPatches.KPAppleRTC; Prop = OcQuirksDict->propertyForKey("DummyPowerManagement"); gSettings.Quirks.OcKernelQuirks.DummyPowerManagement = IsPropertyNotNullAndTrue(Prop); @@ -3369,11 +3369,11 @@ EFI_STATUS GetEarlyUserSettings ( // Prop = OcQuirksDict->propertyForKey("LapicKernelPanic"); // settingsData.KernelAndKextPatches.OcKernelQuirks.LapicKernelPanic = IsPropertyNotNullAndTrue(Prop); - gSettings.Quirks.OcKernelQuirks.LapicKernelPanic = gSettings.KernelAndKextPatches.KPKernelLapic; +// gSettings.Quirks.OcKernelQuirks.LapicKernelPanic = gSettings.KernelAndKextPatches.KPKernelLapic; // Prop = OcQuirksDict->propertyForKey("PanicNoKextDump"); // settingsData.KernelAndKextPatches.OcKernelQuirks.PanicNoKextDump = IsPropertyNotNullAndTrue(Prop); //KPPanicNoKextDump - gSettings.Quirks.OcKernelQuirks.PanicNoKextDump = gSettings.KernelAndKextPatches.KPPanicNoKextDump; +// gSettings.Quirks.OcKernelQuirks.PanicNoKextDump = gSettings.KernelAndKextPatches.KPPanicNoKextDump; Prop = OcQuirksDict->propertyForKey("PowerTimeoutKernelPanic"); gSettings.Quirks.OcKernelQuirks.PowerTimeoutKernelPanic = IsPropertyNotNullAndTrue(Prop); @@ -3421,11 +3421,13 @@ ParseSMBIOSSettings(SETTINGS_DATA& gSettings, const TagDict* DictPointer) if (Model != MaxMachineType) { DBG("SetDMISettingsForModel=%d\n", Model); SetDMISettingsForModel(gSettings, Model, FALSE); + GlobalConfig.CurrentModel = Model; Default = TRUE; } else { //if new model then fill at least as iMac13,2, except custom ProductName // something else? SetDMISettingsForModel(gSettings, iMac132, FALSE); + GlobalConfig.CurrentModel = MaxMachineType; } } } @@ -4435,9 +4437,9 @@ if (key->keyStringValue().startWithOrEqualTo("#")) { // when key in Devices/Properties is one of the strings "PrimaryGPU" / "SecondaryGPU", use device path of first / second gpu accordingly #ifdef CLOVER_BUILD - if ( DevicePathStr.equalIC("PrimaryGPU") ) { + if ( DevicePathStr.isEqualIC("PrimaryGPU") ) { DevicePath = DevicePathFromHandle(gGraphics[0].Handle); // first gpu - } else if ( DevicePathStr.equalIC("SecondaryGPU") && NGFX > 1) { + } else if ( DevicePathStr.isEqualIC("SecondaryGPU") && NGFX > 1) { DevicePath = DevicePathFromHandle(gGraphics[1].Handle); // second gpu } else { DevicePath = ConvertTextToDevicePath(DevicePathStr.wc_str()); //TODO @@ -4850,7 +4852,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings) if ( !EFI_ERROR(PropertiesDict->getKeyAndValueAtIndex(i, &key, &value)) ) { //take a with DevicePath. If GetKeyValueAtIndex return success, key and value != NULL if ( key->keyStringValue().startWithOrEqualTo('#') ) continue; // Commented out, ignored. This is a tempororay litle change of behavior because that's how the new parser will works. - if ( key->keyStringValue().equal("!") ) { + if ( key->keyStringValue().isEqual("!") ) { // '!' means disabled. If Label is only '!', means an empty disabled label... continue; } @@ -4860,9 +4862,9 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings) // when key in Devices/Properties is one of the strings "PrimaryGPU" / "SecondaryGPU", use device path of first / second gpu accordingly //#ifdef CLOVER_BUILD -// if ( DevicePathStr.equalIC("PrimaryGPU") ) { +// if ( DevicePathStr.isEqualIC("PrimaryGPU") ) { // DevicePath = DevicePathFromHandle(gGraphics[0].Handle); // first gpu -// } else if ( DevicePathStr.equalIC("SecondaryGPU") && NGFX > 1) { +// } else if ( DevicePathStr.isEqualIC("SecondaryGPU") && NGFX > 1) { // DevicePath = DevicePathFromHandle(gGraphics[1].Handle); // second gpu // } else { // DevicePath = ConvertTextToDevicePath(DevicePathStr.wc_str()); //TODO @@ -4902,7 +4904,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings) continue; } if ( key2->keyStringValue().startWithOrEqualTo('#') ) continue; - if ( key2->keyStringValue().equal("!") ) continue; + if ( key2->keyStringValue().isEqual("!") ) continue; SETTINGS_DATA::DevicesClass::SimplePropertyClass* ChildPtr = new SETTINGS_DATA::DevicesClass::SimplePropertyClass; SETTINGS_DATA::DevicesClass::SimplePropertyClass& Child = *ChildPtr; @@ -5093,31 +5095,31 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings) SETTINGS_DATA::DevicesClass::AddPropertyClass* Property = new SETTINGS_DATA::DevicesClass::AddPropertyClass(); if (DeviceProp && (DeviceProp->isString()) && DeviceProp->getString()->stringValue().notEmpty()) { - if (DeviceProp->getString()->stringValue().equalIC("ATI")) { + if (DeviceProp->getString()->stringValue().isEqualIC("ATI")) { Property->Device = (UINT32)DEV_ATI; - } else if (DeviceProp->getString()->stringValue().equalIC("NVidia")) { + } else if (DeviceProp->getString()->stringValue().isEqualIC("NVidia")) { Property->Device = (UINT32)DEV_NVIDIA; - } else if (DeviceProp->getString()->stringValue().equalIC("IntelGFX")) { + } else if (DeviceProp->getString()->stringValue().isEqualIC("IntelGFX")) { Property->Device = (UINT32)DEV_INTEL; - } else if (DeviceProp->getString()->stringValue().equalIC("LAN")) { + } else if (DeviceProp->getString()->stringValue().isEqualIC("LAN")) { Property->Device = (UINT32)DEV_LAN; - } else if (DeviceProp->getString()->stringValue().equalIC("WIFI")) { + } else if (DeviceProp->getString()->stringValue().isEqualIC("WIFI")) { Property->Device = (UINT32)DEV_WIFI; - } else if (DeviceProp->getString()->stringValue().equalIC("Firewire")) { + } else if (DeviceProp->getString()->stringValue().isEqualIC("Firewire")) { Property->Device = (UINT32)DEV_FIREWIRE; - } else if (DeviceProp->getString()->stringValue().equalIC("SATA")) { + } else if (DeviceProp->getString()->stringValue().isEqualIC("SATA")) { Property->Device = (UINT32)DEV_SATA; - } else if (DeviceProp->getString()->stringValue().equalIC("IDE")) { + } else if (DeviceProp->getString()->stringValue().isEqualIC("IDE")) { Property->Device = (UINT32)DEV_IDE; - } else if (DeviceProp->getString()->stringValue().equalIC("HDA")) { + } else if (DeviceProp->getString()->stringValue().isEqualIC("HDA")) { Property->Device = (UINT32)DEV_HDA; - } else if (DeviceProp->getString()->stringValue().equalIC("HDMI")) { + } else if (DeviceProp->getString()->stringValue().isEqualIC("HDMI")) { Property->Device = (UINT32)DEV_HDMI; - } else if (DeviceProp->getString()->stringValue().equalIC("LPC")) { + } else if (DeviceProp->getString()->stringValue().isEqualIC("LPC")) { Property->Device = (UINT32)DEV_LPC; - } else if (DeviceProp->getString()->stringValue().equalIC("SmBUS")) { + } else if (DeviceProp->getString()->stringValue().isEqualIC("SmBUS")) { Property->Device = (UINT32)DEV_SMBUS; - } else if (DeviceProp->getString()->stringValue().equalIC("USB")) { + } else if (DeviceProp->getString()->stringValue().isEqualIC("USB")) { Property->Device = (UINT32)DEV_USB; } else { DBG(" unknown device, ignored\n"/*, i*/); @@ -5359,7 +5361,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings) INTN Count = ModulesArray->arrayContent().size(); for (i = 0; i < Count; i++) { const TagDict* Prop3 = ModulesArray->dictElementAt(i, "SMBIOS/Memory/Modules"_XS8); - UINT8 Slot = MAX_RAM_SLOTS; + int Slot = MAX_RAM_SLOTS; RAM_SLOT_INFO *SlotPtr; // Get memory slot Prop2 = Prop3->propertyForKey("Slot"); @@ -5406,13 +5408,13 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings) SlotPtr->Type = MemoryTypeDdr3; Prop2 = Prop3->propertyForKey("Type"); if (Prop2 && Prop2->isString() && Prop2->getString()->stringValue().notEmpty()) { - if (Prop2->getString()->stringValue().equalIC("DDR2")) { + if (Prop2->getString()->stringValue().isEqualIC("DDR2")) { SlotPtr->Type = MemoryTypeDdr2; - } else if (Prop2->getString()->stringValue().equalIC("DDR3")) { + } else if (Prop2->getString()->stringValue().isEqualIC("DDR3")) { SlotPtr->Type = MemoryTypeDdr3; - } else if (Prop2->getString()->stringValue().equalIC("DDR4")) { + } else if (Prop2->getString()->stringValue().isEqualIC("DDR4")) { SlotPtr->Type = MemoryTypeDdr4; - } else if (Prop2->getString()->stringValue().equalIC("DDR")) { + } else if (Prop2->getString()->stringValue().isEqualIC("DDR")) { SlotPtr->Type = MemoryTypeDdr; } } @@ -5445,23 +5447,23 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings) const TagStruct* Prop2 = SlotsDict->propertyForKey("Device"); DeviceN = -1; if (Prop2 && (Prop2->isString()) && Prop2->getString()->stringValue().notEmpty()) { - if (Prop2->getString()->stringValue().equalIC("ATI")) { + if (Prop2->getString()->stringValue().isEqualIC("ATI")) { DeviceN = 0; - } else if (Prop2->getString()->stringValue().equalIC("NVidia")) { + } else if (Prop2->getString()->stringValue().isEqualIC("NVidia")) { DeviceN = 1; - } else if (Prop2->getString()->stringValue().equalIC("IntelGFX")) { + } else if (Prop2->getString()->stringValue().isEqualIC("IntelGFX")) { DeviceN = 2; - } else if (Prop2->getString()->stringValue().equalIC("LAN")) { + } else if (Prop2->getString()->stringValue().isEqualIC("LAN")) { DeviceN = 5; - } else if (Prop2->getString()->stringValue().equalIC("WIFI")) { + } else if (Prop2->getString()->stringValue().isEqualIC("WIFI")) { DeviceN = 6; - } else if (Prop2->getString()->stringValue().equalIC("Firewire")) { + } else if (Prop2->getString()->stringValue().isEqualIC("Firewire")) { DeviceN = 12; - } else if (Prop2->getString()->stringValue().equalIC("HDMI")) { + } else if (Prop2->getString()->stringValue().isEqualIC("HDMI")) { DeviceN = 4; - } else if (Prop2->getString()->stringValue().equalIC("USB")) { + } else if (Prop2->getString()->stringValue().isEqualIC("USB")) { DeviceN = 11; - } else if (Prop2->getString()->stringValue().equalIC("NVME")) { + } else if (Prop2->getString()->stringValue().isEqualIC("NVME")) { DeviceN = 13; } else { DBG(" - add properties to unknown device %s, ignored\n", Prop2->getString()->stringValue().c_str()); @@ -5630,9 +5632,9 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings) // ROM: bin data or base 64 encoded bin data const TagStruct* Prop = RtVariablesDict->propertyForKey("ROM"); if (Prop != NULL) { - if ( Prop->isString() && Prop->getString()->stringValue().equalIC("UseMacAddr0") ) { + if ( Prop->isString() && Prop->getString()->stringValue().isEqualIC("UseMacAddr0") ) { gSettings.RtVariables.RtROMAsString = Prop->getString()->stringValue(); - } else if ( Prop->isString() && Prop->getString()->stringValue().equalIC("UseMacAddr1") ) { + } else if ( Prop->isString() && Prop->getString()->stringValue().isEqualIC("UseMacAddr1") ) { gSettings.RtVariables.RtROMAsString = Prop->getString()->stringValue(); } else if ( Prop->isString() || Prop->isData() ) { // GetDataSetting accept both UINTN ROMLength = 0; @@ -5694,7 +5696,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings) } } Prop2 = BlockDict->propertyForKey("Disabled"); - if (IsPropertyNotNullAndFalse(Prop2)) { + if (IsPropertyNotNullAndTrue(Prop2)) { RtVariable.Disabled = true; // continue; } @@ -5780,12 +5782,12 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings) if ( Prop->isBool() ) gSettings.SystemParameters._InjectSystemID = Prop->getBool()->boolValue(); else if ( Prop->isString() ) { // TODO a function that takes a string and return if it's true or false - if ( Prop->getString()->stringValue().equalIC("true") ) gSettings.SystemParameters._InjectSystemID = 1; + if ( Prop->getString()->stringValue().isEqualIC("true") ) gSettings.SystemParameters._InjectSystemID = 1; else if ( Prop->getString()->stringValue()[0] == 'y' ) gSettings.SystemParameters._InjectSystemID = 1; else if ( Prop->getString()->stringValue()[0] == 'Y' ) gSettings.SystemParameters._InjectSystemID = 1; - else if ( Prop->getString()->stringValue().equalIC("false") ) gSettings.SystemParameters._InjectSystemID = 0; - else if ( Prop->getString()->stringValue().equalIC("n") ) gSettings.SystemParameters._InjectSystemID = 0; - else if ( Prop->getString()->stringValue().equalIC("N") ) gSettings.SystemParameters._InjectSystemID = 0; + else if ( Prop->getString()->stringValue().isEqualIC("false") ) gSettings.SystemParameters._InjectSystemID = 0; + else if ( Prop->getString()->stringValue().isEqualIC("n") ) gSettings.SystemParameters._InjectSystemID = 0; + else if ( Prop->getString()->stringValue().isEqualIC("N") ) gSettings.SystemParameters._InjectSystemID = 0; else { DBG("MALFORMED PLIST : SMBIOS/InjectSystemID must be true, yes, false, no, or non existant"); } @@ -5812,7 +5814,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings) gSettings.BootGraphics.EFILoginHiDPI = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); Prop = BootGraphicsDict->propertyForKey("flagstate"); - *(UINT32*)&gSettings.BootGraphics.flagstate[0] = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); + gSettings.BootGraphics._flagstate = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); } /* @@ -5925,7 +5927,7 @@ XString8 GetAuthRootDmg(const EFI_FILE& dir, const XStringW& path) if ( kernelFlags[idx] == '=' ) ++idx; else return NullXString8; while ( idx < kernelFlags.length() && IS_BLANK(kernelFlags[idx]) ) ++idx; - if ( kernelFlags.equalAtIC(idx, "file://"_XS8) ) idx += strlen("file://"); + if ( kernelFlags.isEqualAtIC(idx, "file://"_XS8) ) idx += strlen("file://"); size_t idxEnd = idx; while ( idxEnd < kernelFlags.length() && !IS_BLANK(kernelFlags[idxEnd]) ) ++idxEnd; returnValue = kernelFlags.subString(idx, idxEnd - idx); diff --git a/rEFIt_UEFI/Platform/Settings.h b/rEFIt_UEFI/Platform/Settings.h index a8e78ac7d..79007da83 100644 --- a/rEFIt_UEFI/Platform/Settings.h +++ b/rEFIt_UEFI/Platform/Settings.h @@ -14,6 +14,7 @@ #include "../cpp_lib/undefinable.h" #include "../entry_scan/loader.h" // for KERNEL_SCAN_xxx constants #include "../Platform/smbios.h" +#include "../Platform/platformdata.h" #define CLOVER_SIGN SIGNATURE_32('C','l','v','r') @@ -107,6 +108,15 @@ class ACPI_NAME public: XString8 Name = XString8(); + #if __cplusplus > 201703L + bool operator == (const ACPI_NAME&) const = default; + #endif + bool isEqual(const ACPI_NAME& other) const + { + if ( !(Name == other.Name) ) return false; + return true; + } + XString8Array getSplittedName() const { XString8Array splittedName = Split(Name, "."); for ( size_t idx = 0 ; idx < splittedName.size() ; ++idx) { @@ -127,6 +137,16 @@ public: ACPI_NAME acpiName = ACPI_NAME(); XString8 renameTo = XString8(); + #if __cplusplus > 201703L + bool operator == (const ACPI_RENAME_DEVICE&) const = default; + #endif + bool isEqual(const ACPI_RENAME_DEVICE& other) const + { + if ( !acpiName.isEqual(other.acpiName) ) return false; + if ( !(renameTo == other.renameTo) ) return false; + return true; + } + XString8 getRenameTo() const { if ( renameTo.length() == 4 ) return renameTo; XString8 newName = renameTo; @@ -176,6 +196,20 @@ public: // temporary, must be protected: undefinable_XString8 _Title = undefinable_XString8(); undefinable_bool _NoCaches = undefinable_bool(); + + #if __cplusplus > 201703L + bool operator == (const CUSTOM_LOADER_SUBENTRY_SETTINGS&) const = default; + #endif + bool isEqual(const CUSTOM_LOADER_SUBENTRY_SETTINGS& other) const + { + if ( !(Disabled == other.Disabled) ) return false; + if ( !(_Arguments == other._Arguments) ) return false; + if ( !(_AddArguments == other._AddArguments) ) return false; + if ( !(_FullTitle == other._FullTitle) ) return false; + if ( !(_Title == other._Title) ) return false; + if ( !(_NoCaches == other._NoCaches) ) return false; + return true; + } public: @@ -212,6 +246,20 @@ extern const XString8 defaultRecoveryTitle; extern const XStringW defaultRecoveryImagePath; extern const XStringW defaultRecoveryDriveImagePath; +class EFI_GRAPHICS_OUTPUT_BLT_PIXELClass : public EFI_GRAPHICS_OUTPUT_BLT_PIXEL +{ +public: + EFI_GRAPHICS_OUTPUT_BLT_PIXELClass() { Blue = 0; Green = 0; Red = 0; Reserved = 0; } + + bool operator == (const EFI_GRAPHICS_OUTPUT_BLT_PIXELClass& other) const { + if ( !(Blue == other.Blue) ) return false; + if ( !(Green == other.Green) ) return false; + if ( !(Red == other.Red) ) return false; + if ( !(Reserved == other.Reserved) ) return false; + return true; + } +}; + class CUSTOM_LOADER_ENTRY_SETTINGS { public: @@ -234,7 +282,7 @@ public: UINT8 KernelScan = KERNEL_SCAN_ALL; XString8 CustomLogoAsXString8 = XString8(); XBuffer CustomLogoAsData = XBuffer(); - EFI_GRAPHICS_OUTPUT_BLT_PIXEL BootBgColor = EFI_GRAPHICS_OUTPUT_BLT_PIXEL({0,0,0,0}); + EFI_GRAPHICS_OUTPUT_BLT_PIXELClass BootBgColor = EFI_GRAPHICS_OUTPUT_BLT_PIXELClass(); INT8 InjectKexts = -1; undefinable_bool NoCaches = undefinable_bool(); XObjArray SubEntriesSettings = XObjArray(); @@ -245,6 +293,41 @@ public: // temporary, must be protected: XStringW m_ImagePath = XStringW(); public: + + #if __cplusplus > 201703L + bool operator == (const CUSTOM_LOADER_ENTRY_SETTINGS&) const = default; + #endif + bool isEqual(const CUSTOM_LOADER_ENTRY_SETTINGS& other) const + { + if ( !(Disabled == other.Disabled) ) return false; + if ( !(ImageData == other.ImageData) ) return false; + if ( !(DriveImageData == other.DriveImageData) ) return false; + if ( !(Volume == other.Volume) ) return false; + if ( !(Path == other.Path) ) return false; + if ( !(Arguments == other.Arguments) ) return false; + if ( !(AddArguments == other.AddArguments) ) return false; + if ( !(FullTitle == other.FullTitle) ) return false; + if ( !(Settings == other.Settings) ) return false; + if ( !(Hotkey == other.Hotkey) ) return false; + if ( !(CommonSettings == other.CommonSettings) ) return false; + if ( !(Hidden == other.Hidden) ) return false; + if ( !(AlwaysHidden == other.AlwaysHidden) ) return false; + if ( !(Type == other.Type) ) return false; + if ( !(VolumeType == other.VolumeType) ) return false; + if ( !(KernelScan == other.KernelScan) ) return false; + if ( !(CustomLogoAsXString8 == other.CustomLogoAsXString8) ) return false; + if ( !(CustomLogoAsData == other.CustomLogoAsData) ) return false; + if ( memcmp(&BootBgColor, &other.BootBgColor, sizeof(BootBgColor)) != 0 ) return false; + if ( !(InjectKexts == other.InjectKexts) ) return false; + if ( !(NoCaches == other.NoCaches) ) return false; + if ( !SubEntriesSettings.isEqual(other.SubEntriesSettings) ) return false; + if ( !(m_DriveImagePath == other.m_DriveImagePath) ) return false; + if ( !(m_Title == other.m_Title) ) return false; + if ( !(CustomLogoTypeSettings == other.CustomLogoTypeSettings) ) return false; + if ( !(m_ImagePath == other.m_ImagePath) ) return false; + return true; + } + 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); @@ -327,6 +410,27 @@ public: bool AlwaysHidden = 0; UINT8 Type = 0; UINT8 VolumeType = 0; + + #if __cplusplus > 201703L + bool operator == (const CUSTOM_LEGACY_ENTRY_SETTINGS&) const = default; + #endif + bool isEqual(const CUSTOM_LEGACY_ENTRY_SETTINGS& other) const + { + if ( !(Disabled == other.Disabled) ) return false; + if ( !(ImagePath == other.ImagePath) ) return false; + if ( !(ImageData == other.ImageData) ) return false; + if ( !(DriveImagePath == other.DriveImagePath) ) return false; + if ( !(DriveImageData == other.DriveImageData) ) return false; + if ( !(Volume == other.Volume) ) return false; + if ( !(FullTitle == other.FullTitle) ) return false; + if ( !(Title == other.Title) ) return false; + if ( !(Hotkey == other.Hotkey) ) return false; + if ( !(Hidden == other.Hidden) ) return false; + if ( !(AlwaysHidden == other.AlwaysHidden) ) return false; + if ( !(Type == other.Type) ) return false; + if ( !(VolumeType == other.VolumeType) ) return false; + return true; + } }; class CUSTOM_LEGACY_ENTRY @@ -378,6 +482,26 @@ public: bool Hidden = 0; bool AlwaysHidden = 0; UINT8 VolumeType = 0; + + #if __cplusplus > 201703L + bool operator == (const CUSTOM_TOOL_ENTRY_SETTINGS&) const = default; + #endif + bool isEqual(const CUSTOM_TOOL_ENTRY_SETTINGS& other) const + { + if ( !(Disabled == other.Disabled) ) return false; + if ( !(ImagePath == other.ImagePath) ) return false; + if ( !(ImageData == other.ImageData) ) return false; + if ( !(Volume == other.Volume) ) return false; + if ( !(Path == other.Path) ) return false; + if ( !(Arguments == other.Arguments) ) return false; + if ( !(FullTitle == other.FullTitle) ) return false; + if ( !(Title == other.Title) ) return false; + if ( !(Hotkey == other.Hotkey) ) return false; + if ( !(Hidden == other.Hidden) ) return false; + if ( !(AlwaysHidden == other.AlwaysHidden) ) return false; + if ( !(VolumeType == other.VolumeType) ) return false; + return true; + } }; @@ -444,14 +568,29 @@ class VBIOS_PATCH { public: XBuffer Find = XBuffer(); XBuffer Replace = XBuffer(); + + #if __cplusplus > 201703L + bool operator == (const VBIOS_PATCH&) const = default; + #endif + bool isEqual(const VBIOS_PATCH& other) const + { + if ( !(Find == other.Find) ) return false; + if ( !(Replace == other.Replace) ) return false; + return true; + } }; class PatchVBiosBytesNewClass : public XObjArray { mutable XArray VBIOS_PATCH_BYTES_array = XArray(); public: + + #if __cplusplus > 201703L + bool operator == (const PatchVBiosBytesNewClass& other) const { return XObjArray::operator ==(other); } + #endif + // Temporary bridge to old struct. - const VBIOS_PATCH_BYTES* getVBIOS_PATCH_BYTES() { + const VBIOS_PATCH_BYTES* getVBIOS_PATCH_BYTES() const { VBIOS_PATCH_BYTES_array.setSize(size()); for ( size_t idx = 0 ; idx < size() ; ++idx ) { VBIOS_PATCH_BYTES_array[idx].Find = ElementAt(idx).Find.data(); @@ -463,6 +602,20 @@ public: size_t getVBIOS_PATCH_BYTES_count() const { return size(); } + + bool isEqual(const PatchVBiosBytesNewClass& other) const + { + return XObjArray::isEqual(other); +// getVBIOS_PATCH_BYTES(); +// if ( VBIOS_PATCH_BYTES_array.size() != other.VBIOS_PATCH_BYTES_array.size() ) return false; +// for ( size_t idx = 0 ; idx < VBIOS_PATCH_BYTES_array.size() ; ++idx ) { +// if ( VBIOS_PATCH_BYTES_array[idx].NumberOfBytes != other[idx].Find.size() ) return false; +// if ( memcmp(VBIOS_PATCH_BYTES_array[idx].Find, other.VBIOS_PATCH_BYTES_array[idx].Find, VBIOS_PATCH_BYTES_array[idx].NumberOfBytes) != 0 ) return false; +// if ( memcmp(VBIOS_PATCH_BYTES_array[idx].Replace, other.VBIOS_PATCH_BYTES_array[idx].Replace, VBIOS_PATCH_BYTES_array[idx].NumberOfBytes) != 0 ) return false; +// } +// return true; + } + }; @@ -477,6 +630,22 @@ public: UINT8 SlotID = UINT8(); MISC_SLOT_TYPE SlotType = MISC_SLOT_TYPE(); XString8 SlotName = XString8(); + + #if __cplusplus > 201703L + bool operator == (const SLOT_DEVICE&) const = default; + #endif + bool isEqual(const SLOT_DEVICE& other) const + { + if ( !(SegmentGroupNum == other.SegmentGroupNum) ) return false; + if ( !(BusNum == other.BusNum) ) return false; + if ( !(DevFuncNum == other.DevFuncNum) ) return false; + if ( !(Valid == other.Valid) ) return false; + //if ( !(DeviceN == other.DeviceN) ) return false; + if ( !(SlotID == other.SlotID) ) return false; + if ( !(SlotType == other.SlotType) ) return false; + if ( !(SlotName == other.SlotName) ) return false; + return true; + } } ; @@ -521,6 +690,40 @@ public: UINT8 CustomLogoType = 0; XString8 CustomLogoAsXString8 = XString8(); XBuffer CustomLogoAsData = XBuffer(); + + #if __cplusplus > 201703L + bool operator == (const BootClass&) const = default; + #endif + bool isEqual(const BootClass& other) const + { + if ( !(Timeout == other.Timeout) ) return false; + if ( !(SkipHibernateTimeout == other.SkipHibernateTimeout) ) return false; + if ( !(DisableCloverHotkeys == other.DisableCloverHotkeys) ) return false; + if ( !(BootArgs == other.BootArgs) ) return false; + if ( !(NeverDoRecovery == other.NeverDoRecovery) ) return false; + if ( !(LastBootedVolume == other.LastBootedVolume) ) return false; + if ( !(DefaultVolume == other.DefaultVolume) ) return false; + if ( !(DefaultLoader == other.DefaultLoader) ) return false; + if ( !(DebugLog == other.DebugLog) ) return false; + if ( !(FastBoot == other.FastBoot) ) return false; + if ( !(NoEarlyProgress == other.NoEarlyProgress) ) return false; + if ( !(NeverHibernate == other.NeverHibernate) ) return false; + if ( !(StrictHibernate == other.StrictHibernate) ) return false; + if ( !(RtcHibernateAware == other.RtcHibernateAware) ) return false; + if ( !(HibernationFixup == other.HibernationFixup) ) return false; + if ( !(SignatureFixup == other.SignatureFixup) ) return false; + if ( !(SecureSetting == other.SecureSetting) ) return false; + if ( !(SecureBootPolicy == other.SecureBootPolicy) ) return false; + if ( !(SecureBootWhiteList == other.SecureBootWhiteList) ) return false; + if ( !(SecureBootBlackList == other.SecureBootBlackList) ) return false; + if ( !(XMPDetection == other.XMPDetection) ) return false; + if ( !(LegacyBoot == other.LegacyBoot) ) return false; + if ( !(LegacyBiosDefaultEntry == other.LegacyBiosDefaultEntry) ) return false; + if ( !(CustomLogoType == other.CustomLogoType) ) return false; + if ( !(CustomLogoAsXString8 == other.CustomLogoAsXString8) ) return false; + if ( !(CustomLogoAsData == other.CustomLogoAsData) ) return false; + return true; + } }; class ACPIClass @@ -533,6 +736,18 @@ public: UINT64 TableId = 0; UINT32 TabLength = 0; bool OtherOS = 0; + + #if __cplusplus > 201703L + bool operator == (const ACPIDropTablesClass&) const = default; + #endif + bool isEqual(const ACPIDropTablesClass& other) const + { + if ( !(Signature == other.Signature) ) return false; + if ( !(TableId == other.TableId) ) return false; + if ( !(TabLength == other.TabLength) ) return false; + if ( !(OtherOS == other.OtherOS) ) return false; + return true; + } }; class DSDTClass @@ -547,6 +762,20 @@ public: XBuffer PatchDsdtReplace = XBuffer(); XBuffer PatchDsdtTgt = XBuffer(); INPUT_ITEM PatchDsdtMenuItem = INPUT_ITEM(); // Not read from config.plist. Should be moved out. + + #if __cplusplus > 201703L + bool operator == (const DSDT_Patch&) const = default; + #endif + bool isEqual(const DSDT_Patch& other) const + { + if ( !(Disabled == other.Disabled) ) return false; + if ( !(PatchDsdtLabel == other.PatchDsdtLabel) ) return false; + if ( !(PatchDsdtFind == other.PatchDsdtFind) ) return false; + if ( !(PatchDsdtReplace == other.PatchDsdtReplace) ) return false; + if ( !(PatchDsdtTgt == other.PatchDsdtTgt) ) return false; + if ( !(PatchDsdtMenuItem == other.PatchDsdtMenuItem) ) return false; + return true; + } }; XStringW DsdtName = XStringW(); @@ -557,6 +786,22 @@ public: bool ReuseFFFF = 0; bool SuspendOverride = 0; XObjArray DSDTPatchArray = XObjArray(); + + #if __cplusplus > 201703L + bool operator == (const DSDTClass&) const = default; + #endif + bool isEqual(const DSDTClass& other) const + { + if ( !(DsdtName == other.DsdtName) ) return false; + if ( !(DebugDSDT == other.DebugDSDT) ) return false; + if ( !(Rtc8Allowed == other.Rtc8Allowed) ) return false; + if ( !(PNLF_UID == other.PNLF_UID) ) return false; + if ( !(FixDsdt == other.FixDsdt) ) return false; + if ( !(ReuseFFFF == other.ReuseFFFF) ) return false; + if ( !(SuspendOverride == other.SuspendOverride) ) return false; + if ( !DSDTPatchArray.isEqual(other.DSDTPatchArray) ) return false; + return true; + } }; class SSDTClass @@ -570,6 +815,19 @@ public: bool GenerateAPSN = 0; bool GenerateAPLF = 0; bool GeneratePluginType = 0; + + #if __cplusplus > 201703L + bool operator == (const GenerateClass&) const = default; + #endif + bool isEqual(const GenerateClass& other) const + { + if ( !(GeneratePStates == other.GeneratePStates) ) return false; + if ( !(GenerateCStates == other.GenerateCStates) ) return false; + if ( !(GenerateAPSN == other.GenerateAPSN) ) return false; + if ( !(GenerateAPLF == other.GenerateAPLF) ) return false; + if ( !(GeneratePluginType == other.GeneratePluginType) ) return false; + return true; + } }; bool DropSSDTSetting = 0; @@ -588,6 +846,30 @@ public: UINT8 MaxMultiplier = 0; UINT8 PluginType = 0; GenerateClass Generate = GenerateClass(); + + #if __cplusplus > 201703L + bool operator == (const SSDTClass&) const = default; + #endif + bool isEqual(const SSDTClass& other) const + { + if ( !(DropSSDTSetting == other.DropSSDTSetting) ) return false; + if ( !(NoOemTableId == other.NoOemTableId) ) return false; + if ( !(NoDynamicExtract == other.NoDynamicExtract) ) return false; + if ( !(EnableISS == other.EnableISS) ) return false; + if ( !(EnableC7 == other.EnableC7) ) return false; + if ( !(_EnableC6 == other._EnableC6) ) return false; + if ( !(_EnableC4 == other._EnableC4) ) return false; + if ( !(_EnableC2 == other._EnableC2) ) return false; + if ( !(_C3Latency == other._C3Latency) ) return false; + if ( !(PLimitDict == other.PLimitDict) ) return false; + if ( !(UnderVoltStep == other.UnderVoltStep) ) return false; + if ( !(DoubleFirstState == other.DoubleFirstState) ) return false; + if ( !(MinMultiplier == other.MinMultiplier) ) return false; + if ( !(MaxMultiplier == other.MaxMultiplier) ) return false; + if ( !(PluginType == other.PluginType) ) return false; + if ( !Generate.isEqual(other.Generate) ) return false; + return true; + } }; UINT64 ResetAddr = 0; @@ -605,16 +887,51 @@ public: XObjArray ACPIDropTablesArray = XObjArray(); DSDTClass DSDT = DSDTClass(); SSDTClass SSDT = SSDTClass(); + + #if __cplusplus > 201703L + bool operator == (const ACPIClass&) const = default; + #endif + bool isEqual(const ACPIClass& other) const + { + if ( !(ResetAddr == other.ResetAddr) ) return false; + if ( !(ResetVal == other.ResetVal) ) return false; + if ( !(SlpSmiEnable == other.SlpSmiEnable) ) return false; + if ( !(FixHeaders == other.FixHeaders) ) return false; + if ( !(FixMCFG == other.FixMCFG) ) return false; + if ( !(NoASPM == other.NoASPM) ) return false; + if ( !(smartUPS == other.smartUPS) ) return false; + if ( !(PatchNMI == other.PatchNMI) ) return false; + if ( !(AutoMerge == other.AutoMerge) ) return false; + if ( !(DisabledAML == other.DisabledAML) ) return false; + if ( !(SortedACPI == other.SortedACPI) ) return false; + if ( !DeviceRename.isEqual(other.DeviceRename) ) return false; + if ( !ACPIDropTablesArray.isEqual(other.ACPIDropTablesArray) ) return false; + if ( !DSDT.isEqual(other.DSDT) ) return false; + if ( !SSDT.isEqual(other.SSDT) ) return false; + return true; + } }; class GUIClass { public: class MouseClass { public: - INTN PointerSpeed = 0; + INTN PointerSpeed = 0; bool PointerEnabled = 0; - UINT64 DoubleClickTime = 0; + UINT64 DoubleClickTime = 0; bool PointerMirror = 0; + + #if __cplusplus > 201703L + bool operator == (const MouseClass&) const = default; + #endif + bool isEqual(const MouseClass& other) const + { + if ( !(PointerSpeed == other.PointerSpeed) ) return false; + if ( !(PointerEnabled == other.PointerEnabled) ) return false; + if ( !(DoubleClickTime == other.DoubleClickTime) ) return false; + if ( !(PointerMirror == other.PointerMirror) ) return false; + return true; + } } ; class ScanClass { public: @@ -624,6 +941,20 @@ public: bool LinuxScan = 0; bool LegacyFirst = false; bool NoLegacy = false; + + #if __cplusplus > 201703L + bool operator == (const ScanClass&) const = default; + #endif + bool isEqual(const ScanClass& other) const + { + if ( !(DisableEntryScan == other.DisableEntryScan) ) return false; + if ( !(DisableToolScan == other.DisableToolScan) ) return false; + if ( !(KernelScan == other.KernelScan) ) return false; + if ( !(LinuxScan == other.LinuxScan) ) return false; + if ( !(LegacyFirst == other.LegacyFirst) ) return false; + if ( !(NoLegacy == other.NoLegacy) ) return false; + return true; + } }; INT32 Timezone = -1; @@ -641,13 +972,40 @@ public: LanguageCode languageCode = english; bool KbdPrevLang = 0; XString8Array HVHideStrings = XString8Array(); - ScanClass Scan = ScanClass(); - MouseClass Mouse = MouseClass(); + ScanClass Scan = ScanClass(); + MouseClass Mouse = MouseClass(); XObjArray CustomEntriesSettings = XObjArray(); XObjArray CustomLegacySettings = XObjArray(); XObjArray CustomToolSettings = XObjArray(); bool getDarkEmbedded(bool isDaylight) const; + + #if __cplusplus > 201703L + bool operator == (const GUIClass&) const = default; + #endif + bool isEqual(const GUIClass& other) const + { + if ( !(Timezone == other.Timezone) ) return false; + if ( !(Theme == other.Theme) ) return false; + if ( !(EmbeddedThemeType == other.EmbeddedThemeType) ) return false; + if ( !(PlayAsync == other.PlayAsync) ) return false; + if ( !(CustomIcons == other.CustomIcons) ) return false; + if ( !(TextOnly == other.TextOnly) ) return false; + if ( !(ShowOptimus == other.ShowOptimus) ) return false; + if ( !(ScreenResolution == other.ScreenResolution) ) return false; + if ( !(ProvideConsoleGop == other.ProvideConsoleGop) ) return false; + if ( !(ConsoleMode == other.ConsoleMode) ) return false; + if ( !(Language == other.Language) ) return false; + if ( !(languageCode == other.languageCode) ) return false; + if ( !(KbdPrevLang == other.KbdPrevLang) ) return false; + if ( !(HVHideStrings == other.HVHideStrings) ) return false; + if ( !Scan.isEqual(other.Scan) ) return false; + if ( !Mouse.isEqual(other.Mouse) ) return false; + if ( !CustomEntriesSettings.isEqual(other.CustomEntriesSettings) ) return false; + if ( !CustomLegacySettings.isEqual(other.CustomLegacySettings) ) return false; + if ( !CustomToolSettings.isEqual(other.CustomToolSettings) ) return false; + return true; + } }; @@ -669,6 +1027,30 @@ public: undefinable_bool _EnableC4 = undefinable_bool(); undefinable_bool _EnableC2 = undefinable_bool(); undefinable_uint16 _C3Latency = undefinable_uint16(); + + #if __cplusplus > 201703L + bool operator == (const CPUClass&) const = default; + #endif + bool isEqual(const CPUClass& other) const + { + if ( !(QPI == other.QPI) ) return false; + if ( !(CpuFreqMHz == other.CpuFreqMHz) ) return false; + if ( !(CpuType == other.CpuType) ) return false; + if ( !(QEMU == other.QEMU) ) return false; + if ( !(UseARTFreq == other.UseARTFreq) ) return false; + if ( !(BusSpeed == other.BusSpeed) ) return false; + if ( !(UserChange == other.UserChange) ) return false; + if ( !(SavingMode == other.SavingMode) ) return false; + if ( !(HWPEnable == other.HWPEnable) ) return false; + if ( !(HWPValue == other.HWPValue) ) return false; + if ( !(TDP == other.TDP) ) return false; + if ( !(TurboDisabled == other.TurboDisabled) ) return false; + if ( !(_EnableC6 == other._EnableC6) ) return false; + if ( !(_EnableC4 == other._EnableC4) ) return false; + if ( !(_EnableC2 == other._EnableC2) ) return false; + if ( !(_C3Latency == other._C3Latency) ) return false; + return true; + } }; class SystemParametersClass { @@ -686,6 +1068,22 @@ public: friend class ::SETTINGS_DATA; friend unsigned long long ::GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings); + + #if __cplusplus > 201703L + bool operator == (const SystemParametersClass&) const = default; + #endif + bool isEqual(const SystemParametersClass& other) const + { + if ( !(WithKexts == other.WithKexts) ) return false; + if ( !(WithKextsIfNoFakeSMC == other.WithKextsIfNoFakeSMC) ) return false; + if ( !(NoCaches == other.NoCaches) ) return false; + if ( !(BacklightLevel == other.BacklightLevel) ) return false; + if ( !(BacklightLevelConfig == other.BacklightLevelConfig) ) return false; + if ( !(CustomUuid == other.CustomUuid) ) return false; + if ( !(_InjectSystemID == other._InjectSystemID) ) return false; + if ( !(NvidiaWeb == other.NvidiaWeb) ) return false; + return true; + } }; class GraphicsClass { @@ -698,6 +1096,20 @@ public: UINT16 ProductEDID = UINT16(); UINT16 EdidFixHorizontalSyncPulseWidth = UINT16(); UINT8 EdidFixVideoInputSignal = UINT8(); + + #if __cplusplus > 201703L + bool operator == (const EDIDClass&) const = default; + #endif + bool isEqual(const EDIDClass& other) const + { + if ( !(InjectEDID == other.InjectEDID) ) return false; + if ( !(CustomEDID == other.CustomEDID) ) return false; + if ( !(VendorEDID == other.VendorEDID) ) return false; + if ( !(ProductEDID == other.ProductEDID) ) return false; + if ( !(EdidFixHorizontalSyncPulseWidth == other.EdidFixHorizontalSyncPulseWidth) ) return false; + if ( !(EdidFixVideoInputSignal == other.EdidFixVideoInputSignal) ) return false; + return true; + } }; class InjectAsDictClass { @@ -706,6 +1118,18 @@ public: bool InjectIntel = bool(); bool InjectATI = bool(); bool InjectNVidia = bool(); + + #if __cplusplus > 201703L + bool operator == (const InjectAsDictClass&) const = default; + #endif + bool isEqual(const InjectAsDictClass& other) const + { + if ( !(GraphicsInjector == other.GraphicsInjector) ) return false; + if ( !(InjectIntel == other.InjectIntel) ) return false; + if ( !(InjectATI == other.InjectATI) ) return false; + if ( !(InjectNVidia == other.InjectNVidia) ) return false; + return true; + } }; class GRAPHIC_CARD { @@ -717,6 +1141,21 @@ public: UINT64 VideoRam = 0; UINTN VideoPorts = 0; bool LoadVBios = 0; + + #if __cplusplus > 201703L + bool operator == (const GRAPHIC_CARD&) const = default; + #endif + bool isEqual(const GRAPHIC_CARD& other) const + { + if ( !(Signature == other.Signature) ) return false; + if ( !(Model == other.Model) ) return false; + if ( !(Id == other.Id) ) return false; + if ( !(SubId == other.SubId) ) return false; + if ( !(VideoRam == other.VideoRam) ) return false; + if ( !(VideoPorts == other.VideoPorts) ) return false; + if ( !(LoadVBios == other.LoadVBios) ) return false; + return true; + } }; bool PatchVBios = bool(); @@ -731,8 +1170,8 @@ public: bool NvidiaGeneric = bool(); bool NvidiaNoEFI = bool(); bool NvidiaSingle = bool(); - UINT8 Dcfg[8] = {0}; - UINT8 NVCAP[20] = {0}; + XArray Dcfg = XArray(); + XArray NVCAP = XArray(); INT8 BootDisplay = INT8(); UINT32 DualLink = UINT32(); UINT32 IgPlatform = UINT32(); //could also be snb-platform-id @@ -741,7 +1180,41 @@ public: XObjArray ATICardList = XObjArray(); XObjArray NVIDIACardList = XObjArray(); + GraphicsClass() { + Dcfg.setSize(8); + memset(Dcfg.data(), 0, 8); + NVCAP.setSize(20); + memset(NVCAP.data(), 0, 20); + } + #if __cplusplus > 201703L + bool operator == (const GraphicsClass&) const = default; + #endif + bool isEqual(const GraphicsClass& other) const + { + if ( !(PatchVBios == other.PatchVBios) ) return false; + if ( !PatchVBiosBytes.isEqual(other.PatchVBiosBytes) ) return false; + if ( !(RadeonDeInit == other.RadeonDeInit) ) return false; + if ( !(LoadVBios == other.LoadVBios) ) return false; + if ( !(VRAM == other.VRAM) ) return false; + if ( !(RefCLK == other.RefCLK) ) return false; + if ( !(FBName == other.FBName) ) return false; + if ( !(VideoPorts == other.VideoPorts) ) return false; + if ( !(NvidiaGeneric == other.NvidiaGeneric) ) return false; + if ( !(NvidiaNoEFI == other.NvidiaNoEFI) ) return false; + if ( !(NvidiaSingle == other.NvidiaSingle) ) return false; + if ( !(Dcfg == other.Dcfg) ) return false; + if ( !(NVCAP == other.NVCAP) ) return false; + if ( !(BootDisplay == other.BootDisplay) ) return false; + if ( !(DualLink == other.DualLink) ) return false; + if ( !(IgPlatform == other.IgPlatform) ) return false; + if ( !EDID.isEqual(other.EDID) ) return false; + if ( !InjectAsDict.isEqual(other.InjectAsDict) ) return false; + if ( !ATICardList.isEqual(other.ATICardList) ) return false; + if ( !NVIDIACardList.isEqual(other.NVIDIACardList) ) return false; + return true; + } + //bool getGraphicsInjector() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.GraphicsInjector; } //bool InjectIntel() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectIntel; } //bool InjectATI() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectATI; } @@ -755,9 +1228,21 @@ public: class AudioClass { public: bool ResetHDA = bool(); - bool HDAInjection = bool(); + bool HDAInjection = bool(); INT32 HDALayoutId = INT32(); - UINT8 AFGLowPowerState = UINT8(); + bool AFGLowPowerState = bool(); + + #if __cplusplus > 201703L + bool operator == (const AudioClass&) const = default; + #endif + bool isEqual(const AudioClass& other) const + { + if ( !(ResetHDA == other.ResetHDA) ) return false; + if ( !(HDAInjection == other.HDAInjection) ) return false; + if ( !(HDALayoutId == other.HDALayoutId) ) return false; + if ( !(AFGLowPowerState == other.AFGLowPowerState) ) return false; + return true; + } }; class USBClass { public: @@ -767,6 +1252,20 @@ public: bool HighCurrent = bool(); bool NameEH00 = bool(); bool NameXH00 = bool(); + + #if __cplusplus > 201703L + bool operator == (const USBClass&) const = default; + #endif + bool isEqual(const USBClass& other) const + { + if ( !(USBInjection == other.USBInjection) ) return false; + if ( !(USBFixOwnership == other.USBFixOwnership) ) return false; + if ( !(InjectClockID == other.InjectClockID) ) return false; + if ( !(HighCurrent == other.HighCurrent) ) return false; + if ( !(NameEH00 == other.NameEH00) ) return false; + if ( !(NameXH00 == other.NameXH00) ) return false; + return true; + } }; class AddPropertyClass @@ -779,6 +1278,21 @@ public: INPUT_ITEM MenuItem = INPUT_ITEM(); XString8 DevicePathAsString = XString8(); XString8 Label = XString8(); + + #if __cplusplus > 201703L + bool operator == (const AddPropertyClass&) const = default; + #endif + bool isEqual(const AddPropertyClass& other) const + { + if ( !(Device == other.Device) ) return false; + if ( !(Key == other.Key) ) return false; + if ( !(Value == other.Value) ) return false; + if ( !(ValueType == other.ValueType) ) return false; + if ( !(MenuItem == other.MenuItem) ) return false; + if ( !(DevicePathAsString == other.DevicePathAsString) ) return false; + if ( !(Label == other.Label) ) return false; + return true; + } }; // This is shared by PropertiesClass and ArbitraryClass @@ -789,6 +1303,18 @@ public: XBuffer Value = XBuffer(); TAG_TYPE ValueType = kTagTypeNone; // only used in CreateMenuProps() INPUT_ITEM MenuItem = INPUT_ITEM(); // Will get the Disabled value + + #if __cplusplus > 201703L + bool operator == (const SimplePropertyClass&) const = default; + #endif + bool isEqual(const SimplePropertyClass& other) const + { + if ( !(Key == other.Key) ) return false; + if ( !(Value == other.Value) ) return false; + if ( !(ValueType == other.ValueType) ) return false; + if ( !(MenuItem == other.MenuItem) ) return false; + return true; + } }; // Property don't have Device. Before it was always Device = 0 to differentiate from Arbitrary properties. @@ -807,19 +1333,41 @@ public: EFI_DEVICE_PATH_PROTOCOL* getDevicePath() const { EFI_DEVICE_PATH_PROTOCOL* DevicePath; - if ( DevicePathAsString.equalIC("PrimaryGPU") ) { + if ( DevicePathAsString.isEqualIC("PrimaryGPU") ) { DevicePath = DevicePathFromHandle(gGraphics[0].Handle); // first gpu - } else if ( DevicePathAsString.equalIC("SecondaryGPU") && NGFX > 1) { + } else if ( DevicePathAsString.isEqualIC("SecondaryGPU") && NGFX > 1) { DevicePath = DevicePathFromHandle(gGraphics[1].Handle); // second gpu } else { DevicePath = ConvertTextToDevicePath(DevicePathAsString.wc_str()); //TODO } return DevicePath; } + + #if __cplusplus > 201703L + bool operator == (const PropertyClass&) const = default; + #endif + bool isEqual(const PropertyClass& other) const + { + if ( !(Enabled == other.Enabled) ) return false; + if ( !(DevicePathAsString == other.DevicePathAsString) ) return false; +// if ( !(Label == other.Label) ) return false; + if ( !propertiesArray.isEqual(other.propertiesArray) ) return false; + return true; + } }; XString8 propertiesAsString = XString8(); XObjArray PropertyArray = XObjArray(); + + #if __cplusplus > 201703L + bool operator == (const PropertiesClass&) const = default; + #endif + bool isEqual(const PropertiesClass& other) const + { + if ( !(propertiesAsString == other.propertiesAsString) ) return false; + if ( !PropertyArray.isEqual(other.PropertyArray) ) return false; + return true; + } }; class ArbitraryPropertyClass { @@ -827,6 +1375,17 @@ public: uint32_t Device = 0; XString8 Label = XString8(); XObjArray CustomPropertyArray = XObjArray (); + + #if __cplusplus > 201703L + bool operator == (const ArbitraryPropertyClass&) const = default; + #endif + bool isEqual(const ArbitraryPropertyClass& other) const + { + if ( !(Device == other.Device) ) return false; + if ( !(Label == other.Label) ) return false; + if ( !CustomPropertyArray.isEqual(other.CustomPropertyArray) ) return false; + return true; + } }; class FakeIDClass { @@ -840,6 +1399,22 @@ public: UINT32 FakeSATA = UINT32(); UINT32 FakeXHCI = UINT32(); //103 UINT32 FakeIMEI = UINT32(); //106 + + #if __cplusplus > 201703L + bool operator == (const FakeIDClass&) const = default; + #endif + bool isEqual(const FakeIDClass& other) const + { + if ( !(FakeATI == other.FakeATI) ) return false; + if ( !(FakeNVidia == other.FakeNVidia) ) return false; + if ( !(FakeIntel == other.FakeIntel) ) return false; + if ( !(FakeLAN == other.FakeLAN) ) return false; + if ( !(FakeWIFI == other.FakeWIFI) ) return false; + if ( !(FakeSATA == other.FakeSATA) ) return false; + if ( !(FakeXHCI == other.FakeXHCI) ) return false; + if ( !(FakeIMEI == other.FakeIMEI) ) return false; + return true; + } }; bool StringInjector = bool(); @@ -861,6 +1436,31 @@ public: PropertiesClass Properties = PropertiesClass(); XObjArray ArbitraryArray = XObjArray(); + + #if __cplusplus > 201703L + bool operator == (const DevicesClass&) const = default; + #endif + bool isEqual(const DevicesClass& other) const + { + if ( !(StringInjector == other.StringInjector) ) return false; + if ( !(IntelMaxBacklight == other.IntelMaxBacklight) ) return false; + if ( !(IntelBacklight == other.IntelBacklight) ) return false; + if ( !(IntelMaxValue == other.IntelMaxValue) ) return false; + if ( !(LANInjection == other.LANInjection) ) return false; + if ( !(HDMIInjection == other.HDMIInjection) ) return false; + if ( !(NoDefaultProperties == other.NoDefaultProperties) ) return false; + if ( !(UseIntelHDMI == other.UseIntelHDMI) ) return false; + if ( !(ForceHPET == other.ForceHPET) ) return false; + if ( !(DisableFunctions == other.DisableFunctions) ) return false; + if ( !(AirportBridgeDeviceName == other.AirportBridgeDeviceName) ) return false; + if ( !Audio.isEqual(other.Audio) ) return false; + if ( !USB.isEqual(other.USB) ) return false; + if ( !FakeID.isEqual(other.FakeID) ) return false; + if ( !AddPropertyArray.isEqual(other.AddPropertyArray) ) return false; + if ( !Properties.isEqual(other.Properties) ) return false; + if ( !ArbitraryArray.isEqual(other.ArbitraryArray) ) return false; + return true; + } // 2021-04 : Following is temporary to compare with old way of storing properties. // Let's keep it few months until I am sure the refactoring isomorphic @@ -1038,16 +1638,127 @@ printf("%s", ""); UINTN address = 0; XString8 comment = XString8(); bool enabled = 0; + + #if __cplusplus > 201703L + bool operator == (const MMIOWhiteList&) const = default; + #endif + bool isEqual(const MMIOWhiteList& other) const + { + if ( !(address == other.address) ) return false; + if ( !(comment == other.comment) ) return false; + if ( !(enabled == other.enabled) ) return false; + return true; + } + }; + class OcKernelQuirksClass + { + public: + // bool AppleCpuPmCfgLock = false; + // bool AppleXcpmCfgLock = false; + bool AppleXcpmExtraMsrs = false; + bool AppleXcpmForceBoost = false; + // bool CustomSmbiosGuid = false; + bool DisableIoMapper = false; + bool DisableLinkeditJettison = false; + // bool DisableRtcChecksum = false; + bool DummyPowerManagement = false; + bool ExternalDiskIcons = false; + bool IncreasePciBarSize = false; + // bool LapicKernelPanic = false; + // bool PanicNoKextDump = false; + bool PowerTimeoutKernelPanic = false; + bool ThirdPartyDrives = false; + bool XhciPortLimit = false; + + #if __cplusplus > 201703L + bool operator == (const OcKernelQuirksClass&) const = default; + #endif + bool isEqual(const OcKernelQuirksClass& other) const + { + if ( !(AppleXcpmExtraMsrs == other.AppleXcpmExtraMsrs) ) return false; + if ( !(AppleXcpmForceBoost == other.AppleXcpmForceBoost) ) return false; + if ( !(DisableIoMapper == other.DisableIoMapper) ) return false; + if ( !(DisableLinkeditJettison == other.DisableLinkeditJettison) ) return false; + if ( !(DummyPowerManagement == other.DummyPowerManagement) ) return false; + if ( !(ExternalDiskIcons == other.ExternalDiskIcons) ) return false; + if ( !(IncreasePciBarSize == other.IncreasePciBarSize) ) return false; + if ( !(PowerTimeoutKernelPanic == other.PowerTimeoutKernelPanic) ) return false; + if ( !(ThirdPartyDrives == other.ThirdPartyDrives) ) return false; + if ( !(XhciPortLimit == other.XhciPortLimit) ) return false; + return true; + } }; + class OcBooterQuirksClass + { + public: + bool AvoidRuntimeDefrag = false; + bool DevirtualiseMmio = false; + bool DisableSingleUser = false; + bool DisableVariableWrite = false; + bool DiscardHibernateMap = false; + bool EnableSafeModeSlide = false; + bool EnableWriteUnprotector = false; + bool ForceExitBootServices = false; + bool ProtectMemoryRegions = false; + bool ProtectSecureBoot = false; + bool ProtectUefiServices = false; + bool ProvideCustomSlide = false; + uint8_t ProvideMaxSlide = false; + bool RebuildAppleMemoryMap = false; + bool SetupVirtualMap = false; + bool SignalAppleOS = false; + bool SyncRuntimePermissions = false; + + #if __cplusplus > 201703L + bool operator == (const OcBooterQuirksClass&) const = default; + #endif + bool isEqual(const OcBooterQuirksClass& other) const + { + if ( !(AvoidRuntimeDefrag == other.AvoidRuntimeDefrag) ) return false; + if ( !(DevirtualiseMmio == other.DevirtualiseMmio) ) return false; + if ( !(DisableSingleUser == other.DisableSingleUser) ) return false; + if ( !(DisableVariableWrite == other.DisableVariableWrite) ) return false; + if ( !(DiscardHibernateMap == other.DiscardHibernateMap) ) return false; + if ( !(EnableSafeModeSlide == other.EnableSafeModeSlide) ) return false; + if ( !(EnableWriteUnprotector == other.EnableWriteUnprotector) ) return false; + if ( !(ForceExitBootServices == other.ForceExitBootServices) ) return false; + if ( !(ProtectSecureBoot == other.ProtectSecureBoot) ) return false; + if ( !(ProtectUefiServices == other.ProtectUefiServices) ) return false; + if ( !(ProtectUefiServices == other.ProtectUefiServices) ) return false; + if ( !(ProvideCustomSlide == other.ProvideCustomSlide) ) return false; + if ( !(ProvideMaxSlide == other.ProvideMaxSlide) ) return false; + if ( !(RebuildAppleMemoryMap == other.RebuildAppleMemoryMap) ) return false; + if ( !(SetupVirtualMap == other.SetupVirtualMap) ) return false; + if ( !(SignalAppleOS == other.SignalAppleOS) ) return false; + if ( !(SyncRuntimePermissions == other.SyncRuntimePermissions) ) return false; + return true; + } + + }; + bool FuzzyMatch = bool(); XString8 OcKernelCache = XString8(); // UINTN MaxSlide; - OC_KERNEL_QUIRKS OcKernelQuirks = OC_KERNEL_QUIRKS(); - OC_BOOTER_QUIRKS ocBooterQuirks = OC_BOOTER_QUIRKS(); + OcKernelQuirksClass OcKernelQuirks = OcKernelQuirksClass(); + OcBooterQuirksClass OcBooterQuirks = OcBooterQuirksClass(); XObjArray mmioWhiteListArray = XObjArray(); UINT32 QuirksMask = 0; - }; + + #if __cplusplus > 201703L + bool operator == (const QuirksClass&) const = default; + #endif + bool isEqual(const QuirksClass& other) const + { + if ( !(FuzzyMatch == other.FuzzyMatch) ) return false; + if ( !(OcKernelCache == other.OcKernelCache) ) return false; + if ( !(OcKernelQuirks.isEqual(other.OcKernelQuirks)) ) return false; + if ( !(OcBooterQuirks.isEqual(other.OcBooterQuirks)) ) return false; + if ( !mmioWhiteListArray.isEqual(other.mmioWhiteListArray) ) return false; + if ( !(QuirksMask == other.QuirksMask) ) return false; + return true; + } +}; class RtVariablesClass { public: @@ -1058,6 +1769,25 @@ printf("%s", ""); XString8 Comment = XStringW(); XStringW Name = XStringW(); EFI_GUID Guid = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}}; + + #if __cplusplus > 201703L + //bool operator == (const RT_VARIABLES&) const = default; + bool operator == (const RT_VARIABLES& other) const { // no default... YET, because of EFI_GUID. // TODO: create a class wrapper around EFI_GUID, take the occasion to put conversion method in that new class + if ( !(Disabled == other.Disabled) ) return false; + if ( !(Comment == other.Comment) ) return false; + if ( !(Name == other.Name) ) return false; + if ( memcmp(&Guid, &other.Guid, sizeof(Guid)) != 0 ) return false; + return true; + } + #endif + bool isEqual(const RT_VARIABLES& other) const + { + if ( !(Disabled == other.Disabled) ) return false; + if ( !(Comment == other.Comment) ) return false; + if ( !(Name == other.Name) ) return false; + if ( memcmp(&Guid, &other.Guid, sizeof(Guid)) != 0 ) return false; + return true; + } }; XString8 RtROMAsString = XString8(); @@ -1069,8 +1799,23 @@ printf("%s", ""); XObjArray BlockRtVariableArray = XObjArray(); bool GetLegacyLanAddress() const { - return RtROMAsString.equalIC("UseMacAddr0") || RtROMAsString.equalIC("UseMacAddr1"); + return RtROMAsString.isEqualIC("UseMacAddr0") || RtROMAsString.isEqualIC("UseMacAddr1"); } + + #if __cplusplus > 201703L + bool operator == (const RtVariablesClass&) const = default; + #endif + bool isEqual(const RtVariablesClass& other) const + { + if ( !(RtROMAsString == other.RtROMAsString) ) return false; + if ( !(RtROMAsData == other.RtROMAsData) ) return false; + if ( !(RtMLBSetting == other.RtMLBSetting) ) return false; + if ( !(CsrActiveConfig == other.CsrActiveConfig) ) return false; + if ( !(BooterConfig == other.BooterConfig) ) return false; + if ( !(BooterCfgStr == other.BooterCfgStr) ) return false; + if ( !BlockRtVariableArray.isEqual(other.BlockRtVariableArray) ) return false; + return true; + } }; @@ -1081,7 +1826,24 @@ printf("%s", ""); public: UINT8 SlotCounts = UINT8(); UINT8 UserChannels = UINT8(); - RAM_SLOT_INFO User[MAX_RAM_SLOTS * 4]; + XObjArray User = XObjArray(); + + MemoryClass() { + for (size_t idx = 0 ; idx < MAX_RAM_SLOTS ; ++idx ) { // TODO: refactor this. We don't need to store all invalid slot info + User.AddReference(new RAM_SLOT_INFO(), true); + } + } + + #if __cplusplus > 201703L + bool operator == (const MemoryClass&) const = default; + #endif + bool isEqual(const MemoryClass& other) const + { + if ( !(SlotCounts == other.SlotCounts) ) return false; + if ( !(UserChannels == other.UserChannels) ) return false; + if ( !(User.isEqual(other.User)) ) return false; + return true; + } }; // SMBIOS TYPE0 @@ -1129,22 +1891,96 @@ printf("%s", ""); UINT32 gFwFeatures = UINT32(); UINT32 gFwFeaturesMask = UINT32(); MemoryClass Memory = MemoryClass(); - SLOT_DEVICE SlotDevices[16]; //assume DEV_XXX, Arpt=6 + XObjArray SlotDevices = XObjArray(); //assume DEV_XXX, Arpt=6 // These are calculated from ApplePlatformData - CHAR8 RPlt[8] = {0}; - CHAR8 RBr[8] = {0}; - UINT8 EPCI[4] = {0}; - UINT8 REV[6] = {0}; +// CHAR8 RPlt[8] = {0}; +// CHAR8 RBr[8] = {0}; +// UINT8 EPCI[4] = {0}; +// UINT8 REV[6] = {0}; + SmbiosClass() { + for (size_t idx = 0 ; idx < 16 ; ++idx ) { + SlotDevices.AddReference(new SLOT_DEVICE(), true); + } + } + + #if __cplusplus > 201703L + bool operator == (const SmbiosClass&) const = default; + #endif + bool isEqual(const SmbiosClass& other) const + { + // SMBIOS TYPE0 + if ( !(BiosVendor == other.BiosVendor) ) return false; + if ( !(_RomVersion == other._RomVersion) ) return false; + if ( !(_EfiVersion == other._EfiVersion) ) return false; + if ( !(_ReleaseDate == other._ReleaseDate) ) return false; + // SMBIOS TYPE1 + if ( !(ManufactureName == other.ManufactureName) ) return false; + if ( !(ProductName == other.ProductName) ) return false; + if ( !(VersionNr == other.VersionNr) ) return false; + if ( !(SerialNr == other.SerialNr) ) return false; + if ( !(SmUUID == other.SmUUID) ) return false; + if ( !(FamilyName == other.FamilyName) ) return false; + // SMBIOS TYPE2 + if ( !(BoardManufactureName == other.BoardManufactureName) ) return false; + if ( !(BoardSerialNumber == other.BoardSerialNumber) ) return false; + if ( !(BoardNumber == other.BoardNumber) ) return false; + if ( !(LocationInChassis == other.LocationInChassis) ) return false; + if ( !(BoardVersion == other.BoardVersion) ) return false; + if ( !(BoardType == other.BoardType) ) return false; + // SMBIOS TYPE3 + if ( !(Mobile == other.Mobile) ) return false; + if ( !(ChassisType == other.ChassisType) ) return false; + if ( !(ChassisManufacturer == other.ChassisManufacturer) ) return false; + if ( !(ChassisAssetTag == other.ChassisAssetTag) ) return false; + // SMBIOS TYPE17 + if ( !(SmbiosVersion == other.SmbiosVersion) ) return false; + if ( !(Attribute == other.Attribute) ) return false; + // SMBIOS TYPE132 + if ( !(TrustSMBIOS == other.TrustSMBIOS) ) return false; + if ( !(InjectMemoryTables == other.InjectMemoryTables) ) return false; + // SMBIOS TYPE133 + if ( !(gPlatformFeature == other.gPlatformFeature) ) return false; + // PatchTableType11 + if ( !(NoRomInfo == other.NoRomInfo) ) return false; + + if ( !(gFwFeatures == other.gFwFeatures) ) return false; + if ( !(gFwFeaturesMask == other.gFwFeaturesMask) ) return false; + if ( !Memory.isEqual(other.Memory) ) return false; + if ( !SlotDevices.isEqual(other.SlotDevices) ) return false; + +// if ( memcmp(RPlt, other.RPlt, sizeof(RPlt)) != 0 ) return false; +// if ( memcmp(RBr, other.RBr, sizeof(RBr)) != 0 ) return false; +// if ( memcmp(EPCI, other.EPCI, sizeof(EPCI)) != 0 ) return false; +// if ( memcmp(REV, other.REV, sizeof(REV)) != 0 ) return false; + return true; + } }; class BootGraphicsClass { public: - UINT32 DefaultBackgroundColor = 0; - UINT32 UIScale = 0; - UINT32 EFILoginHiDPI = 0; - UINT8 flagstate[32] = {0}; + UINT32 DefaultBackgroundColor = 0; + UINT32 UIScale = 0; + UINT32 EFILoginHiDPI = 0; +// UINT8 flagstate[32] = {0}; + uint32_t _flagstate = uint32_t(); + + BootGraphicsClass() { +// flagstate.memset(0, 32); + } + + #if __cplusplus > 201703L + bool operator == (const BootGraphicsClass&) const = default; + #endif + bool isEqual(const BootGraphicsClass& other) const + { + if ( !(DefaultBackgroundColor == other.DefaultBackgroundColor) ) return false; + if ( !(UIScale == other.UIScale) ) return false; + if ( !(EFILoginHiDPI == other.EFILoginHiDPI) ) return false; + if ( _flagstate != other._flagstate ) return false; + return true; + } }; BootClass Boot = BootClass(); @@ -1167,8 +2003,29 @@ printf("%s", ""); // BOOLEAN LpcTune; // never set to true. SETTINGS_DATA() {} - SETTINGS_DATA(const SETTINGS_DATA& other) = delete; // Can be defined if needed - const SETTINGS_DATA& operator = ( const SETTINGS_DATA & ) = delete; // Can be defined if needed +// SETTINGS_DATA(const SETTINGS_DATA& other) = delete; // Can be defined if needed +// const SETTINGS_DATA& operator = ( const SETTINGS_DATA & ) = delete; // Can be defined if needed + + #if __cplusplus > 201703L + bool operator == (const SETTINGS_DATA&) const = default; + #endif + bool isEqual(const SETTINGS_DATA& other) const + { + if ( !Boot.isEqual(other.Boot) ) return false; + if ( !ACPI.isEqual(other.ACPI) ) return false; + if ( !GUI.isEqual(other.GUI) ) return false; + if ( !CPU.isEqual(other.CPU) ) return false; + if ( !SystemParameters.isEqual(other.SystemParameters) ) return false; + if ( !KernelAndKextPatches.isEqual(other.KernelAndKextPatches) ) return false; + if ( !Graphics.isEqual(other.Graphics) ) return false; + if ( !(DisabledDriverArray == other.DisabledDriverArray) ) return false; + if ( !Quirks.isEqual(other.Quirks) ) return false; + if ( !RtVariables.isEqual(other.RtVariables) ) return false; + if ( !Devices.isEqual(other.Devices) ) return false; + if ( !Smbios.isEqual(other.Smbios) ) return false; + if ( !BootGraphics.isEqual(other.BootGraphics) ) return false; + return true; + } ~SETTINGS_DATA() {} @@ -1385,6 +2242,10 @@ public: XString8 RomVersionUsed = XString8(); XString8 EfiVersionUsed = XString8(); XString8 ReleaseDateUsed = XString8(); + + UINT8 flagstate[32] = {0}; + MACHINE_TYPES CurrentModel = MaxMachineType; + REFIT_CONFIG() {}; REFIT_CONFIG(const REFIT_CONFIG& other) = delete; // Can be defined if needed diff --git a/rEFIt_UEFI/Platform/b64cdecode.cpp b/rEFIt_UEFI/Platform/b64cdecode.cpp index 52fde952b..dc97ba8ef 100755 --- a/rEFIt_UEFI/Platform/b64cdecode.cpp +++ b/rEFIt_UEFI/Platform/b64cdecode.cpp @@ -8,6 +8,23 @@ For details, see http://sourceforge.net/projects/libb64 #include // Only use angled for Platform, else, xcode project won't compile #include "b64cdecode.h" +typedef enum +{ + step_a, step_b, step_c, step_d +} +base64_decodestep; + + + +typedef struct +{ + + base64_decodestep step; + char plainchar; +} +base64_decodestate; + + int base64_decode_value(char value_in) { static const signed char decoding[] = {62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-2,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51}; @@ -23,7 +40,7 @@ void base64_init_decodestate(base64_decodestate* state_in) state_in->plainchar = 0; } -long base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in) +long base64_decode_block(const char* code_in, const size_t length_in, char* plaintext_out, base64_decodestate* state_in) { const char* codechar = code_in; char* plainchar = plaintext_out; @@ -93,7 +110,7 @@ long base64_decode_block(const char* code_in, const int length_in, char* plainte * If DecodedSize != NULL, then size od decoded data is put there. * If return value is not NULL, DecodedSize IS > 0 */ -UINT8 *Base64DecodeClover(IN CONST CHAR8 *EncodedData, UINTN EncodedSize, OUT UINTN *DecodedSize) +UINT8 *Base64DecodeClover(IN CONST CHAR8 *EncodedData, size_t EncodedSize, OUT UINTN *DecodedSize) { INTN DecodedSizeInternal; UINT8 *DecodedData; @@ -108,7 +125,7 @@ UINT8 *Base64DecodeClover(IN CONST CHAR8 *EncodedData, UINTN EncodedSize, OUT UI DecodedData = (__typeof__(DecodedData))AllocateZeroPool(EncodedSize); base64_init_decodestate(&state_in); - DecodedSizeInternal = base64_decode_block(EncodedData, (const int)EncodedSize, (char*) DecodedData, &state_in); + DecodedSizeInternal = base64_decode_block(EncodedData, EncodedSize, (char*) DecodedData, &state_in); if ( DecodedSizeInternal <= 0 ) { FreePool(DecodedData); diff --git a/rEFIt_UEFI/Platform/b64cdecode.h b/rEFIt_UEFI/Platform/b64cdecode.h index 440ef4d05..dd6872f03 100644 --- a/rEFIt_UEFI/Platform/b64cdecode.h +++ b/rEFIt_UEFI/Platform/b64cdecode.h @@ -18,40 +18,9 @@ For details, see http://sourceforge.net/projects/libb64 -typedef enum - -{ - - step_a, step_b, step_c, step_d - -} base64_decodestep; - -typedef struct - -{ - - base64_decodestep step; - - char plainchar; - -} base64_decodestate; - - - -void base64_init_decodestate(base64_decodestate* state_in); - - - -int base64_decode_value(char value_in); - - - -long base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in); - - -UINT8 *Base64DecodeClover(IN CONST CHAR8 *EncodedData, UINTN EncodedSize, OUT UINTN *DecodedSize); +UINT8 *Base64DecodeClover(IN CONST CHAR8 *EncodedData, size_t EncodedSize, OUT UINTN *DecodedSize); UINT8 *Base64DecodeClover(IN CONST CHAR8 *EncodedData, OUT UINTN *DecodedSize); diff --git a/rEFIt_UEFI/Platform/platformdata.cpp b/rEFIt_UEFI/Platform/platformdata.cpp index 709ede7a3..4e302077d 100644 --- a/rEFIt_UEFI/Platform/platformdata.cpp +++ b/rEFIt_UEFI/Platform/platformdata.cpp @@ -942,6 +942,156 @@ UINT64 GetPlatformFeature(MACHINE_TYPES Model) } } +void getRBr(MACHINE_TYPES Model, char RBr[8]) +{ + memset(RBr, 0, 8); + if (ApplePlatformData[Model].smcBranch[0] != 'N') { + snprintf(RBr, 8, "%s", ApplePlatformData[Model].smcBranch.c_str()); + } else { + switch (gCPUStructure.Model) { + case CPU_MODEL_PENTIUM_M: + case CPU_MODEL_CELERON: + snprintf(RBr, 8, "%s", "m70"); + break; + + case CPU_MODEL_YONAH: + snprintf(RBr, 8, "%s", "k22"); + break; + + case CPU_MODEL_MEROM: //TODO check for mobile + snprintf(RBr, 8, "%s", "m75"); + break; + + case CPU_MODEL_PENRYN: + if (gSettings.Smbios.Mobile) { + snprintf(RBr, 8, "%s", "m82"); + } else { + snprintf(RBr, 8, "%s", "k36"); + } + break; + + case CPU_MODEL_SANDY_BRIDGE: + if (gSettings.Smbios.Mobile) { + snprintf(RBr, 8, "%s", "k90i"); + } else { + snprintf(RBr, 8, "%s", "k60"); + } + break; + + case CPU_MODEL_IVY_BRIDGE: + snprintf(RBr, 8, "%s", "j30"); + break; + + case CPU_MODEL_IVY_BRIDGE_E5: + snprintf(RBr, 8, "%s", "j90"); + break; + + case CPU_MODEL_HASWELL_ULT: + snprintf(RBr, 8, "%s", "j44"); + break; + + case CPU_MODEL_HASWELL_U5: //Mobile - Broadwell + snprintf(RBr, 8, "%s", "j52"); + break; + + case CPU_MODEL_SKYLAKE_D: + snprintf(RBr, 8, "%s", "j95j95am"); + break; + + case CPU_MODEL_SKYLAKE_U: + snprintf(RBr, 8, "%s", "2016mb"); + break; + + case CPU_MODEL_KABYLAKE1: //Mobile + snprintf(RBr, 8, "%s", "2017mbp"); + break; + + case CPU_MODEL_KABYLAKE2: //Desktop + snprintf(RBr, 8, "%s", "j133_4_5"); + break; + + default: + snprintf(RBr, 8, "%s", "t9"); + break; + } + } +} + +void getRPlt(MACHINE_TYPES Model, bool Mobile, char RPlt[8]) +{ + memset(RPlt, 0, 8); + if (ApplePlatformData[Model].smcPlatform[0] != 'N') { + AsciiStrCpyS(RPlt, 8, ApplePlatformData[Model].smcPlatform.c_str()); + } else { + switch (gCPUStructure.Model) { + case CPU_MODEL_PENTIUM_M: + case CPU_MODEL_CELERON: + AsciiStrCpyS (RPlt, 8, "m70"); + break; + + case CPU_MODEL_YONAH: + AsciiStrCpyS (RPlt, 8, "k22"); + break; + + case CPU_MODEL_MEROM: //TODO check for mobile + AsciiStrCpyS (RPlt, 8, "m75"); + break; + + case CPU_MODEL_PENRYN: + if (Mobile) { + AsciiStrCpyS (RPlt, 8, "m82"); + } else { + AsciiStrCpyS (RPlt, 8, "k36"); + } + break; + + case CPU_MODEL_SANDY_BRIDGE: + if (Mobile) { + AsciiStrCpyS (RPlt, 8, "k90i"); + } else { + AsciiStrCpyS (RPlt, 8, "k60"); + } + break; + + case CPU_MODEL_IVY_BRIDGE: + AsciiStrCpyS (RPlt, 8, "j30"); + break; + + case CPU_MODEL_IVY_BRIDGE_E5: + AsciiStrCpyS (RPlt, 8, "j90"); + break; + + case CPU_MODEL_HASWELL_ULT: + AsciiStrCpyS (RPlt, 8, "j44"); + break; + + case CPU_MODEL_HASWELL_U5: //Mobile - Broadwell + AsciiStrCpyS (RPlt, 8, "j52"); + break; + + case CPU_MODEL_SKYLAKE_D: + AsciiStrCpyS (RPlt, 8, "j95"); + break; + + case CPU_MODEL_SKYLAKE_U: + AsciiStrCpyS (RPlt, 8, "j79"); + break; + + case CPU_MODEL_KABYLAKE1: //Mobile + AsciiStrCpyS (RPlt, 8, "j130a"); + break; + + case CPU_MODEL_KABYLAKE2: //Desktop + AsciiStrCpyS (RPlt, 8, "j135"); + break; + + default: + AsciiStrCpyS (RPlt, 8, "t9"); + break; + } + } +} + void SetDMISettingsForModel(SETTINGS_DATA& gSettings, MACHINE_TYPES Model, BOOLEAN Redefine) { #pragma GCC diagnostic pop @@ -1068,151 +1218,14 @@ void SetDMISettingsForModel(SETTINGS_DATA& gSettings, MACHINE_TYPES Model, BOOLE // Mobile: the battery tab in Energy Saver gSettings.Smbios.Mobile = GetMobile(Model, gMobile); - //RBr helper - if (ApplePlatformData[Model].smcBranch[0] != 'N') { - AsciiStrCpyS(gSettings.Smbios.RBr, 8, ApplePlatformData[Model].smcBranch.c_str()); - } else { - switch (gCPUStructure.Model) { - case CPU_MODEL_PENTIUM_M: - case CPU_MODEL_CELERON: - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "m70"); - break; - - case CPU_MODEL_YONAH: - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "k22"); - break; - - case CPU_MODEL_MEROM: //TODO check for mobile - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "m75"); - break; - - case CPU_MODEL_PENRYN: - if (gSettings.Smbios.Mobile) { - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "m82"); - } else { - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "k36"); - } - break; - - case CPU_MODEL_SANDY_BRIDGE: - if (gSettings.Smbios.Mobile) { - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "k90i"); - } else { - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "k60"); - } - break; - - case CPU_MODEL_IVY_BRIDGE: - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "j30"); - break; - - case CPU_MODEL_IVY_BRIDGE_E5: - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "j90"); - break; - - case CPU_MODEL_HASWELL_ULT: - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "j44"); - break; - - case CPU_MODEL_HASWELL_U5: //Mobile - Broadwell - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "j52"); - break; - - case CPU_MODEL_SKYLAKE_D: - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "j95j95am"); - break; - - case CPU_MODEL_SKYLAKE_U: - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "2016mb"); - break; - - case CPU_MODEL_KABYLAKE1: //Mobile - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "2017mbp"); - break; - - case CPU_MODEL_KABYLAKE2: //Desktop - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "j133_4_5"); - break; - - default: - AsciiStrCpyS (gSettings.Smbios.RBr, 8, "t9"); - break; - } - } - - //RPlt helper - if (ApplePlatformData[Model].smcPlatform[0] != 'N') { - AsciiStrCpyS(gSettings.Smbios.RPlt, 8, ApplePlatformData[Model].smcPlatform.c_str()); - } else { - switch (gCPUStructure.Model) { - case CPU_MODEL_PENTIUM_M: - case CPU_MODEL_CELERON: - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "m70"); - break; - - case CPU_MODEL_YONAH: - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "k22"); - break; - - case CPU_MODEL_MEROM: //TODO check for mobile - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "m75"); - break; - - case CPU_MODEL_PENRYN: - if (gSettings.Smbios.Mobile) { - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "m82"); - } else { - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "k36"); - } - break; - - case CPU_MODEL_SANDY_BRIDGE: - if (gSettings.Smbios.Mobile) { - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "k90i"); - } else { - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "k60"); - } - break; - - case CPU_MODEL_IVY_BRIDGE: - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j30"); - break; - - case CPU_MODEL_IVY_BRIDGE_E5: - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j90"); - break; - - case CPU_MODEL_HASWELL_ULT: - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j44"); - break; - - case CPU_MODEL_HASWELL_U5: //Mobile - Broadwell - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j52"); - break; - - case CPU_MODEL_SKYLAKE_D: - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j95"); - break; - - case CPU_MODEL_SKYLAKE_U: - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j79"); - break; - - case CPU_MODEL_KABYLAKE1: //Mobile - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j130a"); - break; - - case CPU_MODEL_KABYLAKE2: //Desktop - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j135"); - break; - - default: - AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "t9"); - break; - } - } - CopyMem(gSettings.Smbios.REV, ApplePlatformData[Model].smcRevision, 6); - CopyMem(gSettings.Smbios.EPCI, &ApplePlatformData[Model].smcConfig, 4); +// //RBr helper +// getRBr(Model, gSettings.Smbios.RBr); +// +// //RPlt helper +// getRPlt(Model, gSettings.Smbios.RPlt); +// +// CopyMem(gSettings.Smbios.REV, ApplePlatformData[Model].smcRevision, 6); +// CopyMem(gSettings.Smbios.EPCI, &ApplePlatformData[Model].smcConfig, 4); } MACHINE_TYPES GetModelFromString(const XString8& ProductName) @@ -1246,8 +1259,8 @@ void GetDefaultSettings() ((gGraphics[1].Vendor == Nvidia) && (gGraphics[1].Family < 0xE0))); // gSettings.GraphicsInjector = gSettings.InjectATI || gSettings.InjectNVidia; - CopyMem(gSettings.Graphics.NVCAP, default_NVCAP, 20); - CopyMem(gSettings.Graphics.Dcfg, default_dcfg_0, 4); + CopyMem(gSettings.Graphics.NVCAP.data(), default_NVCAP, 20); + CopyMem(gSettings.Graphics.Dcfg.data(), default_dcfg_0, 4); CopyMem(&gSettings.Graphics.Dcfg[4], default_dcfg_1, 4); //gSettings.Graphics.EDID.CustomEDID = NULL; //no sense to assign 0 as the structure is zeroed gSettings.Graphics.DualLink = 0xA; // A(auto): DualLink auto-detection diff --git a/rEFIt_UEFI/Platform/platformdata.h b/rEFIt_UEFI/Platform/platformdata.h index eccdb5956..f53ee2d32 100644 --- a/rEFIt_UEFI/Platform/platformdata.h +++ b/rEFIt_UEFI/Platform/platformdata.h @@ -10,7 +10,9 @@ #include "../cpp_foundation/XString.h" -#include "../Platform/Settings.h" +//#include "../Platform/Settings.h" + +class SETTINGS_DATA; typedef enum { @@ -199,5 +201,7 @@ uint32_t GetFwFeaturesMaskFromModel(MACHINE_TYPES Model); uint32_t GetFwFeatures(MACHINE_TYPES Model); bool GetMobile(MACHINE_TYPES Model, bool defaultValue); UINT64 GetPlatformFeature(MACHINE_TYPES Model); +void getRBr(MACHINE_TYPES Model, char RBr[8]); +void getRPlt(MACHINE_TYPES Model, bool Mobile, char RPlt[8]); #endif /* PLATFORM_PLATFORMDATA_H_ */ diff --git a/rEFIt_UEFI/Platform/plist/TagDict.cpp b/rEFIt_UEFI/Platform/plist/TagDict.cpp index 04c84ef38..507bd103b 100755 --- a/rEFIt_UEFI/Platform/plist/TagDict.cpp +++ b/rEFIt_UEFI/Platform/plist/TagDict.cpp @@ -156,7 +156,7 @@ const TagStruct* TagDict::propertyForKey(const CHAR8* key) const const XObjArray& tagList = _dictContent; for (size_t tagIdx = 0 ; tagIdx < tagList.size() ; tagIdx++ ) { - if ( tagList[tagIdx].isKey() && tagList[tagIdx].getKey()->keyStringValue().equalIC(key) ) { + if ( tagList[tagIdx].isKey() && tagList[tagIdx].getKey()->keyStringValue().isEqualIC(key) ) { if ( tagIdx+1 >= tagList.size() ) return NULL; if ( tagList[tagIdx+1].isKey() ) return NULL; return &tagList[tagIdx+1]; diff --git a/rEFIt_UEFI/Platform/plist/plist.cpp b/rEFIt_UEFI/Platform/plist/plist.cpp index 47d58edd0..d23e96d9a 100755 --- a/rEFIt_UEFI/Platform/plist/plist.cpp +++ b/rEFIt_UEFI/Platform/plist/plist.cpp @@ -203,7 +203,7 @@ bool TagStruct::isTrueOrYy() const bool TagStruct::isTrueOrYes() const { if ( isBool() ) return getBool()->boolValue(); - if ( isString() && getString()->stringValue().equal("Yes"_XS8) ) return true; + if ( isString() && getString()->stringValue().isEqual("Yes"_XS8) ) return true; return false; } bool TagStruct::isFalseOrNn() const diff --git a/rEFIt_UEFI/Platform/smbios.h b/rEFIt_UEFI/Platform/smbios.h index 35695bb3e..1d16206f0 100644 --- a/rEFIt_UEFI/Platform/smbios.h +++ b/rEFIt_UEFI/Platform/smbios.h @@ -27,6 +27,21 @@ public: XString8 SerialNo = XString8(); UINT8 Type = UINT8(); bool InUse = bool(); + + #if __cplusplus > 201703L + bool operator == (const RAM_SLOT_INFO&) const = default; + #endif + bool isEqual(const RAM_SLOT_INFO& other) const + { + if ( !(ModuleSize == other.ModuleSize ) ) return false; + if ( !(Frequency == other.Frequency ) ) return false; + if ( !(Vendor == other.Vendor ) ) return false; + if ( !(PartNo == other.PartNo ) ) return false; + if ( !(SerialNo == other.SerialNo ) ) return false; + if ( !(Type == other.Type ) ) return false; + if ( !(InUse == other.InUse ) ) return false; + return true; + } }; class MEM_STRUCTURE diff --git a/rEFIt_UEFI/PlatformPOSIX/include/Platform.h b/rEFIt_UEFI/PlatformPOSIX/include/Platform.h index fcc51aae9..d412c150e 100644 --- a/rEFIt_UEFI/PlatformPOSIX/include/Platform.h +++ b/rEFIt_UEFI/PlatformPOSIX/include/Platform.h @@ -10,7 +10,10 @@ #define Platform_h_h #ifndef _UINTPTR_T -#define _UINTPTR_T // to prevent macOS definition of uintptr_t (map to a long). We prefer long long so we can use %llu on all platform (including microsoft) +#define _UINTPTR_T // to prevent macOS/Clang definition of uintptr_t (map to a long). We prefer long long so we can use %llu on all platform (including microsoft) +#endif +#ifndef _PTRDIFF_T_DECLARED +#define _PTRDIFF_T_DECLARED // to prevent macOS/GCC definition of uintptr_t (map to a long). We prefer long long so we can use %llu on all platform (including microsoft) #endif #ifdef _MSC_VER @@ -84,15 +87,15 @@ typedef unsigned long long uintptr_t; #endif - -#ifdef __OBJC__ -#define _MACH_H_ -#define __DEBUGGING__ -#import -#undef CMASK +#if defined(__clang__) // it works to include and that allows to use NS... objects. Could be useful for a tool running on macOS. +//#ifdef __OBJC__ +//#define _MACH_H_ +//#define __DEBUGGING__ +//#import +//#undef CMASK +//#endif #endif - // to be able to compile AutoGen.c #ifdef __cplusplus extern "C" { diff --git a/rEFIt_UEFI/cpp_foundation/XArray.h b/rEFIt_UEFI/cpp_foundation/XArray.h index 752e065c5..c91c9d17f 100755 --- a/rEFIt_UEFI/cpp_foundation/XArray.h +++ b/rEFIt_UEFI/cpp_foundation/XArray.h @@ -48,11 +48,11 @@ class XArray //low case functions like in std::vector - const TYPE& begin() const { return ElementAt(0); } - TYPE& begin() { return ElementAt(0); } + const TYPE& begin() const { if ( m_len == 0 ) panic("m_len == 0"); return ElementAt(0); } + TYPE& begin() { if ( m_len == 0 ) panic("m_len == 0"); return ElementAt(0); } - const TYPE& end() const { return ElementAt(m_len - 1); } - TYPE& end() { return ElementAt(m_len - 1); } + const TYPE& end() const { if ( m_len == 0 ) panic("m_len == 0"); return ElementAt(m_len - 1); } + TYPE& end() { if ( m_len == 0 ) panic("m_len == 0"); return ElementAt(m_len - 1); } size_t insert(const TYPE newElement, size_t pos, size_t count = 1) { return Insert(newElement, pos, count); } @@ -79,6 +79,24 @@ class XArray template TYPE &operator[](IntegralType nIndex) { return ElementAt(nIndex); } + bool operator==(const XArray& other) const + { + if ( size() != other.size() ) return false; + for ( size_t idx = 0 ; idx < other.size() ; ++idx ) { + if ( !( ElementAt(idx) == other.ElementAt(idx) ) ) return false; + } + return true; + } + bool isEqual(const XArray& other) const + { + if ( size() != other.size() ) return false; + for ( size_t idx = 0 ; idx < other.size() ; ++idx ) { + if ( !( ElementAt(idx).isEqual(other.ElementAt(idx)) ) ) return false; + } + return true; + } + + operator const void *() const { return m_data; }; operator void *() { return m_data; }; diff --git a/rEFIt_UEFI/cpp_foundation/XObjArray.h b/rEFIt_UEFI/cpp_foundation/XObjArray.h index b65875d24..50d921d9f 100755 --- a/rEFIt_UEFI/cpp_foundation/XObjArray.h +++ b/rEFIt_UEFI/cpp_foundation/XObjArray.h @@ -113,6 +113,26 @@ class XObjArrayNC template TYPE &operator[](IntegralType nIndex) { return ElementAt(nIndex); } + bool operator==(const XObjArrayNC& other) const + { + if ( size() != other.size() ) return false; + for ( size_t idx = 0 ; idx < other.size() ; ++idx ) { + if ( !( ElementAt(idx) == other.ElementAt(idx) ) ) return false; + } + return true; + } + bool operator!=(const XObjArrayNC& other) const {return !(*this == other); } + + bool isEqual(const XObjArrayNC& other) const + { + if ( size() != other.size() ) return false; + for ( size_t idx = 0 ; idx < other.size() ; ++idx ) { + if ( ! ElementAt(idx).isEqual(other.ElementAt(idx)) ) return false; + } + return true; + } + + size_t AddReference(TYPE *newElement, bool FreeIt); // size_t InsertRef(TYPE *newElement, size_t pos, bool FreeIt = false); diff --git a/rEFIt_UEFI/cpp_foundation/XStringAbstract.h b/rEFIt_UEFI/cpp_foundation/XStringAbstract.h index 0a83c1e3b..8aba71134 100755 --- a/rEFIt_UEFI/cpp_foundation/XStringAbstract.h +++ b/rEFIt_UEFI/cpp_foundation/XStringAbstract.h @@ -539,19 +539,19 @@ public: int strncmp(const O* S, size_t n) const { return XStringAbstract__ncompare(data(), S, n, false); } template - bool equal(const __String& S) const { return XStringAbstract__compare(data(), S.s(), false) == 0; } + bool isEqual(const __String& S) const { return XStringAbstract__compare(data(), S.s(), false) == 0; } template - bool equal(const O* S) const { return XStringAbstract__compare(data(), S, false) == 0; } + bool isEqual(const O* S) const { return XStringAbstract__compare(data(), S, false) == 0; } template - bool equalIC(const __String& S) const { return XStringAbstract__compare(data(), S.s(), true) == 0; } + bool isEqualIC(const __String& S) const { return XStringAbstract__compare(data(), S.s(), true) == 0; } template - bool equalIC(const O* S) const { return XStringAbstract__compare(data(), S, true) == 0; } + bool isEqualIC(const O* S) const { return XStringAbstract__compare(data(), S, true) == 0; } // bool SubStringEqual(size_t Pos, const T* S) const { return (memcmp(data(Pos), S, wcslen(S)) == 0); } template - bool equalAtIC(IntegralType pos, const __String& S) const + bool isEqualAtIC(IntegralType pos, const __String& S) const { #ifdef DEBUG diff --git a/rEFIt_UEFI/cpp_foundation/XStringArray.h b/rEFIt_UEFI/cpp_foundation/XStringArray.h index 567f69224..673be7a03 100755 --- a/rEFIt_UEFI/cpp_foundation/XStringArray.h +++ b/rEFIt_UEFI/cpp_foundation/XStringArray.h @@ -104,7 +104,7 @@ class XStringArray_/* : public XStringArraySuper*/ bool contains(const CharType* s) const { for ( size_t i=0 ; i& other) const + { + if ( !(m_defined == other.m_defined ) ) return false; + if ( m_defined && !(m_value == other.m_value ) ) return false; // we don't test value if this is not defined. + return true; + } + bool operator !=(const undefinable& other) const { return !(*this == other); } }; class undefinable_bool : public undefinable diff --git a/rEFIt_UEFI/entry_scan/common.cpp b/rEFIt_UEFI/entry_scan/common.cpp index a08d2f66f..7e2fa1f9c 100644 --- a/rEFIt_UEFI/entry_scan/common.cpp +++ b/rEFIt_UEFI/entry_scan/common.cpp @@ -73,7 +73,7 @@ const XIcon& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, const DevicePath = NextDevicePathNode(DevicePath); } if (DevicePathType(DevicePath) == MEDIA_DEVICE_PATH && DevicePathSubType (DevicePath) == MEDIA_VENDOR_DP) { - if ( GuidLEToXString8(*(EFI_GUID *)((UINT8 *)DevicePath+0x04)).equalIC(ApfsSignatureUUID) ) { + if ( GuidLEToXString8(*(EFI_GUID *)((UINT8 *)DevicePath+0x04)).isEqualIC(ApfsSignatureUUID) ) { IconNum = BUILTIN_ICON_VOL_INTERNAL_APFS; } } else { diff --git a/rEFIt_UEFI/entry_scan/legacy.cpp b/rEFIt_UEFI/entry_scan/legacy.cpp index cfddfa6aa..f7b605427 100755 --- a/rEFIt_UEFI/entry_scan/legacy.cpp +++ b/rEFIt_UEFI/entry_scan/legacy.cpp @@ -74,7 +74,7 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi // DBG("entry %lld\n", i); // Only want legacy if (MainEntry.getLEGACY_ENTRY()) { - if ( MainEntry.getLEGACY_ENTRY()->DevicePathString.equalIC(Volume->DevicePathString) ) { + if ( MainEntry.getLEGACY_ENTRY()->DevicePathString.isEqualIC(Volume->DevicePathString) ) { return true; } } diff --git a/rEFIt_UEFI/entry_scan/loader.cpp b/rEFIt_UEFI/entry_scan/loader.cpp index f6c429af3..30619006d 100644 --- a/rEFIt_UEFI/entry_scan/loader.cpp +++ b/rEFIt_UEFI/entry_scan/loader.cpp @@ -261,25 +261,25 @@ UINT8 GetOSTypeFromPath(IN CONST XStringW& Path) if (Path.isEmpty()) { return OSTYPE_OTHER; } - if ( Path.equalIC(MACOSX_LOADER_PATH)) { + if ( Path.isEqualIC(MACOSX_LOADER_PATH)) { return OSTYPE_OSX; - } else if ( Path.equalIC(OSXInstallerPaths[0]) || - ( Path.equalIC(OSXInstallerPaths[1])) || - ( Path.equalIC(OSXInstallerPaths[2])) || - ( Path.equalIC(OSXInstallerPaths[3])) || - ( Path.equalIC(OSXInstallerPaths[4])) || - ( Path.equalIC(RockBoot)) || ( Path.equalIC(PaperBoot)) || ( Path.equalIC(ScissorBoot)) || - (! Path.equalIC(L"\\.IABootFiles\\boot.efi") && Path.equalIC(L"\\.IAPhysicalMedia") && Path.equalIC(MACOSX_LOADER_PATH)) + } else if ( Path.isEqualIC(OSXInstallerPaths[0]) || + ( Path.isEqualIC(OSXInstallerPaths[1])) || + ( Path.isEqualIC(OSXInstallerPaths[2])) || + ( Path.isEqualIC(OSXInstallerPaths[3])) || + ( Path.isEqualIC(OSXInstallerPaths[4])) || + ( Path.isEqualIC(RockBoot)) || ( Path.isEqualIC(PaperBoot)) || ( Path.isEqualIC(ScissorBoot)) || + (! Path.isEqualIC(L"\\.IABootFiles\\boot.efi") && Path.isEqualIC(L"\\.IAPhysicalMedia") && Path.isEqualIC(MACOSX_LOADER_PATH)) ) { return OSTYPE_OSX_INSTALLER; - } else if ( Path.equalIC(L"\\com.apple.recovery.boot\\boot.efi")) { + } else if ( Path.isEqualIC(L"\\com.apple.recovery.boot\\boot.efi")) { return OSTYPE_RECOVERY; - } else if (( Path.equalIC(L"\\EFI\\Microsoft\\Boot\\bootmgfw-orig.efi")) || //test first as orig - ( Path.equalIC(L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi")) || //it can be Clover - // ( Path.equalIC(L"\\bootmgr.efi")) || //never worked, just extra icon in menu - ( Path.equalIC(L"\\EFI\\MICROSOFT\\BOOT\\cdboot.efi"))) { + } else if (( Path.isEqualIC(L"\\EFI\\Microsoft\\Boot\\bootmgfw-orig.efi")) || //test first as orig + ( Path.isEqualIC(L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi")) || //it can be Clover + // ( Path.isEqualIC(L"\\bootmgr.efi")) || //never worked, just extra icon in menu + ( Path.isEqualIC(L"\\EFI\\MICROSOFT\\BOOT\\cdboot.efi"))) { return OSTYPE_WINEFI; - } else if (LINUX_FULL_LOADER_PATH.equalIC(Path)) { + } else if (LINUX_FULL_LOADER_PATH.isEqualIC(Path)) { return OSTYPE_LINEFI; } else if ( Path.containsIC("grubx64.efi") ) { return OSTYPE_LINEFI; @@ -288,7 +288,7 @@ UINT8 GetOSTypeFromPath(IN CONST XStringW& Path) #if defined(ANDX86) Index = 0; while (Index < AndroidEntryDataCount) { - if ( Path.equalIC(AndroidEntryData[Index].Path) ) { + if ( Path.isEqualIC(AndroidEntryData[Index].Path) ) { return OSTYPE_LIN; } ++Index; @@ -296,7 +296,7 @@ UINT8 GetOSTypeFromPath(IN CONST XStringW& Path) #endif Index = 0; while (Index < LinuxEntryDataCount) { - if ( Path.equalIC(LinuxEntryData[Index].Path) ) { + if ( Path.isEqualIC(LinuxEntryData[Index].Path) ) { return OSTYPE_LIN; } ++Index; @@ -314,7 +314,7 @@ STATIC CONST XStringW& LinuxIconNameFromPath(IN CONST XStringW& Path, #if defined(ANDX86) Index = 0; while (Index < AndroidEntryDataCount) { - if ( Path.equalIC(AndroidEntryData[Index].Path) ) { + if ( Path.isEqualIC(AndroidEntryData[Index].Path) ) { return AndroidEntryData[Index].Icon; } ++Index; @@ -324,14 +324,14 @@ STATIC CONST XStringW& LinuxIconNameFromPath(IN CONST XStringW& Path, //check not common names Index = 0; while (Index < LinuxEntryDataCount) { - if ( Path.equalIC(LinuxEntryData[Index].Path) ) { + if ( Path.isEqualIC(LinuxEntryData[Index].Path) ) { return LinuxEntryData[Index].Icon; } ++Index; } // Try to open the linux issue - if ((RootDir != NULL) && LINUX_FULL_LOADER_PATH.equalIC(Path)) { + if ((RootDir != NULL) && LINUX_FULL_LOADER_PATH.isEqualIC(Path)) { CHAR8 *Issue = NULL; UINTN IssueLen = 0; if (!EFI_ERROR(egLoadFile(RootDir, LINUX_ISSUE_PATH.wc_str(), (UINT8 **)&Issue, &IssueLen)) && (Issue != NULL)) { @@ -538,7 +538,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath, // Check if the path match if (Custom.settings.Path.notEmpty()) { // Check if the loader path match - path_match = (Custom.settings.Path.equalIC(LoaderPath)) ? 1 : -1; + path_match = (Custom.settings.Path.isEqualIC(LoaderPath)) ? 1 : -1; } // Check if the type match @@ -2165,7 +2165,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, // Less precise volume match if (Custom.settings.Path != CustomEntry.settings.Path) { // Better path match - BetterMatch = ((CustomEntry.settings.Path.notEmpty()) && CustomPath.equal(CustomEntry.settings.Path) && + BetterMatch = ((CustomEntry.settings.Path.notEmpty()) && CustomPath.isEqual(CustomEntry.settings.Path) && ((Custom.settings.VolumeType == CustomEntry.settings.VolumeType) || ((1ull<DiskKind) & Custom.settings.VolumeType) != 0)); } @@ -2175,7 +2175,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, // More precise volume match if (Custom.settings.Path != CustomEntry.settings.Path) { // Better path match - BetterMatch = ((CustomEntry.settings.Path.notEmpty()) && CustomPath.equal(CustomEntry.settings.Path) && + BetterMatch = ((CustomEntry.settings.Path.notEmpty()) && CustomPath.isEqual(CustomEntry.settings.Path) && ((Custom.settings.VolumeType == CustomEntry.settings.VolumeType) || ((1ull<DiskKind) & Custom.settings.VolumeType) != 0)); } else if (Custom.settings.VolumeType != CustomEntry.settings.VolumeType) { @@ -2189,7 +2189,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, // Duplicate volume match } else if (Custom.settings.Path != CustomEntry.settings.Path) { // Better path match - BetterMatch = ((CustomEntry.settings.Path.notEmpty()) && CustomPath.equal(CustomEntry.settings.Path) && + BetterMatch = ((CustomEntry.settings.Path.notEmpty()) && CustomPath.isEqual(CustomEntry.settings.Path) && ((Custom.settings.VolumeType == CustomEntry.settings.VolumeType) || ((1ull<DiskKind) & Custom.settings.VolumeType) != 0)); // Duplicate path match @@ -2208,7 +2208,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, // Less precise path match BetterMatch = ((Custom.settings.VolumeType != CustomEntry.settings.VolumeType) && ((1ull<DiskKind) & Custom.settings.VolumeType) != 0); - } else if (CustomPath.equal(CustomEntry.settings.Path)) { + } else if (CustomPath.isEqual(CustomEntry.settings.Path)) { if (Custom.settings.Path.isEmpty()) { // More precise path and volume type match BetterMatch = ((Custom.settings.VolumeType == CustomEntry.settings.VolumeType) || diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp index 234728a7c..48550dbdf 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp @@ -646,7 +646,7 @@ UINTN REFIT_MENU_SCREEN::InputDialog() break; case MENU_EXIT_ESCAPE: - if ( !Item->SValue.equal(Backup) ) { + if ( !Item->SValue.isEqual(Backup) ) { Item->SValue = Backup; if (Item->ItemType != BoolValue) { Item->LineShift = BackupShift; diff --git a/rEFIt_UEFI/libeg/VectorGraphics.cpp b/rEFIt_UEFI/libeg/VectorGraphics.cpp index 65f3c20fe..2b7efbb7b 100755 --- a/rEFIt_UEFI/libeg/VectorGraphics.cpp +++ b/rEFIt_UEFI/libeg/VectorGraphics.cpp @@ -379,18 +379,18 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer) Dict2 = GetProperty(Dict3, "ScreenEdgeX"); if (Dict2 != NULL && (Dict2->isString()) && Dict2->getString()->stringValue().notEmpty() ) { - if (Dict2->getString()->stringValue().equal("left")) { + if (Dict2->getString()->stringValue().isEqual("left")) { NewFilm->ScreenEdgeHorizontal = SCREEN_EDGE_LEFT; - } else if (Dict2->getString()->stringValue().equal("right")) { + } else if (Dict2->getString()->stringValue().isEqual("right")) { NewFilm->ScreenEdgeHorizontal = SCREEN_EDGE_RIGHT; } } Dict2 = GetProperty(Dict3, "ScreenEdgeY"); if (Dict2 != NULL && (Dict2->isString()) && Dict2->getString()->stringValue().notEmpty() ) { - if (Dict2->getString()->stringValue().equal("top")) { + if (Dict2->getString()->stringValue().isEqual("top")) { NewFilm->ScreenEdgeVertical = SCREEN_EDGE_TOP; - } else if (Dict2->getString()->stringValue().equal("bottom")) { + } else if (Dict2->getString()->stringValue().isEqual("bottom")) { NewFilm->ScreenEdgeVertical = SCREEN_EDGE_BOTTOM; } } diff --git a/rEFIt_UEFI/libeg/XTheme.cpp b/rEFIt_UEFI/libeg/XTheme.cpp index 5fe019509..fe33d5e47 100644 --- a/rEFIt_UEFI/libeg/XTheme.cpp +++ b/rEFIt_UEFI/libeg/XTheme.cpp @@ -221,7 +221,7 @@ finish: } for (i = 0; i < ThemeNameArray.size(); i++) { - if ( ThemeX.Theme.equalIC(ThemeNameArray[i]) ) { + if ( ThemeX.Theme.isEqualIC(ThemeNameArray[i]) ) { OldChosenTheme = i; break; } @@ -453,18 +453,18 @@ XTheme::GetThemeTagSettings(const TagDict* DictPointer) Prop2 = Dict->propertyForKey("ScreenEdgeX"); if (Prop2 != NULL && (Prop2->isString()) && Prop2->getString()->stringValue().notEmpty() ) { - if (Prop2->getString()->stringValue().equal("left")) { + if (Prop2->getString()->stringValue().isEqual("left")) { BannerEdgeHorizontal = SCREEN_EDGE_LEFT; - } else if (Prop2->getString()->stringValue().equal("right")) { + } else if (Prop2->getString()->stringValue().isEqual("right")) { BannerEdgeHorizontal = SCREEN_EDGE_RIGHT; } } Prop2 = Dict->propertyForKey("ScreenEdgeY"); if (Prop2 != NULL && (Prop2->isString()) && Prop2->getString()->stringValue().notEmpty() ) { - if (Prop2->getString()->stringValue().equal("top")) { + if (Prop2->getString()->stringValue().isEqual("top")) { BannerEdgeVertical = SCREEN_EDGE_TOP; - } else if (Prop2->getString()->stringValue().equal("bottom")) { + } else if (Prop2->getString()->stringValue().isEqual("bottom")) { BannerEdgeVertical = SCREEN_EDGE_BOTTOM; } } @@ -697,18 +697,18 @@ XTheme::GetThemeTagSettings(const TagDict* DictPointer) Prop = Dict3->propertyForKey("ScreenEdgeX"); if (Prop != NULL && (Prop->isString()) && Prop->getString()->stringValue().notEmpty() ) { - if (Prop->getString()->stringValue().equal("left")) { + if (Prop->getString()->stringValue().isEqual("left")) { NewFilm->ScreenEdgeHorizontal = SCREEN_EDGE_LEFT; - } else if (Prop->getString()->stringValue().equal("right")) { + } else if (Prop->getString()->stringValue().isEqual("right")) { NewFilm->ScreenEdgeHorizontal = SCREEN_EDGE_RIGHT; } } Prop = Dict3->propertyForKey("ScreenEdgeY"); if (Prop != NULL && (Prop->isString()) && Prop->getString()->stringValue().notEmpty() ) { - if (Prop->getString()->stringValue().equal("top")) { + if (Prop->getString()->stringValue().isEqual("top")) { NewFilm->ScreenEdgeVertical = SCREEN_EDGE_TOP; - } else if (Prop->getString()->stringValue().equal("bottom")) { + } else if (Prop->getString()->stringValue().isEqual("bottom")) { NewFilm->ScreenEdgeVertical = SCREEN_EDGE_BOTTOM; } } diff --git a/rEFIt_UEFI/libeg/libeg.h b/rEFIt_UEFI/libeg/libeg.h index eec2e0868..b96b0a822 100755 --- a/rEFIt_UEFI/libeg/libeg.h +++ b/rEFIt_UEFI/libeg/libeg.h @@ -121,6 +121,18 @@ public: UINT32 IValue = 0; XStringW SValue = XStringW(); UINTN LineShift = 0; + + bool operator == (const INPUT_ITEM& other) const + { + if ( !(ItemType == other.ItemType ) ) return false; + if ( !(Valid == other.Valid ) ) return false; + if ( !(BValue == other.BValue ) ) return false; + if ( !(IValue == other.IValue ) ) return false; + if ( !(SValue == other.SValue ) ) return false; + if ( !(LineShift == other.LineShift ) ) return false; + return true; + } + bool operator != (const INPUT_ITEM& other) const { return !(*this == other); } }; typedef struct { diff --git a/rEFIt_UEFI/refit/lib.cpp b/rEFIt_UEFI/refit/lib.cpp index ef13d8cf3..a4e81fe9e 100644 --- a/rEFIt_UEFI/refit/lib.cpp +++ b/rEFIt_UEFI/refit/lib.cpp @@ -850,7 +850,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume) FreePool(RootInfo); } } - if ( Volume->VolName.isEmpty() || Volume->VolName.equal("\\") || Volume->VolName.equal(L"/") ) + if ( Volume->VolName.isEmpty() || Volume->VolName.isEqual("\\") || Volume->VolName.isEqual(L"/") ) { void *Instance; if (!EFI_ERROR(gBS->HandleProtocol(Volume->DeviceHandle, &gEfiPartTypeSystemPartGuid, &Instance))) { @@ -1207,7 +1207,7 @@ REFIT_VOLUME *FindVolumeByName(IN CONST CHAR16 *VolName) if (!Volume) { continue; } - if (Volume->VolName.equal(VolName) == 0) { + if (Volume->VolName.isEqual(VolName) == 0) { return Volume; } } diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index 5a4ecabdf..78163e4b6 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -707,7 +707,7 @@ void LOADER_ENTRY::DelegateKernelPatches() for (size_t kextPatchIdx = 0 ; kextPatchIdx < selectedPathArray.size() ; kextPatchIdx++ ) { const ABSTRACT_KEXT_OR_KERNEL_PATCH& kextPatch = selectedPathArray[kextPatchIdx]; //as well as kernel patches - DBG("Bridge %s patch to OC : %s\n", kextPatch.Name.c_str(), kextPatch.Label.c_str()); + DBG("Bridge %s patch to OC : %s\n", kextPatch.getName().c_str(), kextPatch.Label.c_str()); mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx] = (__typeof_am__(*mOpenCoreConfiguration.Kernel.Patch.Values))AllocateZeroPool(mOpenCoreConfiguration.Kernel.Patch.ValueSize); // sizeof(OC_KERNEL_ADD_ENTRY) == 680 OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Arch, OC_BLOB_GET(&mOpenCoreConfiguration.Kernel.Scheme.KernelArch)); OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Base, kextPatch.ProcedureName.c_str()); @@ -716,7 +716,7 @@ void LOADER_ENTRY::DelegateKernelPatches() mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Enabled = 1; OC_STRING_ASSIGN_N(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Find, kextPatch.Find.data(), kextPatch.Find.size()); - OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Identifier, kextPatch.Name.c_str()); + OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Identifier, kextPatch.getName().c_str()); mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Limit = (UINT32)kextPatch.SearchLen; OC_STRING_ASSIGN_N(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Mask, kextPatch.MaskFind.vdata(), kextPatch.MaskFind.size()); OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->MaxKernel, ""); // it has been filtered, so we don't need to set Min and MaxKernel @@ -993,8 +993,26 @@ void LOADER_ENTRY::StartLoader() mOpenCoreConfiguration.Booter.MmioWhitelist.Values[idx]->Enabled = entry.enabled; } - static_assert(sizeof(gSettings.Quirks.ocBooterQuirks) == sizeof(mOpenCoreConfiguration.Booter.Quirks), "sizeof(gSettings.Quirks.ocBooterQuirks) == sizeof(mOpenCoreConfiguration.Booter.Quirks)"); - memcpy(&mOpenCoreConfiguration.Booter.Quirks, &gSettings.Quirks.ocBooterQuirks, sizeof(mOpenCoreConfiguration.Booter.Quirks)); + // It's possible to memcpy the whole struct instead of assigning individual member. But that would be relying on internel C++ binary structure, + // and worse, if a field is added by OC, everything could be shifted. + memset(&mOpenCoreConfiguration.Booter.Quirks, 0, sizeof(mOpenCoreConfiguration.Booter.Quirks)); + mOpenCoreConfiguration.Booter.Quirks.AvoidRuntimeDefrag = gSettings.Quirks.OcBooterQuirks.AvoidRuntimeDefrag; + mOpenCoreConfiguration.Booter.Quirks.DevirtualiseMmio = gSettings.Quirks.OcBooterQuirks.DevirtualiseMmio; + mOpenCoreConfiguration.Booter.Quirks.DisableSingleUser = gSettings.Quirks.OcBooterQuirks.DisableSingleUser; + mOpenCoreConfiguration.Booter.Quirks.DisableVariableWrite = gSettings.Quirks.OcBooterQuirks.DisableVariableWrite; + mOpenCoreConfiguration.Booter.Quirks.DiscardHibernateMap = gSettings.Quirks.OcBooterQuirks.DiscardHibernateMap; + mOpenCoreConfiguration.Booter.Quirks.EnableSafeModeSlide = gSettings.Quirks.OcBooterQuirks.EnableSafeModeSlide; + mOpenCoreConfiguration.Booter.Quirks.EnableWriteUnprotector = gSettings.Quirks.OcBooterQuirks.EnableWriteUnprotector; + mOpenCoreConfiguration.Booter.Quirks.ForceExitBootServices = gSettings.Quirks.OcBooterQuirks.ForceExitBootServices; + mOpenCoreConfiguration.Booter.Quirks.ProtectMemoryRegions = gSettings.Quirks.OcBooterQuirks.ProtectMemoryRegions; + mOpenCoreConfiguration.Booter.Quirks.ProtectSecureBoot = gSettings.Quirks.OcBooterQuirks.ProtectSecureBoot; + mOpenCoreConfiguration.Booter.Quirks.ProtectUefiServices = gSettings.Quirks.OcBooterQuirks.ProtectUefiServices; + mOpenCoreConfiguration.Booter.Quirks.ProvideCustomSlide = gSettings.Quirks.OcBooterQuirks.ProvideCustomSlide; + mOpenCoreConfiguration.Booter.Quirks.ProvideMaxSlide = gSettings.Quirks.OcBooterQuirks.ProvideMaxSlide; + mOpenCoreConfiguration.Booter.Quirks.RebuildAppleMemoryMap = gSettings.Quirks.OcBooterQuirks.RebuildAppleMemoryMap; + mOpenCoreConfiguration.Booter.Quirks.SetupVirtualMap = gSettings.Quirks.OcBooterQuirks.SetupVirtualMap; + mOpenCoreConfiguration.Booter.Quirks.SignalAppleOS = gSettings.Quirks.OcBooterQuirks.SignalAppleOS; + mOpenCoreConfiguration.Booter.Quirks.SyncRuntimePermissions = gSettings.Quirks.OcBooterQuirks.SyncRuntimePermissions; #endif @@ -1016,9 +1034,27 @@ void LOADER_ENTRY::StartLoader() OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Scheme.KernelArch, "x86_64"); OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Scheme.KernelCache, gSettings.Quirks.OcKernelCache.c_str()); mOpenCoreConfiguration.Kernel.Scheme.FuzzyMatch = gSettings.Quirks.FuzzyMatch; - gSettings.Quirks.OcKernelQuirks.AppleXcpmCfgLock = GlobalConfig.KPKernelPm; - gSettings.Quirks.OcKernelQuirks.AppleCpuPmCfgLock = GlobalConfig.KPAppleIntelCPUPM; - memcpy(&mOpenCoreConfiguration.Kernel.Quirks, &gSettings.Quirks.OcKernelQuirks, sizeof(mOpenCoreConfiguration.Kernel.Quirks)); + + memset(&mOpenCoreConfiguration.Kernel.Quirks, 0, sizeof(mOpenCoreConfiguration.Kernel.Quirks)); + mOpenCoreConfiguration.Kernel.Quirks.AppleCpuPmCfgLock = GlobalConfig.KPAppleIntelCPUPM; + mOpenCoreConfiguration.Kernel.Quirks.AppleXcpmCfgLock = GlobalConfig.KPKernelPm; + mOpenCoreConfiguration.Kernel.Quirks.AppleXcpmExtraMsrs = gSettings.Quirks.OcKernelQuirks.AppleXcpmExtraMsrs; + mOpenCoreConfiguration.Kernel.Quirks.AppleXcpmForceBoost = gSettings.Quirks.OcKernelQuirks.AppleXcpmForceBoost; + #ifndef USE_OC_SECTION_PlatformInfo + mOpenCoreConfiguration.Kernel.Quirks.CustomSmbiosGuid = gSettings.KernelAndKextPatches.KPDELLSMBIOS; + #endif + mOpenCoreConfiguration.Kernel.Quirks.DisableIoMapper = gSettings.Quirks.OcKernelQuirks.DisableIoMapper; + mOpenCoreConfiguration.Kernel.Quirks.DisableLinkeditJettison = gSettings.Quirks.OcKernelQuirks.DisableLinkeditJettison; + mOpenCoreConfiguration.Kernel.Quirks.DisableRtcChecksum = gSettings.KernelAndKextPatches.KPAppleRTC; + mOpenCoreConfiguration.Kernel.Quirks.DummyPowerManagement = gSettings.Quirks.OcKernelQuirks.DummyPowerManagement; + mOpenCoreConfiguration.Kernel.Quirks.ExternalDiskIcons = gSettings.Quirks.OcKernelQuirks.ExternalDiskIcons; + mOpenCoreConfiguration.Kernel.Quirks.IncreasePciBarSize = gSettings.Quirks.OcKernelQuirks.IncreasePciBarSize; + mOpenCoreConfiguration.Kernel.Quirks.LapicKernelPanic = gSettings.KernelAndKextPatches.KPKernelLapic; + mOpenCoreConfiguration.Kernel.Quirks.PanicNoKextDump = gSettings.KernelAndKextPatches.KPPanicNoKextDump; + mOpenCoreConfiguration.Kernel.Quirks.PowerTimeoutKernelPanic = gSettings.Quirks.OcKernelQuirks.PowerTimeoutKernelPanic; + mOpenCoreConfiguration.Kernel.Quirks.ThirdPartyDrives = gSettings.Quirks.OcKernelQuirks.ThirdPartyDrives; + mOpenCoreConfiguration.Kernel.Quirks.XhciPortLimit = gSettings.Quirks.OcKernelQuirks.XhciPortLimit; + mOpenCoreConfiguration.Kernel.Add.Count = (UINT32)kextArray.size(); mOpenCoreConfiguration.Kernel.Add.AllocCount = mOpenCoreConfiguration.Kernel.Add.Count; @@ -1127,9 +1163,6 @@ void LOADER_ENTRY::StartLoader() } #endif - #ifndef USE_OC_SECTION_PlatformInfo - mOpenCoreConfiguration.Kernel.Quirks.CustomSmbiosGuid = gSettings.KernelAndKextPatches.KPDELLSMBIOS; - #endif mOpenCoreConfiguration.Uefi.Output.ProvideConsoleGop = gSettings.GUI.ProvideConsoleGop; OC_STRING_ASSIGN(mOpenCoreConfiguration.Uefi.Output.Resolution, XString8(gSettings.GUI.ScreenResolution).c_str()); @@ -2441,7 +2474,7 @@ GetListOfDsdts() if (DirEntry->FileName[0] == L'.') { continue; } - if ( gSettings.ACPI.DSDT.DsdtName.equalIC(DirEntry->FileName) ) { + if ( gSettings.ACPI.DSDT.DsdtName.isEqualIC(DirEntry->FileName) ) { OldChosenDsdt = DsdtsNum; } NameLen = StrLen(DirEntry->FileName); //with ".aml" @@ -2478,7 +2511,7 @@ GetListOfACPI() INTN Count = gSettings.ACPI.DisabledAML.size(); for (INTN i = 0; i < Count; i++) { - if ( gSettings.ACPI.DisabledAML[i].equalIC(ACPIPatchedAMLTmp->FileName) ) { + if ( gSettings.ACPI.DisabledAML[i].isEqualIC(ACPIPatchedAMLTmp->FileName) ) { // if ((gSettings.ACPI.DisabledAML[i] != NULL) && // (StriCmp(ACPIPatchedAMLTmp->FileName, gSettings.ACPI.DisabledAML[i]) == 0) // ) { @@ -2663,7 +2696,7 @@ void afterGetUserSettings(SETTINGS_DATA& gSettings) OldChosenTheme = 0xFFFF; //default for embedded for (UINTN i = 0; i < ThemeNameArray.size(); i++) { //now comparison is case sensitive - if ( gSettings.GUI.Theme.equalIC(ThemeNameArray[i]) ) { + if ( gSettings.GUI.Theme.isEqualIC(ThemeNameArray[i]) ) { OldChosenTheme = i; break; } @@ -2706,9 +2739,9 @@ void afterGetUserSettings(SETTINGS_DATA& gSettings) GlobalConfig.KPKernelPm = gSettings.KernelAndKextPatches._KPKernelPm || GlobalConfig.NeedPMfix; GlobalConfig.KPAppleIntelCPUPM = gSettings.KernelAndKextPatches._KPAppleIntelCPUPM || GlobalConfig.NeedPMfix; - if ( gSettings.RtVariables.RtROMAsString.equalIC("UseMacAddr0") ) { + if ( gSettings.RtVariables.RtROMAsString.isEqualIC("UseMacAddr0") ) { GlobalConfig.RtROM.ncpy(&gLanMac[0][0], 6); - } else if ( gSettings.RtVariables.RtROMAsString.equalIC("UseMacAddr1") ) { + } else if ( gSettings.RtVariables.RtROMAsString.isEqualIC("UseMacAddr1") ) { GlobalConfig.RtROM.ncpy(&gLanMac[1][0], 6); }else{ GlobalConfig.RtROM = gSettings.RtVariables.RtROMAsData; diff --git a/rEFIt_UEFI/refit/menu.cpp b/rEFIt_UEFI/refit/menu.cpp index 3f542e5a4..a8d22865b 100644 --- a/rEFIt_UEFI/refit/menu.cpp +++ b/rEFIt_UEFI/refit/menu.cpp @@ -231,7 +231,7 @@ void FillInputs(BOOLEAN New) if (gGraphics[i].Vendor == Nvidia) { InputItems[InputItemsCount].ItemType = ASString; //24+6i - for (j=0; j<20; j++) { + for (j=0; j