This commit is contained in:
SergeySlice 2021-04-11 13:53:39 +03:00
commit 1d6a7ae9d3
32 changed files with 1554 additions and 478 deletions

View File

@ -11,9 +11,11 @@
Set of Search & replace bytes for VideoBiosPatchBytes(). Set of Search & replace bytes for VideoBiosPatchBytes().
**/ **/
typedef struct _VBIOS_PATCH_BYTES { typedef struct _VBIOS_PATCH_BYTES {
VOID *Find; JCONST VOID *Find;
VOID *Replace; JCONST VOID *Replace;
UINTN NumberOfBytes; UINTN NumberOfBytes;
} VBIOS_PATCH_BYTES; } VBIOS_PATCH_BYTES;

View File

@ -49,7 +49,7 @@ EFI_GUID *APFSPartitionUUIDExtract(
} }
if (DevicePathType(DevicePath) == MEDIA_DEVICE_PATH && DevicePathSubType (DevicePath) == MEDIA_VENDOR_DP) { if (DevicePathType(DevicePath) == MEDIA_DEVICE_PATH && DevicePathSubType (DevicePath) == MEDIA_VENDOR_DP) {
//Check that vendor-assigned GUID defines APFS Container Partition //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); return (EFI_GUID *)((UINT8 *)DevicePath+0x14);
} }
} }

View File

@ -371,10 +371,10 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
} }
// ->GetVariable(flagstate, gEfiAppleBootGuid, 0/0, 20, 10FE110) = Not Found // ->GetVariable(flagstate, gEfiAppleBootGuid, 0/0, 20, 10FE110) = Not Found
if (gSettings.BootGraphics.flagstate[3] == 0x80) { if (GlobalConfig.flagstate[3] == 0x80) {
DeleteNvramVariable(L"flagstate", &gEfiAppleBootGuid); DeleteNvramVariable(L"flagstate", &gEfiAppleBootGuid);
} else { } else {
SetNvramVariable(L"flagstate", &gEfiAppleBootGuid, Attributes, 32, &gSettings.BootGraphics.flagstate); SetNvramVariable(L"flagstate", &gEfiAppleBootGuid, Attributes, 32, &GlobalConfig.flagstate);
} }
// Hack for recovery by Asgorath // Hack for recovery by Asgorath
@ -456,12 +456,12 @@ SetupDataForOSX(BOOLEAN Hibernate)
UINT64 ARTFrequency; UINT64 ARTFrequency;
UINTN Revision; UINTN Revision;
UINT16 Zero = 0; UINT16 Zero = 0;
BOOLEAN isRevLess = (gSettings.Smbios.REV[0] == 0 && BOOLEAN isRevLess = (ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[0] == 0 &&
gSettings.Smbios.REV[1] == 0 && ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[1] == 0 &&
gSettings.Smbios.REV[2] == 0 && ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[2] == 0 &&
gSettings.Smbios.REV[3] == 0 && ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[3] == 0 &&
gSettings.Smbios.REV[4] == 0 && ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[4] == 0 &&
gSettings.Smbios.REV[5] == 0); ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[5] == 0);
Revision = StrDecimalToUintn(gFirmwareRevision); Revision = StrDecimalToUintn(gFirmwareRevision);
@ -493,6 +493,11 @@ SetupDataForOSX(BOOLEAN Hibernate)
CpuSpeed = gCPUStructure.CPUFrequency; CpuSpeed = gCPUStructure.CPUFrequency;
gSettings.CPU.CpuFreqMHz = (UINT32)DivU64x32(CpuSpeed, Mega); 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 // Locate DataHub Protocol
Status = gBS->LocateProtocol(&gEfiDataHubProtocolGuid, NULL, (void**)&gDataHub); Status = gBS->LocateProtocol(&gEfiDataHubProtocolGuid, NULL, (void**)&gDataHub);
if (!EFI_ERROR(Status)) { if (!EFI_ERROR(Status)) {
@ -538,11 +543,11 @@ SetupDataForOSX(BOOLEAN Hibernate)
// SMC helper // SMC helper
if (!isRevLess) { if (!isRevLess) {
LogDataHub(&gEfiMiscSubClassGuid, L"RBr", &gSettings.Smbios.RBr, 8); LogDataHub(&gEfiMiscSubClassGuid, L"RBr", &RBr, 8);
LogDataHub(&gEfiMiscSubClassGuid, L"EPCI", &gSettings.Smbios.EPCI, 4); LogDataHub(&gEfiMiscSubClassGuid, L"EPCI", &ApplePlatformData[GlobalConfig.CurrentModel].smcConfig, 4);
LogDataHub(&gEfiMiscSubClassGuid, L"REV", &gSettings.Smbios.REV, 6); 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); LogDataHub(&gEfiMiscSubClassGuid, L"BEMB", &gSettings.Smbios.Mobile, 1);
// all current settings // all current settings
@ -555,11 +560,11 @@ SetupDataForOSX(BOOLEAN Hibernate)
return; return;
} }
if (!isRevLess) { if (!isRevLess) {
AddSMCkey(SMC_MAKE_KEY('R','B','r',' '), 8, SmcKeyTypeCh8, (SMC_DATA *)&gSettings.Smbios.RBr); AddSMCkey(SMC_MAKE_KEY('R','B','r',' '), 8, SmcKeyTypeCh8, (SMC_DATA *)&RBr);
AddSMCkey(SMC_MAKE_KEY('E','P','C','I'), 4, SmcKeyTypeUint32, (SMC_DATA *)&gSettings.Smbios.EPCI); 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 *)&gSettings.Smbios.REV); 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); 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(?) //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 //they are needed for FileVault2 who want to draw battery status

View File

@ -21,7 +21,6 @@ class ABSTRACT_PATCH
{ {
public: public:
bool Disabled = bool(); bool Disabled = bool();
// XString8 Comment = XString8();
XBuffer<UINT8> Find = XBuffer<UINT8> (); XBuffer<UINT8> Find = XBuffer<UINT8> ();
XBuffer<UINT8> Replace = XBuffer<UINT8> (); XBuffer<UINT8> Replace = XBuffer<UINT8> ();
XBuffer<UINT8> MaskFind = XBuffer<UINT8> (); XBuffer<UINT8> MaskFind = XBuffer<UINT8> ();
@ -33,23 +32,58 @@ public:
INTN Skip = INTN(); INTN Skip = INTN();
XString8 MatchOS = XString8(); XString8 MatchOS = XString8();
XString8 MatchBuild = XString8(); XString8 MatchBuild = XString8();
INPUT_ITEM MenuItem = INPUT_ITEM();
// Computed // Computed
XString8 Name = XString8(); virtual XString8 getName() const = 0;
XString8 Label = XString8(); // TODO : it's a calculated value from comment field. 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. */ /** Returns a boolean and then enable disable the patch if MachOSEntry have a match for the booted OS. */
bool IsPatchEnabledByBuildNumber(const XString8& Build); bool IsPatchEnabledByBuildNumber(const XString8& Build);
bool IsPatchEnabled(const MacOsVersion& CurrOS); bool IsPatchEnabled(const MacOsVersion& CurrOS);
}; };
class ABSTRACT_KEXT_OR_KERNEL_PATCH : public ABSTRACT_PATCH class ABSTRACT_KEXT_OR_KERNEL_PATCH : public ABSTRACT_PATCH
{ {
public: public:
bool IsPlistPatch = BOOLEAN();
XString8 ProcedureName = XString8(); //procedure len will be StartPatternLen 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 class KEXT_PATCH : public ABSTRACT_KEXT_OR_KERNEL_PATCH
{ {
public: public:
XString8 Name = XString8();
bool IsPlistPatch = BOOLEAN(); 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 class KERNEL_PATCH : public ABSTRACT_KEXT_OR_KERNEL_PATCH
{ {
public: 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 class BOOT_PATCH : public ABSTRACT_PATCH
{ {
public: 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 class KERNEL_AND_KEXT_PATCHES
@ -89,10 +156,37 @@ public:
XString8 KPATIConnectorsController = XString8(); XString8 KPATIConnectorsController = XString8();
XBuffer<UINT8> KPATIConnectorsData = XBuffer<UINT8>(); XBuffer<UINT8> KPATIConnectorsData = XBuffer<UINT8>();
XBuffer<UINT8> KPATIConnectorsPatch = XBuffer<UINT8>(); XBuffer<UINT8> KPATIConnectorsPatch = XBuffer<UINT8>();
XStringWArray ForceKextsToLoad = XStringWArray(); XStringWArray ForceKextsToLoad/* = XStringWArray()*/;
XObjArray<KEXT_PATCH> KextPatches = XObjArray<KEXT_PATCH>(); XObjArray<KEXT_PATCH> KextPatches/* = XObjArray<KEXT_PATCH>()*/;
XObjArray<KERNEL_PATCH> KernelPatches = XObjArray<KERNEL_PATCH>(); XObjArray<KERNEL_PATCH> KernelPatches/* = XObjArray<KERNEL_PATCH>()*/;
XObjArray<BOOT_PATCH> BootPatches = XObjArray<BOOT_PATCH>(); XObjArray<BOOT_PATCH> BootPatches/* = XObjArray<BOOT_PATCH>()*/;
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;
}
} ; } ;

View File

@ -1242,7 +1242,7 @@ FindStartupDiskVolume (
DBG(" checking '%ls'\n", DevicePathToXStringW(Volume->DevicePath).wc_str()); DBG(" checking '%ls'\n", DevicePathToXStringW(Volume->DevicePath).wc_str());
DBG(" '%ls'\n", LoaderPath.wc_str()); DBG(" '%ls'\n", LoaderPath.wc_str());
// case insensitive cmp // case insensitive cmp
if ( LoaderPath.equalIC(gEfiBootLoaderPath) ) { if ( LoaderPath.isEqualIC(gEfiBootLoaderPath) ) {
// that's the one // that's the one
DBG(" - found entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName.wc_str(), LoaderPath.wc_str()); DBG(" - found entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName.wc_str(), LoaderPath.wc_str());
return Index; return Index;

View File

@ -85,7 +85,7 @@ EFI_STATUS Self::_initialize()
m_efiFileName = m_CloverDirFullPath.basename(); m_efiFileName = m_CloverDirFullPath.basename();
// History : if this Clover was started as BootX64.efi, redirect to /EFI/CLOVER // 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"); m_CloverDirFullPath.takeValueFrom("\\EFI\\CLOVER\\CloverX64.efi");
} }
#ifdef DEBUG #ifdef DEBUG

View File

@ -282,8 +282,8 @@ const XString8& CUSTOM_LOADER_SUBENTRY::getFullTitle() const {
bool SETTINGS_DATA::GUIClass::getDarkEmbedded(bool isDaylight) const { bool SETTINGS_DATA::GUIClass::getDarkEmbedded(bool isDaylight) const {
if ( EmbeddedThemeType.equalIC("Dark") ) return true; if ( EmbeddedThemeType.isEqualIC("Dark") ) return true;
if ( EmbeddedThemeType.equalIC("Daytime") ) return !isDaylight; if ( EmbeddedThemeType.isEqualIC("Daytime") ) return !isDaylight;
return false; return false;
} }
@ -1183,7 +1183,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
} }
DBG(" %s", newKernelPatch.Label.c_str()); DBG(" %s", newKernelPatch.Label.c_str());
newKernelPatch.Name = "kernel"_XS8; // newKernelPatch.Name = "kernel"_XS8;
prop3 = Prop2->propertyForKey("Disabled"); prop3 = Prop2->propertyForKey("Disabled");
newKernelPatch.Disabled = IsPropertyNotNullAndTrue(prop3); newKernelPatch.Disabled = IsPropertyNotNullAndTrue(prop3);
@ -1316,7 +1316,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
} }
DBG(" %s", newBootPatch.Label.c_str()); DBG(" %s", newBootPatch.Label.c_str());
newBootPatch.Name = "boot.efi"_XS8; // newBootPatch.Name = "boot.efi"_XS8;
prop3 = Prop2->propertyForKey("Disabled"); prop3 = Prop2->propertyForKey("Disabled");
newBootPatch.Disabled = IsPropertyNotNullAndTrue(prop3); 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() > 0 && currOStoc.size() > 0 && osToc[0] == "11"_XS8 && currOStoc[0] == "11"_XS8 ) {
// if (osToc.size() == 1 ) return true; // if (osToc.size() == 1 ) return true;
// if (osToc.size() == 2 ) { // 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; // if ( currOStoc.size() == 2 && osToc[1] == currOStoc[1] ) return true;
// } // }
// } // }
@ -1448,7 +1448,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
// ret = TRUE; // ret = TRUE;
// } else if ( osToc[0] == currOStoc[0] // } else if ( osToc[0] == currOStoc[0]
// && osToc[1] == currOStoc[1] // && osToc[1] == currOStoc[1]
// && osToc[2].equalIC("x") ) { // && osToc[2].isEqualIC("x") ) {
// ret = TRUE; // ret = TRUE;
// } // }
// } else if (currOStoc.size() == 2) { // } else if (currOStoc.size() == 2) {
@ -1457,7 +1457,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
// ret = TRUE; // ret = TRUE;
// } else if ( osToc[0] == currOStoc[0] // } else if ( osToc[0] == currOStoc[0]
// && osToc[1] == currOStoc[1] // && osToc[1] == currOStoc[1]
// && osToc[2].equalIC("x") == 0 ) { // && osToc[2].isEqualIC("x") == 0 ) {
// ret = TRUE; // ret = TRUE;
// } // }
// } // }
@ -1472,13 +1472,13 @@ static UINT8 CheckVolumeType(UINT8 VolumeType, const TagStruct* Prop)
return 0; return 0;
} }
UINT8 VolumeTypeTmp = VolumeType; UINT8 VolumeTypeTmp = VolumeType;
if (Prop->getString()->stringValue().equalIC("Internal")) { if (Prop->getString()->stringValue().isEqualIC("Internal")) {
VolumeTypeTmp |= VOLTYPE_INTERNAL; VolumeTypeTmp |= VOLTYPE_INTERNAL;
} else if (Prop->getString()->stringValue().equalIC("External")) { } else if (Prop->getString()->stringValue().isEqualIC("External")) {
VolumeTypeTmp |= VOLTYPE_EXTERNAL; VolumeTypeTmp |= VOLTYPE_EXTERNAL;
} else if (Prop->getString()->stringValue().equalIC("Optical")) { } else if (Prop->getString()->stringValue().isEqualIC("Optical")) {
VolumeTypeTmp |= VOLTYPE_OPTICAL; VolumeTypeTmp |= VOLTYPE_OPTICAL;
} else if (Prop->getString()->stringValue().equalIC("FireWire")) { } else if (Prop->getString()->stringValue().isEqualIC("FireWire")) {
VolumeTypeTmp |= VOLTYPE_FIREWIRE; VolumeTypeTmp |= VOLTYPE_FIREWIRE;
} }
return VolumeTypeTmp; return VolumeTypeTmp;
@ -1611,11 +1611,11 @@ FillinCustomSubEntry (
// Entry->CustomLogoType = CUSTOM_BOOT_APPLE; // Entry->CustomLogoType = CUSTOM_BOOT_APPLE;
// } else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) { // } else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
// Entry->CustomLogoAsXString8 = Prop->getString()->stringValue(); // Entry->CustomLogoAsXString8 = Prop->getString()->stringValue();
// if (Prop->getString()->stringValue().equalIC("Apple")) { // if (Prop->getString()->stringValue().isEqualIC("Apple")) {
// Entry->CustomLogoType = CUSTOM_BOOT_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; // 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; // Entry->CustomLogoType = CUSTOM_BOOT_THEME;
// } else { // } else {
// XStringW customLogo = XStringW() = Prop->getString()->stringValue(); // XStringW customLogo = XStringW() = Prop->getString()->stringValue();
@ -1662,7 +1662,7 @@ FillinCustomSubEntry (
// Prop = DictPointer->propertyForKey("Hidden"); // Prop = DictPointer->propertyForKey("Hidden");
// if (Prop != NULL) { // if (Prop != NULL) {
// if ((Prop->isString()) && // if ((Prop->isString()) &&
// (Prop->getString()->stringValue().equalIC("Always"))) { // (Prop->getString()->stringValue().isEqualIC("Always"))) {
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED);
// } else if (IsPropertyNotNullAndTrue(Prop)) { // } else if (IsPropertyNotNullAndTrue(Prop)) {
// DBG(" hiding entry because Hidden flag is YES\n"); // DBG(" hiding entry because Hidden flag is YES\n");
@ -1674,20 +1674,20 @@ FillinCustomSubEntry (
// //
// Prop = DictPointer->propertyForKey("Type"); // Prop = DictPointer->propertyForKey("Type");
// if (Prop != NULL && (Prop->isString())) { // if (Prop != NULL && (Prop->isString())) {
// if ((Prop->getString()->stringValue().equalIC("OSX")) || // if ((Prop->getString()->stringValue().isEqualIC("OSX")) ||
// (Prop->getString()->stringValue().equalIC("macOS"))) { // (Prop->getString()->stringValue().isEqualIC("macOS"))) {
// Entry->Type = OSTYPE_OSX; // Entry->Type = OSTYPE_OSX;
// } else if (Prop->getString()->stringValue().equalIC("OSXInstaller")) { // } else if (Prop->getString()->stringValue().isEqualIC("OSXInstaller")) {
// Entry->Type = OSTYPE_OSX_INSTALLER; // Entry->Type = OSTYPE_OSX_INSTALLER;
// } else if (Prop->getString()->stringValue().equalIC("OSXRecovery")) { // } else if (Prop->getString()->stringValue().isEqualIC("OSXRecovery")) {
// Entry->Type = OSTYPE_RECOVERY; // Entry->Type = OSTYPE_RECOVERY;
// } else if (Prop->getString()->stringValue().equalIC("Windows")) { // } else if (Prop->getString()->stringValue().isEqualIC("Windows")) {
// Entry->Type = OSTYPE_WINEFI; // Entry->Type = OSTYPE_WINEFI;
// } else if (Prop->getString()->stringValue().equalIC("Linux")) { // } else if (Prop->getString()->stringValue().isEqualIC("Linux")) {
// Entry->Type = OSTYPE_LIN; // Entry->Type = OSTYPE_LIN;
//// TODO remove from here //// TODO remove from here
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NODEFAULTARGS); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NODEFAULTARGS);
// } else if (Prop->getString()->stringValue().equalIC("LinuxKernel")) { // } else if (Prop->getString()->stringValue().isEqualIC("LinuxKernel")) {
// Entry->Type = OSTYPE_LINEFI; // Entry->Type = OSTYPE_LINEFI;
// } else { // } else {
// DBG("** Warning: unknown custom entry Type '%s'\n", Prop->getString()->stringValue().c_str()); // DBG("** Warning: unknown custom entry Type '%s'\n", Prop->getString()->stringValue().c_str());
@ -1733,7 +1733,7 @@ FillinCustomSubEntry (
// } else if ( Prop->isFalseOrNn() ) { // } else if ( Prop->isFalseOrNn() ) {
// Entry->InjectKexts = 0; // Entry->InjectKexts = 0;
// // nothing to do // // nothing to do
// } else if ( Prop->isString() && Prop->getString()->stringValue().equalIC("Detect") ) { // } else if ( Prop->isString() && Prop->getString()->stringValue().isEqualIC("Detect") ) {
// Entry->InjectKexts = 2; // Entry->InjectKexts = 2;
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_CHECKFAKESMC); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_CHECKFAKESMC);
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS);
@ -1958,11 +1958,11 @@ FillinCustomEntry (
Entry->CustomLogoTypeSettings = CUSTOM_BOOT_APPLE; Entry->CustomLogoTypeSettings = CUSTOM_BOOT_APPLE;
} else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) { } else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
Entry->CustomLogoAsXString8 = Prop->getString()->stringValue(); Entry->CustomLogoAsXString8 = Prop->getString()->stringValue();
if (Prop->getString()->stringValue().equalIC("Apple")) { if (Prop->getString()->stringValue().isEqualIC("Apple")) {
Entry->CustomLogoTypeSettings = CUSTOM_BOOT_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; 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; Entry->CustomLogoTypeSettings = CUSTOM_BOOT_THEME;
} else { } else {
XStringW customLogo = XStringW() = Prop->getString()->stringValue(); XStringW customLogo = XStringW() = Prop->getString()->stringValue();
@ -2009,7 +2009,7 @@ FillinCustomEntry (
Prop = DictPointer->propertyForKey("Hidden"); Prop = DictPointer->propertyForKey("Hidden");
if (Prop != NULL) { if (Prop != NULL) {
if ((Prop->isString()) && if ((Prop->isString()) &&
(Prop->getString()->stringValue().equalIC("Always"))) { (Prop->getString()->stringValue().isEqualIC("Always"))) {
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED);
Entry->AlwaysHidden = true; Entry->AlwaysHidden = true;
} else if (IsPropertyNotNullAndTrue(Prop)) { } else if (IsPropertyNotNullAndTrue(Prop)) {
@ -2020,19 +2020,19 @@ FillinCustomEntry (
Prop = DictPointer->propertyForKey("Type"); Prop = DictPointer->propertyForKey("Type");
if (Prop != NULL && (Prop->isString())) { if (Prop != NULL && (Prop->isString())) {
if ((Prop->getString()->stringValue().equalIC("OSX")) || if ((Prop->getString()->stringValue().isEqualIC("OSX")) ||
(Prop->getString()->stringValue().equalIC("macOS"))) { (Prop->getString()->stringValue().isEqualIC("macOS"))) {
Entry->Type = OSTYPE_OSX; Entry->Type = OSTYPE_OSX;
} else if (Prop->getString()->stringValue().equalIC("OSXInstaller")) { } else if (Prop->getString()->stringValue().isEqualIC("OSXInstaller")) {
Entry->Type = OSTYPE_OSX_INSTALLER; Entry->Type = OSTYPE_OSX_INSTALLER;
} else if (Prop->getString()->stringValue().equalIC("OSXRecovery")) { } else if (Prop->getString()->stringValue().isEqualIC("OSXRecovery")) {
Entry->Type = OSTYPE_RECOVERY; Entry->Type = OSTYPE_RECOVERY;
} else if (Prop->getString()->stringValue().equalIC("Windows")) { } else if (Prop->getString()->stringValue().isEqualIC("Windows")) {
Entry->Type = OSTYPE_WINEFI; Entry->Type = OSTYPE_WINEFI;
} else if (Prop->getString()->stringValue().equalIC("Linux")) { } else if (Prop->getString()->stringValue().isEqualIC("Linux")) {
Entry->Type = OSTYPE_LIN; Entry->Type = OSTYPE_LIN;
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NODEFAULTARGS); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NODEFAULTARGS);
} else if (Prop->getString()->stringValue().equalIC("LinuxKernel")) { } else if (Prop->getString()->stringValue().isEqualIC("LinuxKernel")) {
Entry->Type = OSTYPE_LINEFI; Entry->Type = OSTYPE_LINEFI;
} else { } else {
DBG("** Warning: unknown custom entry Type '%s'\n", Prop->getString()->stringValue().c_str()); DBG("** Warning: unknown custom entry Type '%s'\n", Prop->getString()->stringValue().c_str());
@ -2083,7 +2083,7 @@ FillinCustomEntry (
} else if ( Prop->isFalseOrNn() ) { } else if ( Prop->isFalseOrNn() ) {
Entry->InjectKexts = 0; Entry->InjectKexts = 0;
// nothing to do // nothing to do
} else if ( Prop->isString() && Prop->getString()->stringValue().equalIC("Detect") ) { } else if ( Prop->isString() && Prop->getString()->stringValue().isEqualIC("Detect") ) {
Entry->InjectKexts = 2; Entry->InjectKexts = 2;
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_CHECKFAKESMC); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_CHECKFAKESMC);
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS);
@ -2268,7 +2268,7 @@ FillingCustomLegacy (
Prop = DictPointer->propertyForKey("Hidden"); Prop = DictPointer->propertyForKey("Hidden");
if (Prop != NULL) { if (Prop != NULL) {
if ((Prop->isString()) && if ((Prop->isString()) &&
(Prop->getString()->stringValue().equalIC("Always"))) { (Prop->getString()->stringValue().isEqualIC("Always"))) {
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED);
Entry->AlwaysHidden = true; Entry->AlwaysHidden = true;
} else if (IsPropertyNotNullAndTrue(Prop)) { } else if (IsPropertyNotNullAndTrue(Prop)) {
@ -2281,9 +2281,9 @@ FillingCustomLegacy (
Prop = DictPointer->propertyForKey("Type"); Prop = DictPointer->propertyForKey("Type");
if (Prop != NULL && (Prop->isString())) { if (Prop != NULL && (Prop->isString())) {
if (Prop->getString()->stringValue().equalIC("Windows")) { if (Prop->getString()->stringValue().isEqualIC("Windows")) {
Entry->Type = OSTYPE_WIN; Entry->Type = OSTYPE_WIN;
} else if (Prop->getString()->stringValue().equalIC("Linux")) { } else if (Prop->getString()->stringValue().isEqualIC("Linux")) {
Entry->Type = OSTYPE_LIN; Entry->Type = OSTYPE_LIN;
} else { } else {
Entry->Type = OSTYPE_OTHER; Entry->Type = OSTYPE_OTHER;
@ -2370,7 +2370,7 @@ FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY_SETTINGS *Entry, const TagDict* Dict
Prop = DictPointer->propertyForKey("Hidden"); Prop = DictPointer->propertyForKey("Hidden");
if (Prop != NULL) { if (Prop != NULL) {
if ((Prop->isString()) && if ((Prop->isString()) &&
(Prop->getString()->stringValue().equalIC("Always"))) { (Prop->getString()->stringValue().isEqualIC("Always"))) {
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED);
Entry->AlwaysHidden = true; Entry->AlwaysHidden = true;
} else if (IsPropertyNotNullAndTrue(Prop)) { } else if (IsPropertyNotNullAndTrue(Prop)) {
@ -2519,7 +2519,7 @@ EFI_STATUS GetEarlyUserSettings (
if ( Prop->isString() && Prop->getString()->stringValue().notEmpty() ) { if ( Prop->isString() && Prop->getString()->stringValue().notEmpty() ) {
gSettings.Boot.DefaultVolume.setEmpty(); gSettings.Boot.DefaultVolume.setEmpty();
// check for special value for remembering boot volume // check for special value for remembering boot volume
if (Prop->getString()->stringValue().equalIC("LastBootedVolume")) { if (Prop->getString()->stringValue().isEqualIC("LastBootedVolume")) {
gSettings.Boot.LastBootedVolume = TRUE; gSettings.Boot.LastBootedVolume = TRUE;
} else { } else {
gSettings.Boot.DefaultVolume = Prop->getString()->stringValue(); gSettings.Boot.DefaultVolume = Prop->getString()->stringValue();
@ -2539,8 +2539,8 @@ EFI_STATUS GetEarlyUserSettings (
Prop = BootDict->propertyForKey("Debug"); Prop = BootDict->propertyForKey("Debug");
if ( Prop ) { if ( Prop ) {
if ( Prop->isString() ) { if ( Prop->isString() ) {
if ( Prop->getString()->stringValue().equalIC("true") ) gSettings.Boot.DebugLog = true; if ( Prop->getString()->stringValue().isEqualIC("true") ) gSettings.Boot.DebugLog = true;
else if ( Prop->getString()->stringValue().equalIC("false") ) gSettings.Boot.DebugLog = false; 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 MsgLog("MALFORMED config.plist : property Boot/Debug must be true, false, or scratch\n");
}else if ( Prop->isBool() ) { }else if ( Prop->isBool() ) {
gSettings.Boot.DebugLog = Prop->getBool()->boolValue(); gSettings.Boot.DebugLog = Prop->getBool()->boolValue();
@ -2722,11 +2722,11 @@ EFI_STATUS GetEarlyUserSettings (
gSettings.Boot.CustomLogoType = CUSTOM_BOOT_APPLE; gSettings.Boot.CustomLogoType = CUSTOM_BOOT_APPLE;
} else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) { } else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
gSettings.Boot.CustomLogoAsXString8 = Prop->getString()->stringValue(); gSettings.Boot.CustomLogoAsXString8 = Prop->getString()->stringValue();
if (Prop->getString()->stringValue().equalIC("Apple")) { if (Prop->getString()->stringValue().isEqualIC("Apple")) {
gSettings.Boot.CustomLogoType = CUSTOM_BOOT_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; 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; gSettings.Boot.CustomLogoType = CUSTOM_BOOT_THEME;
} else { } else {
gSettings.Boot.CustomLogoType = CUSTOM_BOOT_USER; gSettings.Boot.CustomLogoType = CUSTOM_BOOT_USER;
@ -2771,7 +2771,7 @@ EFI_STATUS GetEarlyUserSettings (
if (IsPropertyNotNullAndTrue(Prop)) { if (IsPropertyNotNullAndTrue(Prop)) {
gSettings.SystemParameters.WithKexts = TRUE; gSettings.SystemParameters.WithKexts = TRUE;
} else if ((Prop->isString()) && } else if ((Prop->isString()) &&
(Prop->getString()->stringValue().equalIC("Detect"))) { (Prop->getString()->stringValue().isEqualIC("Detect"))) {
// settingsData.WithKexts = TRUE; // settingsData.WithKexts = TRUE;
gSettings.SystemParameters.WithKextsIfNoFakeSMC = TRUE; gSettings.SystemParameters.WithKextsIfNoFakeSMC = TRUE;
} }
@ -2817,7 +2817,7 @@ EFI_STATUS GetEarlyUserSettings (
// OldChosenTheme = 0xFFFF; //default for embedded // OldChosenTheme = 0xFFFF; //default for embedded
// for (UINTN i = 0; i < ThemeNameArray.size(); i++) { // for (UINTN i = 0; i < ThemeNameArray.size(); i++) {
// //now comparison is case sensitive // //now comparison is case sensitive
// if ( gSettings.GUI.Theme.equalIC(ThemeNameArray[i]) ) { // if ( gSettings.GUI.Theme.isEqualIC(ThemeNameArray[i]) ) {
// OldChosenTheme = i; // OldChosenTheme = i;
// break; // break;
// } // }
@ -2827,13 +2827,13 @@ EFI_STATUS GetEarlyUserSettings (
Prop = GUIDict->propertyForKey("EmbeddedThemeType"); Prop = GUIDict->propertyForKey("EmbeddedThemeType");
if (Prop && (Prop->isString()) && Prop->getString()->stringValue().notEmpty()) { if (Prop && (Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
gSettings.GUI.EmbeddedThemeType = Prop->getString()->stringValue(); gSettings.GUI.EmbeddedThemeType = Prop->getString()->stringValue();
if (Prop->getString()->stringValue().equalIC("Dark")) { if (Prop->getString()->stringValue().isEqualIC("Dark")) {
// gSettings.GUI.DarkEmbedded = TRUE; // gSettings.GUI.DarkEmbedded = TRUE;
//ThemeX.Font = FONT_GRAY; //ThemeX.Font = FONT_GRAY;
} else if (Prop->getString()->stringValue().equalIC("Light")) { } else if (Prop->getString()->stringValue().isEqualIC("Light")) {
// gSettings.GUI.DarkEmbedded = FALSE; // gSettings.GUI.DarkEmbedded = FALSE;
//ThemeX.Font = FONT_ALFA; //ThemeX.Font = FONT_ALFA;
} else if (Prop->getString()->stringValue().equalIC("Daytime")) { } else if (Prop->getString()->stringValue().isEqualIC("Daytime")) {
// gSettings.GUI.DarkEmbedded = !ThemeX.Daylight; // gSettings.GUI.DarkEmbedded = !ThemeX.Daylight;
//ThemeX.Font = ThemeX.Daylight?FONT_ALFA:FONT_GRAY; //ThemeX.Font = ThemeX.Daylight?FONT_ALFA:FONT_GRAY;
} }
@ -3199,9 +3199,9 @@ EFI_STATUS GetEarlyUserSettings (
if (RtVariablesDict != NULL) { if (RtVariablesDict != NULL) {
const TagStruct* Prop = RtVariablesDict->propertyForKey("ROM"); const TagStruct* Prop = RtVariablesDict->propertyForKey("ROM");
if (Prop != NULL) { 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(); 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(); gSettings.RtVariables.RtROMAsString = Prop->getString()->stringValue();
} else if ( Prop->isString() || Prop->isData() ) { // GetDataSetting accept both } else if ( Prop->isString() || Prop->isData() ) { // GetDataSetting accept both
UINTN ROMLength = 0; UINTN ROMLength = 0;
@ -3223,58 +3223,58 @@ EFI_STATUS GetEarlyUserSettings (
const TagStruct* Prop; const TagStruct* Prop;
Prop = OcQuirksDict->propertyForKey("AvoidRuntimeDefrag"); Prop = OcQuirksDict->propertyForKey("AvoidRuntimeDefrag");
//if ( !Prop ) panic("Cannot find AvoidRuntimeDefrag in OcQuirks under root (OC booter quirks)"); //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.OcBooterQuirks.AvoidRuntimeDefrag = !IsPropertyNotNullAndFalse(Prop); //true if absent so no panic
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.AvoidRuntimeDefrag? QUIRK_DEFRAG:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.AvoidRuntimeDefrag? QUIRK_DEFRAG:0;
Prop = OcQuirksDict->propertyForKey( "DevirtualiseMmio"); Prop = OcQuirksDict->propertyForKey( "DevirtualiseMmio");
gSettings.Quirks.ocBooterQuirks.DevirtualiseMmio = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcBooterQuirks.DevirtualiseMmio = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.DevirtualiseMmio? QUIRK_MMIO:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.DevirtualiseMmio? QUIRK_MMIO:0;
Prop = OcQuirksDict->propertyForKey( "DisableSingleUser"); Prop = OcQuirksDict->propertyForKey( "DisableSingleUser");
gSettings.Quirks.ocBooterQuirks.DisableSingleUser = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcBooterQuirks.DisableSingleUser = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.DisableSingleUser? QUIRK_SU:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.DisableSingleUser? QUIRK_SU:0;
Prop = OcQuirksDict->propertyForKey( "DisableVariableWrite"); Prop = OcQuirksDict->propertyForKey( "DisableVariableWrite");
gSettings.Quirks.ocBooterQuirks.DisableVariableWrite = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcBooterQuirks.DisableVariableWrite = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.DisableVariableWrite? QUIRK_VAR:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.DisableVariableWrite? QUIRK_VAR:0;
Prop = OcQuirksDict->propertyForKey( "DiscardHibernateMap"); Prop = OcQuirksDict->propertyForKey( "DiscardHibernateMap");
gSettings.Quirks.ocBooterQuirks.DiscardHibernateMap = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcBooterQuirks.DiscardHibernateMap = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.DiscardHibernateMap? QUIRK_HIBER:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.DiscardHibernateMap? QUIRK_HIBER:0;
Prop = OcQuirksDict->propertyForKey( "EnableSafeModeSlide"); Prop = OcQuirksDict->propertyForKey( "EnableSafeModeSlide");
gSettings.Quirks.ocBooterQuirks.EnableSafeModeSlide = !IsPropertyNotNullAndFalse(Prop); gSettings.Quirks.OcBooterQuirks.EnableSafeModeSlide = !IsPropertyNotNullAndFalse(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.EnableSafeModeSlide? QUIRK_SAFE:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.EnableSafeModeSlide? QUIRK_SAFE:0;
Prop = OcQuirksDict->propertyForKey( "EnableWriteUnprotector"); Prop = OcQuirksDict->propertyForKey( "EnableWriteUnprotector");
gSettings.Quirks.ocBooterQuirks.EnableWriteUnprotector = !IsPropertyNotNullAndFalse(Prop); gSettings.Quirks.OcBooterQuirks.EnableWriteUnprotector = !IsPropertyNotNullAndFalse(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.EnableWriteUnprotector? QUIRK_UNPROT:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.EnableWriteUnprotector? QUIRK_UNPROT:0;
Prop = OcQuirksDict->propertyForKey( "ForceExitBootServices"); Prop = OcQuirksDict->propertyForKey( "ForceExitBootServices");
gSettings.Quirks.ocBooterQuirks.ForceExitBootServices = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcBooterQuirks.ForceExitBootServices = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ForceExitBootServices? QUIRK_EXIT:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.ForceExitBootServices? QUIRK_EXIT:0;
Prop = OcQuirksDict->propertyForKey( "ProtectMemoryRegions"); Prop = OcQuirksDict->propertyForKey( "ProtectMemoryRegions");
gSettings.Quirks.ocBooterQuirks.ProtectMemoryRegions = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcBooterQuirks.ProtectMemoryRegions = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ProtectMemoryRegions? QUIRK_REGION:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.ProtectMemoryRegions? QUIRK_REGION:0;
Prop = OcQuirksDict->propertyForKey( "ProtectSecureBoot"); Prop = OcQuirksDict->propertyForKey( "ProtectSecureBoot");
gSettings.Quirks.ocBooterQuirks.ProtectSecureBoot = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcBooterQuirks.ProtectSecureBoot = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ProtectSecureBoot? QUIRK_SECURE:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.ProtectSecureBoot? QUIRK_SECURE:0;
Prop = OcQuirksDict->propertyForKey( "ProtectUefiServices"); Prop = OcQuirksDict->propertyForKey( "ProtectUefiServices");
gSettings.Quirks.ocBooterQuirks.ProtectUefiServices = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcBooterQuirks.ProtectUefiServices = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ProtectUefiServices? QUIRK_UEFI:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.ProtectUefiServices? QUIRK_UEFI:0;
//it is in GUI section //it is in GUI section
// Prop = OcQuirksDict->propertyForKey( "ProvideConsoleGopEnable"); // Prop = OcQuirksDict->propertyForKey( "ProvideConsoleGopEnable");
// settingsData.ProvideConsoleGop = !IsPropertyNotNullAndFalse(Prop); // settingsData.ProvideConsoleGop = !IsPropertyNotNullAndFalse(Prop);
Prop = OcQuirksDict->propertyForKey( "ProvideCustomSlide"); Prop = OcQuirksDict->propertyForKey( "ProvideCustomSlide");
gSettings.Quirks.ocBooterQuirks.ProvideCustomSlide = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcBooterQuirks.ProvideCustomSlide = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ProvideCustomSlide? QUIRK_CUSTOM:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.ProvideCustomSlide? QUIRK_CUSTOM:0;
Prop = OcQuirksDict->propertyForKey( "ProvideMaxSlide"); 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"); Prop = OcQuirksDict->propertyForKey( "RebuildAppleMemoryMap");
gSettings.Quirks.ocBooterQuirks.RebuildAppleMemoryMap = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcBooterQuirks.RebuildAppleMemoryMap = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.RebuildAppleMemoryMap? QUIRK_MAP:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.RebuildAppleMemoryMap? QUIRK_MAP:0;
Prop = OcQuirksDict->propertyForKey( "SetupVirtualMap"); Prop = OcQuirksDict->propertyForKey( "SetupVirtualMap");
gSettings.Quirks.ocBooterQuirks.SetupVirtualMap = !IsPropertyNotNullAndFalse(Prop); gSettings.Quirks.OcBooterQuirks.SetupVirtualMap = !IsPropertyNotNullAndFalse(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.SetupVirtualMap? QUIRK_VIRT:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.SetupVirtualMap? QUIRK_VIRT:0;
Prop = OcQuirksDict->propertyForKey( "SignalAppleOS"); Prop = OcQuirksDict->propertyForKey( "SignalAppleOS");
gSettings.Quirks.ocBooterQuirks.SignalAppleOS = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcBooterQuirks.SignalAppleOS = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.SignalAppleOS? QUIRK_OS:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.SignalAppleOS? QUIRK_OS:0;
Prop = OcQuirksDict->propertyForKey( "SyncRuntimePermissions"); Prop = OcQuirksDict->propertyForKey( "SyncRuntimePermissions");
gSettings.Quirks.ocBooterQuirks.SyncRuntimePermissions = !IsPropertyNotNullAndFalse(Prop); gSettings.Quirks.OcBooterQuirks.SyncRuntimePermissions = !IsPropertyNotNullAndFalse(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.SyncRuntimePermissions? QUIRK_PERM:0; gSettings.Quirks.QuirksMask |= gSettings.Quirks.OcBooterQuirks.SyncRuntimePermissions? QUIRK_PERM:0;
gSettings.Quirks.mmioWhiteListArray.setEmpty(); gSettings.Quirks.mmioWhiteListArray.setEmpty();
const TagArray* Dict2 = OcQuirksDict->arrayPropertyForKey("MmioWhitelist"); // array of dict const TagArray* Dict2 = OcQuirksDict->arrayPropertyForKey("MmioWhitelist"); // array of dict
@ -3356,7 +3356,7 @@ EFI_STATUS GetEarlyUserSettings (
// Prop = OcQuirksDict->propertyForKey("DisableRtcChecksum"); // Prop = OcQuirksDict->propertyForKey("DisableRtcChecksum");
// settingsData.KernelAndKextPatches.OcKernelQuirks.DisableRtcChecksum = IsPropertyNotNullAndTrue(Prop); // settingsData.KernelAndKextPatches.OcKernelQuirks.DisableRtcChecksum = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.OcKernelQuirks.DisableRtcChecksum = gSettings.KernelAndKextPatches.KPAppleRTC; // gSettings.Quirks.OcKernelQuirks.DisableRtcChecksum = gSettings.KernelAndKextPatches.KPAppleRTC;
Prop = OcQuirksDict->propertyForKey("DummyPowerManagement"); Prop = OcQuirksDict->propertyForKey("DummyPowerManagement");
gSettings.Quirks.OcKernelQuirks.DummyPowerManagement = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcKernelQuirks.DummyPowerManagement = IsPropertyNotNullAndTrue(Prop);
@ -3369,11 +3369,11 @@ EFI_STATUS GetEarlyUserSettings (
// Prop = OcQuirksDict->propertyForKey("LapicKernelPanic"); // Prop = OcQuirksDict->propertyForKey("LapicKernelPanic");
// settingsData.KernelAndKextPatches.OcKernelQuirks.LapicKernelPanic = IsPropertyNotNullAndTrue(Prop); // settingsData.KernelAndKextPatches.OcKernelQuirks.LapicKernelPanic = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.OcKernelQuirks.LapicKernelPanic = gSettings.KernelAndKextPatches.KPKernelLapic; // gSettings.Quirks.OcKernelQuirks.LapicKernelPanic = gSettings.KernelAndKextPatches.KPKernelLapic;
// Prop = OcQuirksDict->propertyForKey("PanicNoKextDump"); // Prop = OcQuirksDict->propertyForKey("PanicNoKextDump");
// settingsData.KernelAndKextPatches.OcKernelQuirks.PanicNoKextDump = IsPropertyNotNullAndTrue(Prop); //KPPanicNoKextDump // 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"); Prop = OcQuirksDict->propertyForKey("PowerTimeoutKernelPanic");
gSettings.Quirks.OcKernelQuirks.PowerTimeoutKernelPanic = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcKernelQuirks.PowerTimeoutKernelPanic = IsPropertyNotNullAndTrue(Prop);
@ -3421,11 +3421,13 @@ ParseSMBIOSSettings(SETTINGS_DATA& gSettings, const TagDict* DictPointer)
if (Model != MaxMachineType) { if (Model != MaxMachineType) {
DBG("SetDMISettingsForModel=%d\n", Model); DBG("SetDMISettingsForModel=%d\n", Model);
SetDMISettingsForModel(gSettings, Model, FALSE); SetDMISettingsForModel(gSettings, Model, FALSE);
GlobalConfig.CurrentModel = Model;
Default = TRUE; Default = TRUE;
} else { } else {
//if new model then fill at least as iMac13,2, except custom ProductName //if new model then fill at least as iMac13,2, except custom ProductName
// something else? // something else?
SetDMISettingsForModel(gSettings, iMac132, FALSE); SetDMISettingsForModel(gSettings, iMac132, FALSE);
GlobalConfig.CurrentModel = MaxMachineType;
} }
} }
} }
@ -4435,9 +4437,9 @@ void SETTINGS_DATA::DevicesClass::FillDevicePropertiesOld(SETTINGS_DATA& gSettin
// when key in Devices/Properties is one of the strings "PrimaryGPU" / "SecondaryGPU", use device path of first / second gpu accordingly // when key in Devices/Properties is one of the strings "PrimaryGPU" / "SecondaryGPU", use device path of first / second gpu accordingly
#ifdef CLOVER_BUILD #ifdef CLOVER_BUILD
if ( DevicePathStr.equalIC("PrimaryGPU") ) { if ( DevicePathStr.isEqualIC("PrimaryGPU") ) {
DevicePath = DevicePathFromHandle(gGraphics[0].Handle); // first gpu 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 DevicePath = DevicePathFromHandle(gGraphics[1].Handle); // second gpu
} else { } else {
DevicePath = ConvertTextToDevicePath(DevicePathStr.wc_str()); //TODO 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 <key> with DevicePath. If GetKeyValueAtIndex return success, key and value != NULL if ( !EFI_ERROR(PropertiesDict->getKeyAndValueAtIndex(i, &key, &value)) ) { //take a <key> 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().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... // '!' means disabled. If Label is only '!', means an empty disabled label...
continue; 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 // when key in Devices/Properties is one of the strings "PrimaryGPU" / "SecondaryGPU", use device path of first / second gpu accordingly
//#ifdef CLOVER_BUILD //#ifdef CLOVER_BUILD
// if ( DevicePathStr.equalIC("PrimaryGPU") ) { // if ( DevicePathStr.isEqualIC("PrimaryGPU") ) {
// DevicePath = DevicePathFromHandle(gGraphics[0].Handle); // first gpu // 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 // DevicePath = DevicePathFromHandle(gGraphics[1].Handle); // second gpu
// } else { // } else {
// DevicePath = ConvertTextToDevicePath(DevicePathStr.wc_str()); //TODO // DevicePath = ConvertTextToDevicePath(DevicePathStr.wc_str()); //TODO
@ -4902,7 +4904,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
continue; continue;
} }
if ( key2->keyStringValue().startWithOrEqualTo('#') ) 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* ChildPtr = new SETTINGS_DATA::DevicesClass::SimplePropertyClass;
SETTINGS_DATA::DevicesClass::SimplePropertyClass& Child = *ChildPtr; 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(); SETTINGS_DATA::DevicesClass::AddPropertyClass* Property = new SETTINGS_DATA::DevicesClass::AddPropertyClass();
if (DeviceProp && (DeviceProp->isString()) && DeviceProp->getString()->stringValue().notEmpty()) { 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; Property->Device = (UINT32)DEV_ATI;
} else if (DeviceProp->getString()->stringValue().equalIC("NVidia")) { } else if (DeviceProp->getString()->stringValue().isEqualIC("NVidia")) {
Property->Device = (UINT32)DEV_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; Property->Device = (UINT32)DEV_INTEL;
} else if (DeviceProp->getString()->stringValue().equalIC("LAN")) { } else if (DeviceProp->getString()->stringValue().isEqualIC("LAN")) {
Property->Device = (UINT32)DEV_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; Property->Device = (UINT32)DEV_WIFI;
} else if (DeviceProp->getString()->stringValue().equalIC("Firewire")) { } else if (DeviceProp->getString()->stringValue().isEqualIC("Firewire")) {
Property->Device = (UINT32)DEV_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; Property->Device = (UINT32)DEV_SATA;
} else if (DeviceProp->getString()->stringValue().equalIC("IDE")) { } else if (DeviceProp->getString()->stringValue().isEqualIC("IDE")) {
Property->Device = (UINT32)DEV_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; Property->Device = (UINT32)DEV_HDA;
} else if (DeviceProp->getString()->stringValue().equalIC("HDMI")) { } else if (DeviceProp->getString()->stringValue().isEqualIC("HDMI")) {
Property->Device = (UINT32)DEV_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; Property->Device = (UINT32)DEV_LPC;
} else if (DeviceProp->getString()->stringValue().equalIC("SmBUS")) { } else if (DeviceProp->getString()->stringValue().isEqualIC("SmBUS")) {
Property->Device = (UINT32)DEV_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; Property->Device = (UINT32)DEV_USB;
} else { } else {
DBG(" unknown device, ignored\n"/*, i*/); DBG(" unknown device, ignored\n"/*, i*/);
@ -5359,7 +5361,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
INTN Count = ModulesArray->arrayContent().size(); INTN Count = ModulesArray->arrayContent().size();
for (i = 0; i < Count; i++) { for (i = 0; i < Count; i++) {
const TagDict* Prop3 = ModulesArray->dictElementAt(i, "SMBIOS/Memory/Modules"_XS8); const TagDict* Prop3 = ModulesArray->dictElementAt(i, "SMBIOS/Memory/Modules"_XS8);
UINT8 Slot = MAX_RAM_SLOTS; int Slot = MAX_RAM_SLOTS;
RAM_SLOT_INFO *SlotPtr; RAM_SLOT_INFO *SlotPtr;
// Get memory slot // Get memory slot
Prop2 = Prop3->propertyForKey("Slot"); Prop2 = Prop3->propertyForKey("Slot");
@ -5406,13 +5408,13 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
SlotPtr->Type = MemoryTypeDdr3; SlotPtr->Type = MemoryTypeDdr3;
Prop2 = Prop3->propertyForKey("Type"); Prop2 = Prop3->propertyForKey("Type");
if (Prop2 && Prop2->isString() && Prop2->getString()->stringValue().notEmpty()) { if (Prop2 && Prop2->isString() && Prop2->getString()->stringValue().notEmpty()) {
if (Prop2->getString()->stringValue().equalIC("DDR2")) { if (Prop2->getString()->stringValue().isEqualIC("DDR2")) {
SlotPtr->Type = MemoryTypeDdr2; SlotPtr->Type = MemoryTypeDdr2;
} else if (Prop2->getString()->stringValue().equalIC("DDR3")) { } else if (Prop2->getString()->stringValue().isEqualIC("DDR3")) {
SlotPtr->Type = MemoryTypeDdr3; SlotPtr->Type = MemoryTypeDdr3;
} else if (Prop2->getString()->stringValue().equalIC("DDR4")) { } else if (Prop2->getString()->stringValue().isEqualIC("DDR4")) {
SlotPtr->Type = MemoryTypeDdr4; SlotPtr->Type = MemoryTypeDdr4;
} else if (Prop2->getString()->stringValue().equalIC("DDR")) { } else if (Prop2->getString()->stringValue().isEqualIC("DDR")) {
SlotPtr->Type = MemoryTypeDdr; SlotPtr->Type = MemoryTypeDdr;
} }
} }
@ -5445,23 +5447,23 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
const TagStruct* Prop2 = SlotsDict->propertyForKey("Device"); const TagStruct* Prop2 = SlotsDict->propertyForKey("Device");
DeviceN = -1; DeviceN = -1;
if (Prop2 && (Prop2->isString()) && Prop2->getString()->stringValue().notEmpty()) { if (Prop2 && (Prop2->isString()) && Prop2->getString()->stringValue().notEmpty()) {
if (Prop2->getString()->stringValue().equalIC("ATI")) { if (Prop2->getString()->stringValue().isEqualIC("ATI")) {
DeviceN = 0; DeviceN = 0;
} else if (Prop2->getString()->stringValue().equalIC("NVidia")) { } else if (Prop2->getString()->stringValue().isEqualIC("NVidia")) {
DeviceN = 1; DeviceN = 1;
} else if (Prop2->getString()->stringValue().equalIC("IntelGFX")) { } else if (Prop2->getString()->stringValue().isEqualIC("IntelGFX")) {
DeviceN = 2; DeviceN = 2;
} else if (Prop2->getString()->stringValue().equalIC("LAN")) { } else if (Prop2->getString()->stringValue().isEqualIC("LAN")) {
DeviceN = 5; DeviceN = 5;
} else if (Prop2->getString()->stringValue().equalIC("WIFI")) { } else if (Prop2->getString()->stringValue().isEqualIC("WIFI")) {
DeviceN = 6; DeviceN = 6;
} else if (Prop2->getString()->stringValue().equalIC("Firewire")) { } else if (Prop2->getString()->stringValue().isEqualIC("Firewire")) {
DeviceN = 12; DeviceN = 12;
} else if (Prop2->getString()->stringValue().equalIC("HDMI")) { } else if (Prop2->getString()->stringValue().isEqualIC("HDMI")) {
DeviceN = 4; DeviceN = 4;
} else if (Prop2->getString()->stringValue().equalIC("USB")) { } else if (Prop2->getString()->stringValue().isEqualIC("USB")) {
DeviceN = 11; DeviceN = 11;
} else if (Prop2->getString()->stringValue().equalIC("NVME")) { } else if (Prop2->getString()->stringValue().isEqualIC("NVME")) {
DeviceN = 13; DeviceN = 13;
} else { } else {
DBG(" - add properties to unknown device %s, ignored\n", Prop2->getString()->stringValue().c_str()); 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: <data>bin data</data> or <string>base 64 encoded bin data</string> // ROM: <data>bin data</data> or <string>base 64 encoded bin data</string>
const TagStruct* Prop = RtVariablesDict->propertyForKey("ROM"); const TagStruct* Prop = RtVariablesDict->propertyForKey("ROM");
if (Prop != NULL) { 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(); 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(); gSettings.RtVariables.RtROMAsString = Prop->getString()->stringValue();
} else if ( Prop->isString() || Prop->isData() ) { // GetDataSetting accept both } else if ( Prop->isString() || Prop->isData() ) { // GetDataSetting accept both
UINTN ROMLength = 0; UINTN ROMLength = 0;
@ -5694,7 +5696,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
} }
} }
Prop2 = BlockDict->propertyForKey("Disabled"); Prop2 = BlockDict->propertyForKey("Disabled");
if (IsPropertyNotNullAndFalse(Prop2)) { if (IsPropertyNotNullAndTrue(Prop2)) {
RtVariable.Disabled = true; RtVariable.Disabled = true;
// continue; // continue;
} }
@ -5780,12 +5782,12 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
if ( Prop->isBool() ) gSettings.SystemParameters._InjectSystemID = Prop->getBool()->boolValue(); if ( Prop->isBool() ) gSettings.SystemParameters._InjectSystemID = Prop->getBool()->boolValue();
else if ( Prop->isString() ) { else if ( Prop->isString() ) {
// TODO a function that takes a string and return if it's true or false // 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()[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().isEqualIC("false") ) gSettings.SystemParameters._InjectSystemID = 0;
else if ( Prop->getString()->stringValue().equalIC("n") ) gSettings.SystemParameters._InjectSystemID = 0; else if ( Prop->getString()->stringValue().isEqualIC("n") ) gSettings.SystemParameters._InjectSystemID = 0;
else if ( Prop->getString()->stringValue().equalIC("N") ) gSettings.SystemParameters._InjectSystemID = 0; else if ( Prop->getString()->stringValue().isEqualIC("N") ) gSettings.SystemParameters._InjectSystemID = 0;
else { else {
DBG("MALFORMED PLIST : SMBIOS/InjectSystemID must be true, yes, false, no, or non existant"); 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); gSettings.BootGraphics.EFILoginHiDPI = (UINT32)GetPropertyAsInteger(Prop, 0x80000000);
Prop = BootGraphicsDict->propertyForKey("flagstate"); 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; if ( kernelFlags[idx] == '=' ) ++idx;
else return NullXString8; else return NullXString8;
while ( idx < kernelFlags.length() && IS_BLANK(kernelFlags[idx]) ) ++idx; 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; size_t idxEnd = idx;
while ( idxEnd < kernelFlags.length() && !IS_BLANK(kernelFlags[idxEnd]) ) ++idxEnd; while ( idxEnd < kernelFlags.length() && !IS_BLANK(kernelFlags[idxEnd]) ) ++idxEnd;
returnValue = kernelFlags.subString(idx, idxEnd - idx); returnValue = kernelFlags.subString(idx, idxEnd - idx);

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,23 @@ For details, see http://sourceforge.net/projects/libb64
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile #include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
#include "b64cdecode.h" #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) 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}; 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; 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; const char* codechar = code_in;
char* plainchar = plaintext_out; 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 DecodedSize != NULL, then size od decoded data is put there.
* If return value is not NULL, DecodedSize IS > 0 * 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; INTN DecodedSizeInternal;
UINT8 *DecodedData; UINT8 *DecodedData;
@ -108,7 +125,7 @@ UINT8 *Base64DecodeClover(IN CONST CHAR8 *EncodedData, UINTN EncodedSize, OUT UI
DecodedData = (__typeof__(DecodedData))AllocateZeroPool(EncodedSize); DecodedData = (__typeof__(DecodedData))AllocateZeroPool(EncodedSize);
base64_init_decodestate(&state_in); 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 ) { if ( DecodedSizeInternal <= 0 ) {
FreePool(DecodedData); FreePool(DecodedData);

View File

@ -18,40 +18,9 @@ For details, see http://sourceforge.net/projects/libb64
typedef enum
{
step_a, step_b, step_c, step_d
} base64_decodestep;
UINT8 *Base64DecodeClover(IN CONST CHAR8 *EncodedData, size_t EncodedSize, OUT UINTN *DecodedSize);
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, OUT UINTN *DecodedSize); UINT8 *Base64DecodeClover(IN CONST CHAR8 *EncodedData, OUT UINTN *DecodedSize);

View File

@ -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) void SetDMISettingsForModel(SETTINGS_DATA& gSettings, MACHINE_TYPES Model, BOOLEAN Redefine)
{ {
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
@ -1068,151 +1218,14 @@ void SetDMISettingsForModel(SETTINGS_DATA& gSettings, MACHINE_TYPES Model, BOOLE
// Mobile: the battery tab in Energy Saver // Mobile: the battery tab in Energy Saver
gSettings.Smbios.Mobile = GetMobile(Model, gMobile); gSettings.Smbios.Mobile = GetMobile(Model, gMobile);
//RBr helper // //RBr helper
if (ApplePlatformData[Model].smcBranch[0] != 'N') { // getRBr(Model, gSettings.Smbios.RBr);
AsciiStrCpyS(gSettings.Smbios.RBr, 8, ApplePlatformData[Model].smcBranch.c_str()); //
} else { // //RPlt helper
switch (gCPUStructure.Model) { // getRPlt(Model, gSettings.Smbios.RPlt);
case CPU_MODEL_PENTIUM_M: //
case CPU_MODEL_CELERON: // CopyMem(gSettings.Smbios.REV, ApplePlatformData[Model].smcRevision, 6);
AsciiStrCpyS (gSettings.Smbios.RBr, 8, "m70"); // CopyMem(gSettings.Smbios.EPCI, &ApplePlatformData[Model].smcConfig, 4);
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);
} }
MACHINE_TYPES GetModelFromString(const XString8& ProductName) MACHINE_TYPES GetModelFromString(const XString8& ProductName)
@ -1246,8 +1259,8 @@ void GetDefaultSettings()
((gGraphics[1].Vendor == Nvidia) && (gGraphics[1].Family < 0xE0))); ((gGraphics[1].Vendor == Nvidia) && (gGraphics[1].Family < 0xE0)));
// gSettings.GraphicsInjector = gSettings.InjectATI || gSettings.InjectNVidia; // gSettings.GraphicsInjector = gSettings.InjectATI || gSettings.InjectNVidia;
CopyMem(gSettings.Graphics.NVCAP, default_NVCAP, 20); CopyMem(gSettings.Graphics.NVCAP.data(), default_NVCAP, 20);
CopyMem(gSettings.Graphics.Dcfg, default_dcfg_0, 4); CopyMem(gSettings.Graphics.Dcfg.data(), default_dcfg_0, 4);
CopyMem(&gSettings.Graphics.Dcfg[4], default_dcfg_1, 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.EDID.CustomEDID = NULL; //no sense to assign 0 as the structure is zeroed
gSettings.Graphics.DualLink = 0xA; // A(auto): DualLink auto-detection gSettings.Graphics.DualLink = 0xA; // A(auto): DualLink auto-detection

View File

@ -10,7 +10,9 @@
#include "../cpp_foundation/XString.h" #include "../cpp_foundation/XString.h"
#include "../Platform/Settings.h" //#include "../Platform/Settings.h"
class SETTINGS_DATA;
typedef enum { typedef enum {
@ -199,5 +201,7 @@ uint32_t GetFwFeaturesMaskFromModel(MACHINE_TYPES Model);
uint32_t GetFwFeatures(MACHINE_TYPES Model); uint32_t GetFwFeatures(MACHINE_TYPES Model);
bool GetMobile(MACHINE_TYPES Model, bool defaultValue); bool GetMobile(MACHINE_TYPES Model, bool defaultValue);
UINT64 GetPlatformFeature(MACHINE_TYPES Model); 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_ */ #endif /* PLATFORM_PLATFORMDATA_H_ */

View File

@ -156,7 +156,7 @@ const TagStruct* TagDict::propertyForKey(const CHAR8* key) const
const XObjArray<TagStruct>& tagList = _dictContent; const XObjArray<TagStruct>& tagList = _dictContent;
for (size_t tagIdx = 0 ; tagIdx < tagList.size() ; tagIdx++ ) 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 ( tagIdx+1 >= tagList.size() ) return NULL;
if ( tagList[tagIdx+1].isKey() ) return NULL; if ( tagList[tagIdx+1].isKey() ) return NULL;
return &tagList[tagIdx+1]; return &tagList[tagIdx+1];

View File

@ -203,7 +203,7 @@ bool TagStruct::isTrueOrYy() const
bool TagStruct::isTrueOrYes() const bool TagStruct::isTrueOrYes() const
{ {
if ( isBool() ) return getBool()->boolValue(); 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; return false;
} }
bool TagStruct::isFalseOrNn() const bool TagStruct::isFalseOrNn() const

View File

@ -27,6 +27,21 @@ public:
XString8 SerialNo = XString8(); XString8 SerialNo = XString8();
UINT8 Type = UINT8(); UINT8 Type = UINT8();
bool InUse = bool(); 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 class MEM_STRUCTURE

View File

@ -10,7 +10,10 @@
#define Platform_h_h #define Platform_h_h
#ifndef _UINTPTR_T #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 #endif
#ifdef _MSC_VER #ifdef _MSC_VER
@ -84,15 +87,15 @@ typedef unsigned long long uintptr_t;
#endif #endif
#if defined(__clang__) // it works to include <Foundation/Foundation.h> and that allows to use NS... objects. Could be useful for a tool running on macOS.
#ifdef __OBJC__ //#ifdef __OBJC__
#define _MACH_H_ //#define _MACH_H_
#define __DEBUGGING__ //#define __DEBUGGING__
#import <Foundation/Foundation.h> //#import <Foundation/Foundation.h>
#undef CMASK //#undef CMASK
//#endif
#endif #endif
// to be able to compile AutoGen.c // to be able to compile AutoGen.c
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -48,11 +48,11 @@ class XArray
//low case functions like in std::vector //low case functions like in std::vector
const TYPE& begin() const { return ElementAt(0); } const TYPE& begin() const { if ( m_len == 0 ) panic("m_len == 0"); return ElementAt(0); }
TYPE& begin() { 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); } const TYPE& end() const { if ( m_len == 0 ) panic("m_len == 0"); return ElementAt(m_len - 1); }
TYPE& end() { 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); } 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<typename IntegralType, enable_if(is_integral(IntegralType))> template<typename IntegralType, enable_if(is_integral(IntegralType))>
TYPE &operator[](IntegralType nIndex) { return ElementAt(nIndex); } TYPE &operator[](IntegralType nIndex) { return ElementAt(nIndex); }
bool operator==(const XArray<TYPE>& 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<TYPE>& 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 const void *() const { return m_data; };
operator void *() { return m_data; }; operator void *() { return m_data; };

View File

@ -113,6 +113,26 @@ class XObjArrayNC
template<typename IntegralType, enable_if(is_integral(IntegralType))> template<typename IntegralType, enable_if(is_integral(IntegralType))>
TYPE &operator[](IntegralType nIndex) { return ElementAt(nIndex); } TYPE &operator[](IntegralType nIndex) { return ElementAt(nIndex); }
bool operator==(const XObjArrayNC<TYPE>& 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<TYPE>& other) const {return !(*this == other); }
bool isEqual(const XObjArrayNC<TYPE>& 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 AddReference(TYPE *newElement, bool FreeIt);
// size_t InsertRef(TYPE *newElement, size_t pos, bool FreeIt = false); // size_t InsertRef(TYPE *newElement, size_t pos, bool FreeIt = false);

View File

@ -539,19 +539,19 @@ public:
int strncmp(const O* S, size_t n) const { return XStringAbstract__ncompare(data(), S, n, false); } int strncmp(const O* S, size_t n) const { return XStringAbstract__ncompare(data(), S, n, false); }
template<typename O, class OtherXStringClass> template<typename O, class OtherXStringClass>
bool equal(const __String<O, OtherXStringClass>& S) const { return XStringAbstract__compare(data(), S.s(), false) == 0; } bool isEqual(const __String<O, OtherXStringClass>& S) const { return XStringAbstract__compare(data(), S.s(), false) == 0; }
template<typename O> template<typename O>
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<typename O, class OtherXStringClass> template<typename O, class OtherXStringClass>
bool equalIC(const __String<O, OtherXStringClass>& S) const { return XStringAbstract__compare(data(), S.s(), true) == 0; } bool isEqualIC(const __String<O, OtherXStringClass>& S) const { return XStringAbstract__compare(data(), S.s(), true) == 0; }
template<typename O> template<typename O>
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); } // bool SubStringEqual(size_t Pos, const T* S) const { return (memcmp(data(Pos), S, wcslen(S)) == 0); }
template<typename IntegralType, typename O, class OtherXStringClass> template<typename IntegralType, typename O, class OtherXStringClass>
bool equalAtIC(IntegralType pos, const __String<O, OtherXStringClass>& S) const bool isEqualAtIC(IntegralType pos, const __String<O, OtherXStringClass>& S) const
{ {
#ifdef DEBUG #ifdef DEBUG

View File

@ -104,7 +104,7 @@ class XStringArray_/* : public XStringArraySuper*/
bool contains(const CharType* s) const bool contains(const CharType* s) const
{ {
for ( size_t i=0 ; i<array.size() ; i+=1 ) { for ( size_t i=0 ; i<array.size() ; i+=1 ) {
if ( array.ElementAt(i).equal(s) ) return true; if ( array.ElementAt(i).isEqual(s) ) return true;
} }
return false; return false;
} }
@ -118,7 +118,7 @@ class XStringArray_/* : public XStringArraySuper*/
bool containsIC(const CharType* s) const bool containsIC(const CharType* s) const
{ {
for ( size_t i=0 ; i<array.size() ; i+=1 ) { for ( size_t i=0 ; i<array.size() ; i+=1 ) {
if ( array.ElementAt(i).equalIC(s) ) return true; if ( array.ElementAt(i).isEqualIC(s) ) return true;
} }
return false; return false;
} }
@ -250,7 +250,7 @@ class XStringArray_/* : public XStringArraySuper*/
size_t i = array.size(); size_t i = array.size();
do { do {
i--; i--;
if ( array[i].equalIC(aString) ) { if ( array[i].isEqualIC(aString) ) {
array.RemoveAtIndex(i); array.RemoveAtIndex(i);
break; break;
} }

View File

@ -37,6 +37,14 @@ public:
m_value = value; m_value = value;
return *this; return *this;
} }
bool operator ==(const undefinable<T>& 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<T>& other) const { return !(*this == other); }
}; };
class undefinable_bool : public undefinable<bool> class undefinable_bool : public undefinable<bool>

View File

@ -35,7 +35,7 @@
// ret = TRUE; // ret = TRUE;
// } else if ( macthOsToc[0] == currOStoc[0] // } else if ( macthOsToc[0] == currOStoc[0]
// && macthOsToc[1] == currOStoc[1] // && macthOsToc[1] == currOStoc[1]
// && macthOsToc[2].equalIC("x") ) { // && macthOsToc[2].isEqualIC("x") ) {
// ret = TRUE; // ret = TRUE;
// } // }
// } else if (currOStoc.size() == 2) { // } else if (currOStoc.size() == 2) {
@ -44,7 +44,7 @@
// ret = TRUE; // ret = TRUE;
// } else if ( macthOsToc[0] == currOStoc[0] // } else if ( macthOsToc[0] == currOStoc[0]
// && macthOsToc[1] == currOStoc[1] // && macthOsToc[1] == currOStoc[1]
// && macthOsToc[2].equalIC("x") == 0 ) { // && macthOsToc[2].isEqualIC("x") == 0 ) {
// ret = TRUE; // ret = TRUE;
// } // }
// } // }
@ -75,7 +75,7 @@ static BOOLEAN IsOSValid_OLD(const XString8& MatchOS, const XString8& CurrOS)
if ( osToc.size() > 0 && currOStoc.size() > 0 && osToc[0] == "11"_XS8 && currOStoc[0] == "11"_XS8 ) { if ( osToc.size() > 0 && currOStoc.size() > 0 && osToc[0] == "11"_XS8 && currOStoc[0] == "11"_XS8 ) {
if (osToc.size() == 1 ) return true; if (osToc.size() == 1 ) return true;
if (osToc.size() == 2 ) { 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; if ( currOStoc.size() == 2 && osToc[1] == currOStoc[1] ) return true;
} }
} }
@ -93,7 +93,7 @@ static BOOLEAN IsOSValid_OLD(const XString8& MatchOS, const XString8& CurrOS)
ret = TRUE; ret = TRUE;
} else if ( osToc[0] == currOStoc[0] } else if ( osToc[0] == currOStoc[0]
&& osToc[1] == currOStoc[1] && osToc[1] == currOStoc[1]
&& osToc[2].equalIC("x") ) { && osToc[2].isEqualIC("x") ) {
ret = TRUE; ret = TRUE;
} }
} else if (currOStoc.size() == 2) { } else if (currOStoc.size() == 2) {
@ -102,7 +102,7 @@ static BOOLEAN IsOSValid_OLD(const XString8& MatchOS, const XString8& CurrOS)
ret = TRUE; ret = TRUE;
} else if ( osToc[0] == currOStoc[0] } else if ( osToc[0] == currOStoc[0]
&& osToc[1] == currOStoc[1] && osToc[1] == currOStoc[1]
&& osToc[2].equalIC("x") == 0 ) { && osToc[2].isEqualIC("x") == 0 ) {
ret = TRUE; ret = TRUE;
} }
} }

View File

@ -73,7 +73,7 @@ const XIcon& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, const
DevicePath = NextDevicePathNode(DevicePath); DevicePath = NextDevicePathNode(DevicePath);
} }
if (DevicePathType(DevicePath) == MEDIA_DEVICE_PATH && DevicePathSubType (DevicePath) == MEDIA_VENDOR_DP) { 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; IconNum = BUILTIN_ICON_VOL_INTERNAL_APFS;
} }
} else { } else {

View File

@ -74,7 +74,7 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi
// DBG("entry %lld\n", i); // DBG("entry %lld\n", i);
// Only want legacy // Only want legacy
if (MainEntry.getLEGACY_ENTRY()) { if (MainEntry.getLEGACY_ENTRY()) {
if ( MainEntry.getLEGACY_ENTRY()->DevicePathString.equalIC(Volume->DevicePathString) ) { if ( MainEntry.getLEGACY_ENTRY()->DevicePathString.isEqualIC(Volume->DevicePathString) ) {
return true; return true;
} }
} }

View File

@ -261,25 +261,25 @@ UINT8 GetOSTypeFromPath(IN CONST XStringW& Path)
if (Path.isEmpty()) { if (Path.isEmpty()) {
return OSTYPE_OTHER; return OSTYPE_OTHER;
} }
if ( Path.equalIC(MACOSX_LOADER_PATH)) { if ( Path.isEqualIC(MACOSX_LOADER_PATH)) {
return OSTYPE_OSX; return OSTYPE_OSX;
} else if ( Path.equalIC(OSXInstallerPaths[0]) || } else if ( Path.isEqualIC(OSXInstallerPaths[0]) ||
( Path.equalIC(OSXInstallerPaths[1])) || ( Path.isEqualIC(OSXInstallerPaths[1])) ||
( Path.equalIC(OSXInstallerPaths[2])) || ( Path.isEqualIC(OSXInstallerPaths[2])) ||
( Path.equalIC(OSXInstallerPaths[3])) || ( Path.isEqualIC(OSXInstallerPaths[3])) ||
( Path.equalIC(OSXInstallerPaths[4])) || ( Path.isEqualIC(OSXInstallerPaths[4])) ||
( Path.equalIC(RockBoot)) || ( Path.equalIC(PaperBoot)) || ( Path.equalIC(ScissorBoot)) || ( Path.isEqualIC(RockBoot)) || ( Path.isEqualIC(PaperBoot)) || ( Path.isEqualIC(ScissorBoot)) ||
(! Path.equalIC(L"\\.IABootFiles\\boot.efi") && Path.equalIC(L"\\.IAPhysicalMedia") && Path.equalIC(MACOSX_LOADER_PATH)) (! Path.isEqualIC(L"\\.IABootFiles\\boot.efi") && Path.isEqualIC(L"\\.IAPhysicalMedia") && Path.isEqualIC(MACOSX_LOADER_PATH))
) { ) {
return OSTYPE_OSX_INSTALLER; 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; return OSTYPE_RECOVERY;
} else if (( Path.equalIC(L"\\EFI\\Microsoft\\Boot\\bootmgfw-orig.efi")) || //test first as orig } else if (( Path.isEqualIC(L"\\EFI\\Microsoft\\Boot\\bootmgfw-orig.efi")) || //test first as orig
( Path.equalIC(L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi")) || //it can be Clover ( Path.isEqualIC(L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi")) || //it can be Clover
// ( Path.equalIC(L"\\bootmgr.efi")) || //never worked, just extra icon in menu // ( Path.isEqualIC(L"\\bootmgr.efi")) || //never worked, just extra icon in menu
( Path.equalIC(L"\\EFI\\MICROSOFT\\BOOT\\cdboot.efi"))) { ( Path.isEqualIC(L"\\EFI\\MICROSOFT\\BOOT\\cdboot.efi"))) {
return OSTYPE_WINEFI; return OSTYPE_WINEFI;
} else if (LINUX_FULL_LOADER_PATH.equalIC(Path)) { } else if (LINUX_FULL_LOADER_PATH.isEqualIC(Path)) {
return OSTYPE_LINEFI; return OSTYPE_LINEFI;
} else if ( Path.containsIC("grubx64.efi") ) { } else if ( Path.containsIC("grubx64.efi") ) {
return OSTYPE_LINEFI; return OSTYPE_LINEFI;
@ -288,7 +288,7 @@ UINT8 GetOSTypeFromPath(IN CONST XStringW& Path)
#if defined(ANDX86) #if defined(ANDX86)
Index = 0; Index = 0;
while (Index < AndroidEntryDataCount) { while (Index < AndroidEntryDataCount) {
if ( Path.equalIC(AndroidEntryData[Index].Path) ) { if ( Path.isEqualIC(AndroidEntryData[Index].Path) ) {
return OSTYPE_LIN; return OSTYPE_LIN;
} }
++Index; ++Index;
@ -296,7 +296,7 @@ UINT8 GetOSTypeFromPath(IN CONST XStringW& Path)
#endif #endif
Index = 0; Index = 0;
while (Index < LinuxEntryDataCount) { while (Index < LinuxEntryDataCount) {
if ( Path.equalIC(LinuxEntryData[Index].Path) ) { if ( Path.isEqualIC(LinuxEntryData[Index].Path) ) {
return OSTYPE_LIN; return OSTYPE_LIN;
} }
++Index; ++Index;
@ -314,7 +314,7 @@ STATIC CONST XStringW& LinuxIconNameFromPath(IN CONST XStringW& Path,
#if defined(ANDX86) #if defined(ANDX86)
Index = 0; Index = 0;
while (Index < AndroidEntryDataCount) { while (Index < AndroidEntryDataCount) {
if ( Path.equalIC(AndroidEntryData[Index].Path) ) { if ( Path.isEqualIC(AndroidEntryData[Index].Path) ) {
return AndroidEntryData[Index].Icon; return AndroidEntryData[Index].Icon;
} }
++Index; ++Index;
@ -324,14 +324,14 @@ STATIC CONST XStringW& LinuxIconNameFromPath(IN CONST XStringW& Path,
//check not common names //check not common names
Index = 0; Index = 0;
while (Index < LinuxEntryDataCount) { while (Index < LinuxEntryDataCount) {
if ( Path.equalIC(LinuxEntryData[Index].Path) ) { if ( Path.isEqualIC(LinuxEntryData[Index].Path) ) {
return LinuxEntryData[Index].Icon; return LinuxEntryData[Index].Icon;
} }
++Index; ++Index;
} }
// Try to open the linux issue // 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; CHAR8 *Issue = NULL;
UINTN IssueLen = 0; UINTN IssueLen = 0;
if (!EFI_ERROR(egLoadFile(RootDir, LINUX_ISSUE_PATH.wc_str(), (UINT8 **)&Issue, &IssueLen)) && (Issue != NULL)) { 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 // Check if the path match
if (Custom.settings.Path.notEmpty()) { if (Custom.settings.Path.notEmpty()) {
// Check if the loader path match // 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 // Check if the type match
@ -2165,7 +2165,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex,
// Less precise volume match // Less precise volume match
if (Custom.settings.Path != CustomEntry.settings.Path) { if (Custom.settings.Path != CustomEntry.settings.Path) {
// Better path match // 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) || ((Custom.settings.VolumeType == CustomEntry.settings.VolumeType) ||
((1ull<<Volume->DiskKind) & Custom.settings.VolumeType) != 0)); ((1ull<<Volume->DiskKind) & Custom.settings.VolumeType) != 0));
} }
@ -2175,7 +2175,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex,
// More precise volume match // More precise volume match
if (Custom.settings.Path != CustomEntry.settings.Path) { if (Custom.settings.Path != CustomEntry.settings.Path) {
// Better path match // 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) || ((Custom.settings.VolumeType == CustomEntry.settings.VolumeType) ||
((1ull<<Volume->DiskKind) & Custom.settings.VolumeType) != 0)); ((1ull<<Volume->DiskKind) & Custom.settings.VolumeType) != 0));
} else if (Custom.settings.VolumeType != CustomEntry.settings.VolumeType) { } else if (Custom.settings.VolumeType != CustomEntry.settings.VolumeType) {
@ -2189,7 +2189,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex,
// Duplicate volume match // Duplicate volume match
} else if (Custom.settings.Path != CustomEntry.settings.Path) { } else if (Custom.settings.Path != CustomEntry.settings.Path) {
// Better path match // 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) || ((Custom.settings.VolumeType == CustomEntry.settings.VolumeType) ||
((1ull<<Volume->DiskKind) & Custom.settings.VolumeType) != 0)); ((1ull<<Volume->DiskKind) & Custom.settings.VolumeType) != 0));
// Duplicate path match // Duplicate path match
@ -2208,7 +2208,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex,
// Less precise path match // Less precise path match
BetterMatch = ((Custom.settings.VolumeType != CustomEntry.settings.VolumeType) && BetterMatch = ((Custom.settings.VolumeType != CustomEntry.settings.VolumeType) &&
((1ull<<Volume->DiskKind) & Custom.settings.VolumeType) != 0); ((1ull<<Volume->DiskKind) & Custom.settings.VolumeType) != 0);
} else if (CustomPath.equal(CustomEntry.settings.Path)) { } else if (CustomPath.isEqual(CustomEntry.settings.Path)) {
if (Custom.settings.Path.isEmpty()) { if (Custom.settings.Path.isEmpty()) {
// More precise path and volume type match // More precise path and volume type match
BetterMatch = ((Custom.settings.VolumeType == CustomEntry.settings.VolumeType) || BetterMatch = ((Custom.settings.VolumeType == CustomEntry.settings.VolumeType) ||

View File

@ -646,7 +646,7 @@ UINTN REFIT_MENU_SCREEN::InputDialog()
break; break;
case MENU_EXIT_ESCAPE: case MENU_EXIT_ESCAPE:
if ( !Item->SValue.equal(Backup) ) { if ( !Item->SValue.isEqual(Backup) ) {
Item->SValue = Backup; Item->SValue = Backup;
if (Item->ItemType != BoolValue) { if (Item->ItemType != BoolValue) {
Item->LineShift = BackupShift; Item->LineShift = BackupShift;

View File

@ -379,18 +379,18 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
Dict2 = GetProperty(Dict3, "ScreenEdgeX"); Dict2 = GetProperty(Dict3, "ScreenEdgeX");
if (Dict2 != NULL && (Dict2->isString()) && Dict2->getString()->stringValue().notEmpty() ) { 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; NewFilm->ScreenEdgeHorizontal = SCREEN_EDGE_LEFT;
} else if (Dict2->getString()->stringValue().equal("right")) { } else if (Dict2->getString()->stringValue().isEqual("right")) {
NewFilm->ScreenEdgeHorizontal = SCREEN_EDGE_RIGHT; NewFilm->ScreenEdgeHorizontal = SCREEN_EDGE_RIGHT;
} }
} }
Dict2 = GetProperty(Dict3, "ScreenEdgeY"); Dict2 = GetProperty(Dict3, "ScreenEdgeY");
if (Dict2 != NULL && (Dict2->isString()) && Dict2->getString()->stringValue().notEmpty() ) { 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; NewFilm->ScreenEdgeVertical = SCREEN_EDGE_TOP;
} else if (Dict2->getString()->stringValue().equal("bottom")) { } else if (Dict2->getString()->stringValue().isEqual("bottom")) {
NewFilm->ScreenEdgeVertical = SCREEN_EDGE_BOTTOM; NewFilm->ScreenEdgeVertical = SCREEN_EDGE_BOTTOM;
} }
} }

View File

@ -222,7 +222,7 @@ finish:
} }
for (i = 0; i < ThemeNameArray.size(); i++) { for (i = 0; i < ThemeNameArray.size(); i++) {
if ( ThemeX.Theme.equalIC(ThemeNameArray[i]) ) { if ( ThemeX.Theme.isEqualIC(ThemeNameArray[i]) ) {
OldChosenTheme = i; OldChosenTheme = i;
break; break;
} }
@ -454,18 +454,18 @@ XTheme::GetThemeTagSettings(const TagDict* DictPointer)
Prop2 = Dict->propertyForKey("ScreenEdgeX"); Prop2 = Dict->propertyForKey("ScreenEdgeX");
if (Prop2 != NULL && (Prop2->isString()) && Prop2->getString()->stringValue().notEmpty() ) { 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; BannerEdgeHorizontal = SCREEN_EDGE_LEFT;
} else if (Prop2->getString()->stringValue().equal("right")) { } else if (Prop2->getString()->stringValue().isEqual("right")) {
BannerEdgeHorizontal = SCREEN_EDGE_RIGHT; BannerEdgeHorizontal = SCREEN_EDGE_RIGHT;
} }
} }
Prop2 = Dict->propertyForKey("ScreenEdgeY"); Prop2 = Dict->propertyForKey("ScreenEdgeY");
if (Prop2 != NULL && (Prop2->isString()) && Prop2->getString()->stringValue().notEmpty() ) { 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; BannerEdgeVertical = SCREEN_EDGE_TOP;
} else if (Prop2->getString()->stringValue().equal("bottom")) { } else if (Prop2->getString()->stringValue().isEqual("bottom")) {
BannerEdgeVertical = SCREEN_EDGE_BOTTOM; BannerEdgeVertical = SCREEN_EDGE_BOTTOM;
} }
} }
@ -698,18 +698,18 @@ XTheme::GetThemeTagSettings(const TagDict* DictPointer)
Prop = Dict3->propertyForKey("ScreenEdgeX"); Prop = Dict3->propertyForKey("ScreenEdgeX");
if (Prop != NULL && (Prop->isString()) && Prop->getString()->stringValue().notEmpty() ) { 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; NewFilm->ScreenEdgeHorizontal = SCREEN_EDGE_LEFT;
} else if (Prop->getString()->stringValue().equal("right")) { } else if (Prop->getString()->stringValue().isEqual("right")) {
NewFilm->ScreenEdgeHorizontal = SCREEN_EDGE_RIGHT; NewFilm->ScreenEdgeHorizontal = SCREEN_EDGE_RIGHT;
} }
} }
Prop = Dict3->propertyForKey("ScreenEdgeY"); Prop = Dict3->propertyForKey("ScreenEdgeY");
if (Prop != NULL && (Prop->isString()) && Prop->getString()->stringValue().notEmpty() ) { 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; NewFilm->ScreenEdgeVertical = SCREEN_EDGE_TOP;
} else if (Prop->getString()->stringValue().equal("bottom")) { } else if (Prop->getString()->stringValue().isEqual("bottom")) {
NewFilm->ScreenEdgeVertical = SCREEN_EDGE_BOTTOM; NewFilm->ScreenEdgeVertical = SCREEN_EDGE_BOTTOM;
} }
} }

View File

@ -121,6 +121,18 @@ public:
UINT32 IValue = 0; UINT32 IValue = 0;
XStringW SValue = XStringW(); XStringW SValue = XStringW();
UINTN LineShift = 0; 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 { typedef struct {

View File

@ -850,7 +850,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
FreePool(RootInfo); 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; void *Instance;
if (!EFI_ERROR(gBS->HandleProtocol(Volume->DeviceHandle, &gEfiPartTypeSystemPartGuid, &Instance))) { if (!EFI_ERROR(gBS->HandleProtocol(Volume->DeviceHandle, &gEfiPartTypeSystemPartGuid, &Instance))) {
@ -1207,7 +1207,7 @@ REFIT_VOLUME *FindVolumeByName(IN CONST CHAR16 *VolName)
if (!Volume) { if (!Volume) {
continue; continue;
} }
if (Volume->VolName.equal(VolName) == 0) { if (Volume->VolName.isEqual(VolName) == 0) {
return Volume; return Volume;
} }
} }

View File

@ -707,7 +707,7 @@ void LOADER_ENTRY::DelegateKernelPatches()
for (size_t kextPatchIdx = 0 ; kextPatchIdx < selectedPathArray.size() ; kextPatchIdx++ ) for (size_t kextPatchIdx = 0 ; kextPatchIdx < selectedPathArray.size() ; kextPatchIdx++ )
{ {
const ABSTRACT_KEXT_OR_KERNEL_PATCH& kextPatch = selectedPathArray[kextPatchIdx]; //as well as kernel patches 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 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]->Arch, OC_BLOB_GET(&mOpenCoreConfiguration.Kernel.Scheme.KernelArch));
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Base, kextPatch.ProcedureName.c_str()); 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; 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_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; 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_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 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; 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)"); // It's possible to memcpy the whole struct instead of assigning individual member. But that would be relying on internel C++ binary structure,
memcpy(&mOpenCoreConfiguration.Booter.Quirks, &gSettings.Quirks.ocBooterQuirks, sizeof(mOpenCoreConfiguration.Booter.Quirks)); // 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 #endif
@ -1016,9 +1034,27 @@ void LOADER_ENTRY::StartLoader()
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Scheme.KernelArch, "x86_64"); OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Scheme.KernelArch, "x86_64");
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Scheme.KernelCache, gSettings.Quirks.OcKernelCache.c_str()); OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Scheme.KernelCache, gSettings.Quirks.OcKernelCache.c_str());
mOpenCoreConfiguration.Kernel.Scheme.FuzzyMatch = gSettings.Quirks.FuzzyMatch; mOpenCoreConfiguration.Kernel.Scheme.FuzzyMatch = gSettings.Quirks.FuzzyMatch;
gSettings.Quirks.OcKernelQuirks.AppleXcpmCfgLock = GlobalConfig.KPKernelPm;
gSettings.Quirks.OcKernelQuirks.AppleCpuPmCfgLock = GlobalConfig.KPAppleIntelCPUPM; memset(&mOpenCoreConfiguration.Kernel.Quirks, 0, sizeof(mOpenCoreConfiguration.Kernel.Quirks));
memcpy(&mOpenCoreConfiguration.Kernel.Quirks, &gSettings.Quirks.OcKernelQuirks, 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.Count = (UINT32)kextArray.size();
mOpenCoreConfiguration.Kernel.Add.AllocCount = mOpenCoreConfiguration.Kernel.Add.Count; mOpenCoreConfiguration.Kernel.Add.AllocCount = mOpenCoreConfiguration.Kernel.Add.Count;
@ -1127,9 +1163,6 @@ void LOADER_ENTRY::StartLoader()
} }
#endif #endif
#ifndef USE_OC_SECTION_PlatformInfo
mOpenCoreConfiguration.Kernel.Quirks.CustomSmbiosGuid = gSettings.KernelAndKextPatches.KPDELLSMBIOS;
#endif
mOpenCoreConfiguration.Uefi.Output.ProvideConsoleGop = gSettings.GUI.ProvideConsoleGop; mOpenCoreConfiguration.Uefi.Output.ProvideConsoleGop = gSettings.GUI.ProvideConsoleGop;
OC_STRING_ASSIGN(mOpenCoreConfiguration.Uefi.Output.Resolution, XString8(gSettings.GUI.ScreenResolution).c_str()); OC_STRING_ASSIGN(mOpenCoreConfiguration.Uefi.Output.Resolution, XString8(gSettings.GUI.ScreenResolution).c_str());
@ -2441,7 +2474,7 @@ GetListOfDsdts()
if (DirEntry->FileName[0] == L'.') { if (DirEntry->FileName[0] == L'.') {
continue; continue;
} }
if ( gSettings.ACPI.DSDT.DsdtName.equalIC(DirEntry->FileName) ) { if ( gSettings.ACPI.DSDT.DsdtName.isEqualIC(DirEntry->FileName) ) {
OldChosenDsdt = DsdtsNum; OldChosenDsdt = DsdtsNum;
} }
NameLen = StrLen(DirEntry->FileName); //with ".aml" NameLen = StrLen(DirEntry->FileName); //with ".aml"
@ -2478,7 +2511,7 @@ GetListOfACPI()
INTN Count = gSettings.ACPI.DisabledAML.size(); INTN Count = gSettings.ACPI.DisabledAML.size();
for (INTN i = 0; i < Count; i++) { 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) && // if ((gSettings.ACPI.DisabledAML[i] != NULL) &&
// (StriCmp(ACPIPatchedAMLTmp->FileName, gSettings.ACPI.DisabledAML[i]) == 0) // (StriCmp(ACPIPatchedAMLTmp->FileName, gSettings.ACPI.DisabledAML[i]) == 0)
// ) { // ) {
@ -2663,7 +2696,7 @@ void afterGetUserSettings(SETTINGS_DATA& gSettings)
OldChosenTheme = 0xFFFF; //default for embedded OldChosenTheme = 0xFFFF; //default for embedded
for (UINTN i = 0; i < ThemeNameArray.size(); i++) { for (UINTN i = 0; i < ThemeNameArray.size(); i++) {
//now comparison is case sensitive //now comparison is case sensitive
if ( gSettings.GUI.Theme.equalIC(ThemeNameArray[i]) ) { if ( gSettings.GUI.Theme.isEqualIC(ThemeNameArray[i]) ) {
OldChosenTheme = i; OldChosenTheme = i;
break; break;
} }
@ -2710,9 +2743,9 @@ void afterGetUserSettings(SETTINGS_DATA& gSettings)
GlobalConfig.KPKernelPm = gSettings.KernelAndKextPatches._KPKernelPm || GlobalConfig.NeedPMfix; GlobalConfig.KPKernelPm = gSettings.KernelAndKextPatches._KPKernelPm || GlobalConfig.NeedPMfix;
GlobalConfig.KPAppleIntelCPUPM = gSettings.KernelAndKextPatches._KPAppleIntelCPUPM || 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); 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); GlobalConfig.RtROM.ncpy(&gLanMac[1][0], 6);
}else{ }else{
GlobalConfig.RtROM = gSettings.RtVariables.RtROMAsData; GlobalConfig.RtROM = gSettings.RtVariables.RtROMAsData;

View File

@ -231,7 +231,7 @@ void FillInputs(BOOLEAN New)
if (gGraphics[i].Vendor == Nvidia) { if (gGraphics[i].Vendor == Nvidia) {
InputItems[InputItemsCount].ItemType = ASString; //24+6i InputItems[InputItemsCount].ItemType = ASString; //24+6i
for (j=0; j<20; j++) { for (j=0; j<gSettings.Graphics.NVCAP.size(); j++) {
snprintf((CHAR8*)&tmp[2*j], 3, "%02hhX", gSettings.Graphics.NVCAP[j]); snprintf((CHAR8*)&tmp[2*j], 3, "%02hhX", gSettings.Graphics.NVCAP[j]);
} }
InputItems[InputItemsCount++].SValue.SWPrintf("%s", tmp); InputItems[InputItemsCount++].SValue.SWPrintf("%s", tmp);
@ -443,7 +443,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = BoolValue; //121 InputItems[InputItemsCount].ItemType = BoolValue; //121
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPPanicNoKextDump; InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPPanicNoKextDump;
InputItems[InputItemsCount].ItemType = Decimal; //122 InputItems[InputItemsCount].ItemType = Decimal; //122
InputItems[InputItemsCount++].SValue.SWPrintf("%04hhu", gSettings.Quirks.ocBooterQuirks.ProvideMaxSlide); InputItems[InputItemsCount++].SValue.SWPrintf("%04hhu", gSettings.Quirks.OcBooterQuirks.ProvideMaxSlide);
InputItems[InputItemsCount].ItemType = BoolValue; //123 InputItems[InputItemsCount].ItemType = BoolValue; //123
InputItems[InputItemsCount++].BValue = gSettings.GUI.ProvideConsoleGop; InputItems[InputItemsCount++].BValue = gSettings.GUI.ProvideConsoleGop;
@ -612,7 +612,7 @@ void ApplyInputs(void)
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
if (gGraphics[j].Vendor == Nvidia) { if (gGraphics[j].Vendor == Nvidia) {
if ( InputItems[i].SValue.notEmpty() ) { if ( InputItems[i].SValue.notEmpty() ) {
hex2bin(InputItems[i].SValue, (UINT8*)&gSettings.Graphics.NVCAP[0], sizeof(gSettings.Graphics.NVCAP)); hex2bin(InputItems[i].SValue, gSettings.Graphics.NVCAP.data(), gSettings.Graphics.NVCAP.size());
} }
} else { } else {
gGraphics[j].Connectors = (UINT32)StrHexToUint64(InputItems[i].SValue.wc_str()); gGraphics[j].Connectors = (UINT32)StrHexToUint64(InputItems[i].SValue.wc_str());
@ -909,22 +909,22 @@ void ApplyInputs(void)
i++; //101 - Quirks i++; //101 - Quirks
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.Quirks.QuirksMask = InputItems[i].IValue; gSettings.Quirks.QuirksMask = InputItems[i].IValue;
gSettings.Quirks.ocBooterQuirks.AvoidRuntimeDefrag = ((gSettings.Quirks.QuirksMask & QUIRK_DEFRAG) != 0); //1 gSettings.Quirks.OcBooterQuirks.AvoidRuntimeDefrag = ((gSettings.Quirks.QuirksMask & QUIRK_DEFRAG) != 0); //1
gSettings.Quirks.ocBooterQuirks.DevirtualiseMmio = ((gSettings.Quirks.QuirksMask & QUIRK_MMIO) != 0); //0 gSettings.Quirks.OcBooterQuirks.DevirtualiseMmio = ((gSettings.Quirks.QuirksMask & QUIRK_MMIO) != 0); //0
gSettings.Quirks.ocBooterQuirks.DisableSingleUser = ((gSettings.Quirks.QuirksMask & QUIRK_SU) != 0); //0 gSettings.Quirks.OcBooterQuirks.DisableSingleUser = ((gSettings.Quirks.QuirksMask & QUIRK_SU) != 0); //0
gSettings.Quirks.ocBooterQuirks.DisableVariableWrite = ((gSettings.Quirks.QuirksMask & QUIRK_VAR) != 0); //0 gSettings.Quirks.OcBooterQuirks.DisableVariableWrite = ((gSettings.Quirks.QuirksMask & QUIRK_VAR) != 0); //0
gSettings.Quirks.ocBooterQuirks.DiscardHibernateMap = ((gSettings.Quirks.QuirksMask & QUIRK_HIBER) != 0); //0 gSettings.Quirks.OcBooterQuirks.DiscardHibernateMap = ((gSettings.Quirks.QuirksMask & QUIRK_HIBER) != 0); //0
gSettings.Quirks.ocBooterQuirks.EnableSafeModeSlide = ((gSettings.Quirks.QuirksMask & QUIRK_SAFE) != 0); //1 gSettings.Quirks.OcBooterQuirks.EnableSafeModeSlide = ((gSettings.Quirks.QuirksMask & QUIRK_SAFE) != 0); //1
gSettings.Quirks.ocBooterQuirks.EnableWriteUnprotector = ((gSettings.Quirks.QuirksMask & QUIRK_UNPROT) != 0); //1 gSettings.Quirks.OcBooterQuirks.EnableWriteUnprotector = ((gSettings.Quirks.QuirksMask & QUIRK_UNPROT) != 0); //1
gSettings.Quirks.ocBooterQuirks.ForceExitBootServices = ((gSettings.Quirks.QuirksMask & QUIRK_EXIT) != 0); //0 gSettings.Quirks.OcBooterQuirks.ForceExitBootServices = ((gSettings.Quirks.QuirksMask & QUIRK_EXIT) != 0); //0
gSettings.Quirks.ocBooterQuirks.ProtectMemoryRegions = ((gSettings.Quirks.QuirksMask & QUIRK_REGION) != 0); //0 gSettings.Quirks.OcBooterQuirks.ProtectMemoryRegions = ((gSettings.Quirks.QuirksMask & QUIRK_REGION) != 0); //0
gSettings.Quirks.ocBooterQuirks.ProtectSecureBoot = ((gSettings.Quirks.QuirksMask & QUIRK_SECURE) != 0); //0 gSettings.Quirks.OcBooterQuirks.ProtectSecureBoot = ((gSettings.Quirks.QuirksMask & QUIRK_SECURE) != 0); //0
gSettings.Quirks.ocBooterQuirks.ProtectUefiServices = ((gSettings.Quirks.QuirksMask & QUIRK_UEFI) != 0); //0 gSettings.Quirks.OcBooterQuirks.ProtectUefiServices = ((gSettings.Quirks.QuirksMask & QUIRK_UEFI) != 0); //0
gSettings.Quirks.ocBooterQuirks.ProvideCustomSlide = ((gSettings.Quirks.QuirksMask & QUIRK_CUSTOM) != 0); //1 gSettings.Quirks.OcBooterQuirks.ProvideCustomSlide = ((gSettings.Quirks.QuirksMask & QUIRK_CUSTOM) != 0); //1
gSettings.Quirks.ocBooterQuirks.RebuildAppleMemoryMap = ((gSettings.Quirks.QuirksMask & QUIRK_MAP) != 0); //0 gSettings.Quirks.OcBooterQuirks.RebuildAppleMemoryMap = ((gSettings.Quirks.QuirksMask & QUIRK_MAP) != 0); //0
gSettings.Quirks.ocBooterQuirks.SetupVirtualMap = ((gSettings.Quirks.QuirksMask & QUIRK_VIRT) != 0); //1 gSettings.Quirks.OcBooterQuirks.SetupVirtualMap = ((gSettings.Quirks.QuirksMask & QUIRK_VIRT) != 0); //1
gSettings.Quirks.ocBooterQuirks.SignalAppleOS = ((gSettings.Quirks.QuirksMask & QUIRK_OS) != 0); //0 gSettings.Quirks.OcBooterQuirks.SignalAppleOS = ((gSettings.Quirks.QuirksMask & QUIRK_OS) != 0); //0
gSettings.Quirks.ocBooterQuirks.SyncRuntimePermissions = ((gSettings.Quirks.QuirksMask & QUIRK_PERM) != 0); //1 gSettings.Quirks.OcBooterQuirks.SyncRuntimePermissions = ((gSettings.Quirks.QuirksMask & QUIRK_PERM) != 0); //1
DBG("applied Quirks mask:%x\n", gSettings.Quirks.QuirksMask); //default is 0xA861 DBG("applied Quirks mask:%x\n", gSettings.Quirks.QuirksMask); //default is 0xA861
} }
i++; //102 i++; //102
@ -1057,8 +1057,8 @@ void ApplyInputs(void)
} }
i++; //122 i++; //122
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.Quirks.ocBooterQuirks.ProvideMaxSlide = (UINTN)StrDecimalToUintn(InputItems[i].SValue.wc_str()); gSettings.Quirks.OcBooterQuirks.ProvideMaxSlide = (UINTN)StrDecimalToUintn(InputItems[i].SValue.wc_str());
DBG(" set MaxSlide = %hhu\n", gSettings.Quirks.ocBooterQuirks.ProvideMaxSlide); DBG(" set MaxSlide = %hhu\n", gSettings.Quirks.OcBooterQuirks.ProvideMaxSlide);
} }
i++; //123 i++; //123
if (InputItems[i].Valid) { if (InputItems[i].Valid) {