Starting to refactor settings.

This commit is contained in:
jief666 2021-02-02 12:02:21 +03:00
parent 16c627596f
commit fa0bdcd181
25 changed files with 399 additions and 358 deletions

View File

@ -1905,7 +1905,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion)
//patch for FACS included here
Facs->Version = EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION;
if (GlobalConfig.SignatureFixup) {
if (gSettings.Boot.SignatureFixup) {
DBG(" SignatureFixup: 0x%X -> 0x%llX\n", Facs->HardwareSignature, machineSignature);
Facs->HardwareSignature = (UINT32)machineSignature;
} else {

View File

@ -256,7 +256,7 @@ void EFIAPI MemLogCallback(IN INTN DebugMode, IN CHAR8 *LastMessage)
printf("%s", LastMessage);
}
if ((DebugMode >= 1) && GlobalConfig.DebugLog) {
if ((DebugMode >= 1) && gSettings.Boot.DebugLog) {
SaveMessageToDebugLogFile(LastMessage);
}
}

View File

@ -560,7 +560,7 @@ SetupDataForOSX(BOOLEAN Hibernate)
AddSMCkey(SMC_MAKE_KEY('M','S','T','c'), 1, SmcKeyTypeUint8, (SMC_DATA *)&Zero); // CPU Plimit
AddSMCkey(SMC_MAKE_KEY('M','S','A','c'), 2, SmcKeyTypeUint16, (SMC_DATA *)&Zero);// GPU Plimit
// AddSMCkey(SMC_MAKE_KEY('M','S','L','D'), 1, SmcKeyTypeUint8, (SMC_DATA *)&Zero); //isLidClosed
Zero = Hibernate?((ResumeFromCoreStorage||GlobalConfig.HibernationFixup)?25:29):0;
Zero = Hibernate?((ResumeFromCoreStorage||gSettings.Boot.HibernationFixup)?25:29):0;
AddSMCkey(SMC_MAKE_KEY('M','S','W','r'), 1, SmcKeyTypeUint8, (SMC_DATA *)&Zero);
Zero = 1;

View File

@ -82,7 +82,7 @@ void DebugDumpEDID(CONST CHAR8 *Message, INTN N)
{
INTN i,j;
// Don't dump in the case of debug logging because of too slow output
if (GlobalConfig.DebugLog) {
if (gSettings.Boot.DebugLog) {
return;
}
DBG("%s size:%lld\n", Message, N);
@ -114,7 +114,7 @@ EFI_STATUS GetEdidDiscovered(void)
Status = gBS->LocateProtocol (&gEfiEdidDiscoveredProtocolGuid, NULL, (void **)&EdidDiscovered);
if (!EFI_ERROR(Status)) { //discovered
N = EdidDiscovered->SizeOfEdid;
if (!GlobalConfig.DebugLog) {
if (!gSettings.Boot.DebugLog) {
DBG("EdidDiscovered size=%llu\n", N);
}
if (N == 0) {

View File

@ -810,14 +810,14 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
//if sleep image is good but OSX was not hibernated.
//or we choose "cancel hibernate wake" then it must be canceled
if (GlobalConfig.NeverHibernate) {
if (gSettings.Boot.NeverHibernate) {
DBG(" hibernated: set as never\n");
return FALSE;
}
DBG(" Check if volume Is Hibernated:\n");
if (!GlobalConfig.StrictHibernate) {
if (!gSettings.Boot.StrictHibernate) {
// CloverEFI or UEFI with EmuVariable
if (IsSleepImageValidBySignature(Volume)) {
if ((gSleepTime == 0) || IsSleepImageValidBySleepTime(Volume)) {
@ -835,7 +835,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
}
if (!gFirmwareClover &&
(!gDriversFlags.EmuVariableLoaded || GlobalConfig.HibernationFixup)) {
(!gDriversFlags.EmuVariableLoaded || gSettings.Boot.HibernationFixup)) {
DBG(" UEFI with NVRAM? ");
Status = GetVariable2 (L"Boot0082", &gEfiGlobalVariableGuid, (void**)&Data, &Size);
if (EFI_ERROR(Status)) {
@ -872,7 +872,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
DBG(" Boot0082 points to Volume with UUID:%s\n", strguid(BootGUID));
//3. Checks for boot-image exists
if (GlobalConfig.StrictHibernate) {
if (gSettings.Boot.StrictHibernate) {
/*
Variable NV+RT+BS '7C436110-AB2A-4BBB-A880-FE41995C9F82:boot-image' DataSize = 0x3A
00000000: 02 01 0C 00 D0 41 03 0A-00 00 00 00 01 01 06 00 *.....A..........*
@ -995,7 +995,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume)
DBG("PrepareHibernation:\n");
if (!GlobalConfig.StrictHibernate) {
if (!gSettings.Boot.StrictHibernate) {
// Find sleep image offset
SleepImageOffset = GetSleepImagePosition (Volume, &SleepImageVolume);
DBG(" SleepImageOffset: %llx\n", SleepImageOffset);
@ -1050,7 +1050,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume)
//
// Work with RTC memory if allowed.
//
if (GlobalConfig.RtcHibernateAware) {
if (gSettings.Boot.RtcHibernateAware) {
UINT8 Index;
UINT8 *RtcRawVars = (UINT8 *)&RtcVars;
for (Index = 0; Index < sizeof(AppleRTCHibernateVars); Index++) {
@ -1153,7 +1153,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume)
// For now let's preserve old behaviour without RtcHibernateAware for compatibility reasons.
//
Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
if (!GlobalConfig.RtcHibernateAware) {
if (!gSettings.Boot.RtcHibernateAware) {
Attributes |= EFI_VARIABLE_NON_VOLATILE;
}

View File

@ -971,7 +971,7 @@ LoadLatestNvramPlist()
continue;
}
// DBG(" Status=%s\n", efiStrError(Status));
if (GlobalConfig.FastBoot) {
if (GlobalConfig.isFastBoot()) {
VolumeWithLatestNvramPlist = Volume;
break;
}
@ -1090,12 +1090,12 @@ PutNvramPlistToRtVars ()
if ( keyTag->keyStringValue() == "Boot0082"_XS8 || keyTag->keyStringValue() == "BootNext"_XS8 ) {
VendorGuid = &gEfiGlobalVariableGuid;
// it may happen only in this case
GlobalConfig.HibernationFixup = TRUE;
gSettings.Boot.HibernationFixup = TRUE;
}
// AsciiStrToUnicodeStrS(Tag.stringValue(), KeyBuf, 128);
XStringW KeyBuf = keyTag->keyStringValue();
if (!GlobalConfig.DebugLog) {
if (!gSettings.Boot.DebugLog) {
DBG(" Adding Key: %ls: ", KeyBuf.wc_str());
}
// process value tag
@ -1105,7 +1105,7 @@ PutNvramPlistToRtVars ()
// <string> element
Value = (void*)valueTag->getString()->stringValue().c_str();
Size = valueTag->getString()->stringValue().length();
if (!GlobalConfig.DebugLog) {
if (!gSettings.Boot.DebugLog) {
DBG("String: Size = %zu, Val = '%s'\n", Size, valueTag->getString()->stringValue().c_str());
}
@ -1114,13 +1114,13 @@ PutNvramPlistToRtVars ()
// <data> element
Size = valueTag->getData()->getData()->dataLenValue();
Value = valueTag->getData()->getData()->dataValue();
if (!GlobalConfig.DebugLog) {
if (!gSettings.Boot.DebugLog) {
DBG("Size = %zu, Data: ", Size);
for (size_t i = 0; i < Size; i++) {
DBG("%02hhX ", *(((UINT8*)Value) + i));
}
}
if (!GlobalConfig.DebugLog) {
if (!gSettings.Boot.DebugLog) {
DBG("\n");
}
} else {

View File

@ -328,17 +328,17 @@ GetBootFromOption(void)
NameSize = *(UINT16*)Data;
Data += 2; // pointer to Volume name
gSettings.DefaultVolume.strncpy((__typeof__(gSettings.DefaultVolume.wc_str()))Data, NameSize);
gSettings.Boot.DefaultVolume.strncpy((__typeof__(gSettings.Boot.DefaultVolume.wc_str()))Data, NameSize);
Data += NameSize;
Name2Size = Len - NameSize;
if (Name2Size != 0) {
gSettings.DefaultLoader.strncpy((__typeof__(gSettings.DefaultVolume.wc_str()))Data, NameSize);
gSettings.Boot.DefaultLoader.strncpy((__typeof__(gSettings.Boot.DefaultVolume.wc_str()))Data, NameSize);
}
DBG("Clover started with option to boot %ls from %ls\n",
gSettings.DefaultLoader.notEmpty() ? gSettings.DefaultLoader.wc_str() : L"legacy",
gSettings.DefaultVolume.wc_str());
gSettings.Boot.DefaultLoader.notEmpty() ? gSettings.Boot.DefaultLoader.wc_str() : L"legacy",
gSettings.Boot.DefaultVolume.wc_str());
}
//
@ -2262,18 +2262,18 @@ GetEarlyUserSettings (
// const TagDict* DictPointer;
// const TagStruct* Prop;
// const TagArray* arrayProp;
void *Value = NULL;
BOOLEAN SpecialBootMode = FALSE;
// void *Value = NULL;
// BOOLEAN SpecialBootMode = FALSE;
{
UINTN Size = 0;
//read aptiofixflag from nvram for special boot
Status = GetVariable2(L"aptiofixflag", &gEfiAppleBootGuid, &Value, &Size);
if (!EFI_ERROR(Status)) {
SpecialBootMode = TRUE;
FreePool(Value);
}
}
// {
// UINTN Size = 0;
// //read aptiofixflag from nvram for special boot
// Status = GetVariable2(L"aptiofixflag", &gEfiAppleBootGuid, &Value, &Size);
// if (!EFI_ERROR(Status)) {
// SpecialBootMode = TRUE;
// FreePool(Value);
// }
// }
gSettings.KextPatchesAllowed = TRUE;
gSettings.KernelAndKextPatches.KPAppleRTC = TRUE;
@ -2288,35 +2288,35 @@ GetEarlyUserSettings (
if (BootDict != NULL) {
const TagStruct* Prop = BootDict->propertyForKey("Timeout");
if (Prop != NULL) {
GlobalConfig.Timeout = (INT32)GetPropertyAsInteger(Prop, GlobalConfig.Timeout);
DBG("timeout set to %lld\n", GlobalConfig.Timeout);
gSettings.Boot.Timeout = (INT32)GetPropertyAsInteger(Prop, gSettings.Boot.Timeout);
DBG("timeout set to %lld\n", gSettings.Boot.Timeout);
}
Prop = BootDict->propertyForKey("SkipHibernateTimeout");
gSettings.SkipHibernateTimeout = IsPropertyNotNullAndTrue(Prop);
gSettings.Boot.SkipHibernateTimeout = IsPropertyNotNullAndTrue(Prop);
//DisableCloverHotkeys
Prop = BootDict->propertyForKey("DisableCloverHotkeys");
gSettings.DisableCloverHotkeys = IsPropertyNotNullAndTrue(Prop);
gSettings.Boot.DisableCloverHotkeys = IsPropertyNotNullAndTrue(Prop);
Prop = BootDict->propertyForKey("Arguments");
if (Prop != NULL && (Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
gSettings.BootArgs = Prop->getString()->stringValue();
gSettings.Boot.BootArgs = Prop->getString()->stringValue();
}
// defaults if "DefaultVolume" is not present or is empty
gSettings.LastBootedVolume = FALSE;
// gSettings.DefaultVolume = NULL;
gSettings.Boot.LastBootedVolume = FALSE;
// gSettings.Boot.DefaultVolume = NULL;
Prop = BootDict->propertyForKey("DefaultVolume");
if (Prop != NULL) {
if ( Prop->isString() && Prop->getString()->stringValue().notEmpty() ) {
gSettings.DefaultVolume.setEmpty();
gSettings.Boot.DefaultVolume.setEmpty();
// check for special value for remembering boot volume
if (Prop->getString()->stringValue().equalIC("LastBootedVolume")) {
gSettings.LastBootedVolume = TRUE;
gSettings.Boot.LastBootedVolume = TRUE;
} else {
gSettings.DefaultVolume = Prop->getString()->stringValue();
gSettings.Boot.DefaultVolume = Prop->getString()->stringValue();
}
}
}
@ -2326,50 +2326,50 @@ GetEarlyUserSettings (
if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in DefaultLoader\n");
}else{
gSettings.DefaultLoader = Prop->getString()->stringValue();
gSettings.Boot.DefaultLoader = Prop->getString()->stringValue();
}
}
Prop = BootDict->propertyForKey("Debug");
if ( Prop ) {
if ( Prop->isString() ) {
if ( Prop->getString()->stringValue().equalIC("true") ) GlobalConfig.DebugLog = true;
else if ( Prop->getString()->stringValue().equalIC("false") ) GlobalConfig.DebugLog = false;
if ( Prop->getString()->stringValue().equalIC("true") ) gSettings.Boot.DebugLog = true;
else if ( Prop->getString()->stringValue().equalIC("false") ) gSettings.Boot.DebugLog = false;
else MsgLog("MALFORMED config.plist : property Boot/Debug must be true, false, or scratch\n");
}else if ( Prop->isBool() ) {
GlobalConfig.DebugLog = Prop->getBool()->boolValue();
gSettings.Boot.DebugLog = Prop->getBool()->boolValue();
}else{
MsgLog("MALFORMED config.plist : property Boot/Debug must be a string (true, false) or <true/> or <false/>\n");
}
}
Prop = BootDict->propertyForKey("Fast");
GlobalConfig.FastBoot = IsPropertyNotNullAndTrue(Prop);
gSettings.Boot.FastBoot = IsPropertyNotNullAndTrue(Prop);
Prop = BootDict->propertyForKey("NoEarlyProgress");
GlobalConfig.NoEarlyProgress = IsPropertyNotNullAndTrue(Prop);
gSettings.Boot.NoEarlyProgress = IsPropertyNotNullAndTrue(Prop);
if (SpecialBootMode) {
GlobalConfig.FastBoot = TRUE;
DBG("Fast option enabled\n");
}
// if (SpecialBootMode) {
// GlobalConfig.isFastBoot() = TRUE;
// DBG("Fast option enabled\n");
// }
Prop = BootDict->propertyForKey("NeverHibernate");
GlobalConfig.NeverHibernate = IsPropertyNotNullAndTrue(Prop);
gSettings.Boot.NeverHibernate = IsPropertyNotNullAndTrue(Prop);
Prop = BootDict->propertyForKey("StrictHibernate");
GlobalConfig.StrictHibernate = IsPropertyNotNullAndTrue(Prop);
gSettings.Boot.StrictHibernate = IsPropertyNotNullAndTrue(Prop);
Prop = BootDict->propertyForKey("RtcHibernateAware");
GlobalConfig.RtcHibernateAware = IsPropertyNotNullAndTrue(Prop);
gSettings.Boot.RtcHibernateAware = IsPropertyNotNullAndTrue(Prop);
Prop = BootDict->propertyForKey("HibernationFixup");
if (Prop) {
GlobalConfig.HibernationFixup = IsPropertyNotNullAndTrue(Prop); //it will be set automatically
gSettings.Boot.HibernationFixup = IsPropertyNotNullAndTrue(Prop); //it will be set automatically
}
Prop = BootDict->propertyForKey("SignatureFixup");
GlobalConfig.SignatureFixup = IsPropertyNotNullAndTrue(Prop);
gSettings.Boot.SignatureFixup = IsPropertyNotNullAndTrue(Prop);
// Prop = GetProperty(DictPointer, "GetLegacyLanAddress");
// GetLegacyLanAddress = IsPropertyTrue(Prop);
@ -2379,11 +2379,11 @@ GetEarlyUserSettings (
if (Prop != NULL) {
if ( Prop->isFalse() ) {
// Only disable setup mode, we want always secure boot
gSettings.SecureBootSetupMode = 0;
} else if ( Prop->isTrue() && !gSettings.SecureBoot ) {
gSettings.Boot.SecureBootSetupMode = 0;
} else if ( Prop->isTrue() && !gSettings.Boot.SecureBoot ) {
// This mode will force boot policy even when no secure boot or it is disabled
gSettings.SecureBootSetupMode = 1;
gSettings.SecureBoot = 1;
gSettings.Boot.SecureBootSetupMode = 1;
gSettings.Boot.SecureBoot = 1;
}
}
// Secure boot policy
@ -2391,25 +2391,25 @@ GetEarlyUserSettings (
if (Prop != NULL && (Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
if ((Prop->getString()->stringValue()[0] == 'D') || (Prop->getString()->stringValue()[0] == 'd')) {
// Deny all images
gSettings.SecureBootPolicy = SECURE_BOOT_POLICY_DENY;
gSettings.Boot.SecureBootPolicy = SECURE_BOOT_POLICY_DENY;
} else if ((Prop->getString()->stringValue()[0] == 'A') || (Prop->getString()->stringValue()[0] == 'a')) {
// Allow all images
gSettings.SecureBootPolicy = SECURE_BOOT_POLICY_ALLOW;
gSettings.Boot.SecureBootPolicy = SECURE_BOOT_POLICY_ALLOW;
} else if ((Prop->getString()->stringValue()[0] == 'Q') || (Prop->getString()->stringValue()[0] == 'q')) {
// Query user
gSettings.SecureBootPolicy = SECURE_BOOT_POLICY_QUERY;
gSettings.Boot.SecureBootPolicy = SECURE_BOOT_POLICY_QUERY;
} else if ((Prop->getString()->stringValue()[0] == 'I') || (Prop->getString()->stringValue()[0] == 'i')) {
// Insert
gSettings.SecureBootPolicy = SECURE_BOOT_POLICY_INSERT;
gSettings.Boot.SecureBootPolicy = SECURE_BOOT_POLICY_INSERT;
} else if ((Prop->getString()->stringValue()[0] == 'W') || (Prop->getString()->stringValue()[0] == 'w')) {
// White list
gSettings.SecureBootPolicy = SECURE_BOOT_POLICY_WHITELIST;
gSettings.Boot.SecureBootPolicy = SECURE_BOOT_POLICY_WHITELIST;
} else if ((Prop->getString()->stringValue()[0] == 'B') || (Prop->getString()->stringValue()[0] == 'b')) {
// Black list
gSettings.SecureBootPolicy = SECURE_BOOT_POLICY_BLACKLIST;
gSettings.Boot.SecureBootPolicy = SECURE_BOOT_POLICY_BLACKLIST;
} else if ((Prop->getString()->stringValue()[0] == 'U') || (Prop->getString()->stringValue()[0] == 'u')) {
// User policy
gSettings.SecureBootPolicy = SECURE_BOOT_POLICY_USER;
gSettings.Boot.SecureBootPolicy = SECURE_BOOT_POLICY_USER;
}
}
// Secure boot white list
@ -2418,9 +2418,9 @@ GetEarlyUserSettings (
INTN i;
INTN Count = arrayProp->arrayContent().size();
if (Count > 0) {
gSettings.SecureBootWhiteListCount = 0;
gSettings.SecureBootWhiteList = (__typeof__(gSettings.SecureBootWhiteList))AllocateZeroPool(Count * sizeof(CHAR16 *));
if (gSettings.SecureBootWhiteList) {
gSettings.Boot.SecureBootWhiteListCount = 0;
gSettings.Boot.SecureBootWhiteList = (__typeof__(gSettings.Boot.SecureBootWhiteList))AllocateZeroPool(Count * sizeof(CHAR16 *));
if (gSettings.Boot.SecureBootWhiteList) {
for (i = 0; i < Count; i++) {
const TagStruct* prop2 = &arrayProp->arrayContent()[i];
if ( !prop2->isString() ) {
@ -2428,7 +2428,7 @@ GetEarlyUserSettings (
continue;
}
if ( prop2->getString()->stringValue().notEmpty() ) {
gSettings.SecureBootWhiteList[gSettings.SecureBootWhiteListCount++] = SWPrintf("%s", prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing();
gSettings.Boot.SecureBootWhiteList[gSettings.Boot.SecureBootWhiteListCount++] = SWPrintf("%s", prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing();
}
}
}
@ -2440,9 +2440,9 @@ GetEarlyUserSettings (
INTN i;
INTN Count = arrayProp->arrayContent().size();
if (Count > 0) {
gSettings.SecureBootBlackListCount = 0;
gSettings.SecureBootBlackList = (__typeof__(gSettings.SecureBootBlackList))AllocateZeroPool(Count * sizeof(CHAR16 *));
if (gSettings.SecureBootBlackList) {
gSettings.Boot.SecureBootBlackListCount = 0;
gSettings.Boot.SecureBootBlackList = (__typeof__(gSettings.Boot.SecureBootBlackList))AllocateZeroPool(Count * sizeof(CHAR16 *));
if (gSettings.Boot.SecureBootBlackList) {
for (i = 0; i < Count; i++) {
const TagStruct* prop2 = &arrayProp->arrayContent()[i];
if ( !prop2->isString() ) {
@ -2450,7 +2450,7 @@ GetEarlyUserSettings (
continue;
}
if ( prop2->getString()->stringValue().notEmpty() ) {
gSettings.SecureBootBlackList[gSettings.SecureBootBlackListCount++] = SWPrintf("%s", prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing();
gSettings.Boot.SecureBootBlackList[gSettings.Boot.SecureBootBlackListCount++] = SWPrintf("%s", prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing();
}
}
}
@ -2460,23 +2460,23 @@ GetEarlyUserSettings (
// XMP memory profiles
Prop = BootDict->propertyForKey("XMPDetection");
if (Prop != NULL) {
gSettings.XMPDetection = 0;
gSettings.Boot.XMPDetection = 0;
if ( Prop->isFalse() ) {
gSettings.XMPDetection = -1;
gSettings.Boot.XMPDetection = -1;
} else if ( Prop->isString() ) {
if ((Prop->getString()->stringValue()[0] == 'n') ||
(Prop->getString()->stringValue()[0] == 'N') ||
(Prop->getString()->stringValue()[0] == '-')) {
gSettings.XMPDetection = -1;
gSettings.Boot.XMPDetection = -1;
} else {
gSettings.XMPDetection = (INT8)AsciiStrDecimalToUintn(Prop->getString()->stringValue().c_str());
gSettings.Boot.XMPDetection = (INT8)AsciiStrDecimalToUintn(Prop->getString()->stringValue().c_str());
}
} else if (Prop->isInt64()) {
gSettings.XMPDetection = (INT8)Prop->getInt64()->intValue();
gSettings.Boot.XMPDetection = (INT8)Prop->getInt64()->intValue();
}
// Check that the setting value is sane
if ((gSettings.XMPDetection < -1) || (gSettings.XMPDetection > 2)) {
gSettings.XMPDetection = -1;
if ((gSettings.Boot.XMPDetection < -1) || (gSettings.Boot.XMPDetection > 2)) {
gSettings.Boot.XMPDetection = -1;
}
}
@ -2486,65 +2486,65 @@ GetEarlyUserSettings (
if ( !Prop->isString() ) {
MsgLog("ATTENTION : Prop property not string in Legacy\n");
}else{
gSettings.LegacyBoot = Prop->getString()->stringValue();
gSettings.Boot.LegacyBoot = Prop->getString()->stringValue();
}
} else if (gFirmwareClover) {
// default for CLOVER EFI boot
gSettings.LegacyBoot = "PBR"_XS8;
gSettings.Boot.LegacyBoot = "PBR"_XS8;
} else {
// default for UEFI boot
gSettings.LegacyBoot = "LegacyBiosDefault"_XS8;
gSettings.Boot.LegacyBoot = "LegacyBiosDefault"_XS8;
}
// Entry for LegacyBiosDefault
Prop = BootDict->propertyForKey("LegacyBiosDefaultEntry");
if (Prop != NULL) {
gSettings.LegacyBiosDefaultEntry = (UINT16)GetPropertyAsInteger(Prop, 0); // disabled by default
gSettings.Boot.LegacyBiosDefaultEntry = (UINT16)GetPropertyAsInteger(Prop, 0); // disabled by default
}
// Whether or not to draw boot screen
Prop = BootDict->propertyForKey("CustomLogo");
if (Prop != NULL) {
if (IsPropertyNotNullAndTrue(Prop)) {
gSettings.CustomBoot = CUSTOM_BOOT_APPLE;
gSettings.Boot.CustomBoot = CUSTOM_BOOT_APPLE;
} else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
if (Prop->getString()->stringValue().equalIC("Apple")) {
gSettings.CustomBoot = CUSTOM_BOOT_APPLE;
gSettings.Boot.CustomBoot = CUSTOM_BOOT_APPLE;
} else if (Prop->getString()->stringValue().equalIC("Alternate")) {
gSettings.CustomBoot = CUSTOM_BOOT_ALT_APPLE;
gSettings.Boot.CustomBoot = CUSTOM_BOOT_ALT_APPLE;
} else if (Prop->getString()->stringValue().equalIC("Theme")) {
gSettings.CustomBoot = CUSTOM_BOOT_THEME;
gSettings.Boot.CustomBoot = CUSTOM_BOOT_THEME;
} else {
XStringW customLogo = XStringW() = Prop->getString()->stringValue();
gSettings.CustomBoot = CUSTOM_BOOT_USER;
if (gSettings.CustomLogo != NULL) {
delete gSettings.CustomLogo;
gSettings.Boot.CustomBoot = CUSTOM_BOOT_USER;
if (gSettings.Boot.CustomLogo != NULL) {
delete gSettings.Boot.CustomLogo;
}
gSettings.CustomLogo = new XImage;
gSettings.CustomLogo->LoadXImage(&self.getSelfVolumeRootDir(), customLogo);
if (gSettings.CustomLogo->isEmpty()) {
gSettings.Boot.CustomLogo = new XImage;
gSettings.Boot.CustomLogo->LoadXImage(&self.getSelfVolumeRootDir(), customLogo);
if (gSettings.Boot.CustomLogo->isEmpty()) {
DBG("Custom boot logo not found at path `%ls`!\n", customLogo.wc_str());
gSettings.CustomBoot = CUSTOM_BOOT_DISABLED;
gSettings.Boot.CustomBoot = CUSTOM_BOOT_DISABLED;
}
}
} else if ( Prop->isData() && Prop->getData()->dataLenValue() > 0 ) {
gSettings.CustomBoot = CUSTOM_BOOT_USER;
if (gSettings.CustomLogo != NULL) {
delete gSettings.CustomLogo;
gSettings.Boot.CustomBoot = CUSTOM_BOOT_USER;
if (gSettings.Boot.CustomLogo != NULL) {
delete gSettings.Boot.CustomLogo;
}
gSettings.CustomLogo = new XImage;
gSettings.CustomLogo->FromPNG(Prop->getData()->dataValue(), Prop->getData()->dataLenValue());
if (gSettings.CustomLogo->isEmpty()) {
gSettings.Boot.CustomLogo = new XImage;
gSettings.Boot.CustomLogo->FromPNG(Prop->getData()->dataValue(), Prop->getData()->dataLenValue());
if (gSettings.Boot.CustomLogo->isEmpty()) {
DBG("Custom boot logo not decoded from data!\n"/*, Prop->getString()->stringValue().c_str()*/);
gSettings.CustomBoot = CUSTOM_BOOT_DISABLED;
gSettings.Boot.CustomBoot = CUSTOM_BOOT_DISABLED;
}
} else {
gSettings.CustomBoot = CUSTOM_BOOT_USER_DISABLED;
gSettings.Boot.CustomBoot = CUSTOM_BOOT_USER_DISABLED;
}
} else {
gSettings.CustomBoot = CUSTOM_BOOT_DISABLED;
gSettings.Boot.CustomBoot = CUSTOM_BOOT_DISABLED;
}
DBG("Custom boot %s (0x%llX)\n", CustomBootModeToStr(gSettings.CustomBoot), (uintptr_t)gSettings.CustomLogo);
DBG("Custom boot %s (0x%llX)\n", CustomBootModeToStr(gSettings.Boot.CustomBoot), (uintptr_t)gSettings.Boot.CustomLogo);
}
//*** SYSTEM ***
@ -2584,11 +2584,11 @@ GetEarlyUserSettings (
const TagDict* GUIDict = CfgDict->dictPropertyForKey("GUI");
if (GUIDict != NULL) {
const TagStruct* Prop = GUIDict->propertyForKey("Timezone");
GlobalConfig.Timezone = (INT32)GetPropertyAsInteger(Prop, GlobalConfig.Timezone);
gSettings.GUI.Timezone = (INT32)GetPropertyAsInteger(Prop, gSettings.GUI.Timezone);
//initialize Daylight when we know timezone
EFI_TIME Now;
gRT->GetTime(&Now, NULL);
INT32 NowHour = Now.Hour + GlobalConfig.Timezone;
INT32 NowHour = Now.Hour + gSettings.GUI.Timezone;
if (NowHour < 0 ) NowHour += 24;
if (NowHour >= 24 ) NowHour -= 24;
ThemeX.Daylight = (NowHour > 8) && (NowHour < 20);
@ -2596,12 +2596,12 @@ GetEarlyUserSettings (
Prop = GUIDict->propertyForKey("Theme");
if (Prop != NULL && (Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
ThemeX.Theme.takeValueFrom(Prop->getString()->stringValue());
GlobalConfig.Theme.takeValueFrom(Prop->getString()->stringValue());
DBG("Default theme: %ls\n", GlobalConfig.Theme.wc_str());
gSettings.GUI.Theme.takeValueFrom(Prop->getString()->stringValue());
DBG("Default theme: %ls\n", gSettings.GUI.Theme.wc_str());
OldChosenTheme = 0xFFFF; //default for embedded
for (UINTN i = 0; i < ThemeNameArray.size(); i++) {
//now comparison is case sensitive
if ( GlobalConfig.Theme.equalIC(ThemeNameArray[i]) ) {
if ( gSettings.GUI.Theme.equalIC(ThemeNameArray[i]) ) {
OldChosenTheme = i;
break;
}
@ -2626,16 +2626,16 @@ GetEarlyUserSettings (
// CustomIcons
Prop = GUIDict->propertyForKey("CustomIcons");
GlobalConfig.CustomIcons = IsPropertyNotNullAndTrue(Prop);
gSettings.GUI.CustomIcons = IsPropertyNotNullAndTrue(Prop);
Prop = GUIDict->propertyForKey("TextOnly");
GlobalConfig.TextOnly = IsPropertyNotNullAndTrue(Prop);
gSettings.GUI.TextOnly = IsPropertyNotNullAndTrue(Prop);
Prop = GUIDict->propertyForKey("ShowOptimus");
GlobalConfig.ShowOptimus = IsPropertyNotNullAndTrue(Prop);
gSettings.GUI.ShowOptimus = IsPropertyNotNullAndTrue(Prop);
Prop = GUIDict->propertyForKey("ScreenResolution");
if (Prop != NULL) {
if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
GlobalConfig.ScreenResolution.takeValueFrom(Prop->getString()->stringValue());
gSettings.GUI.ScreenResolution.takeValueFrom(Prop->getString()->stringValue());
}
}
@ -2645,20 +2645,20 @@ GetEarlyUserSettings (
Prop = GUIDict->propertyForKey("ConsoleMode");
if (Prop != NULL) {
if (Prop->isInt64()) {
GlobalConfig.ConsoleMode = Prop->getInt64()->intValue();
gSettings.GUI.ConsoleMode = Prop->getInt64()->intValue();
} else if ((Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
if ( Prop->getString()->stringValue().contains("Max") ) {
GlobalConfig.ConsoleMode = -1;
gSettings.GUI.ConsoleMode = -1;
DBG("ConsoleMode will be set to highest mode\n");
} else if ( Prop->getString()->stringValue().contains("Min") ) {
GlobalConfig.ConsoleMode = -2;
gSettings.GUI.ConsoleMode = -2;
DBG("ConsoleMode will be set to lowest mode\n");
} else {
GlobalConfig.ConsoleMode = (INT32)AsciiStrDecimalToUintn(Prop->getString()->stringValue());
gSettings.GUI.ConsoleMode = (INT32)AsciiStrDecimalToUintn(Prop->getString()->stringValue());
}
}
if (GlobalConfig.ConsoleMode > 0) {
DBG("ConsoleMode will be set to mode #%lld\n", GlobalConfig.ConsoleMode);
if (gSettings.GUI.ConsoleMode > 0) {
DBG("ConsoleMode will be set to mode #%lld\n", gSettings.GUI.ConsoleMode);
}
}
@ -2667,16 +2667,16 @@ GetEarlyUserSettings (
gSettings.Language = Prop->getString()->stringValue();
if ( Prop->getString()->stringValue().contains("en") ) {
gLanguage = english;
GlobalConfig.Codepage = 0xC0;
GlobalConfig.CodepageSize = 0;
gSettings.GUI.Codepage = 0xC0;
gSettings.GUI.CodepageSize = 0;
} else if ( Prop->getString()->stringValue().contains("ru")) {
gLanguage = russian;
GlobalConfig.Codepage = 0x410;
GlobalConfig.CodepageSize = 0x40;
gSettings.GUI.Codepage = 0x410;
gSettings.GUI.CodepageSize = 0x40;
} else if ( Prop->getString()->stringValue().contains("ua")) {
gLanguage = ukrainian;
GlobalConfig.Codepage = 0x400;
GlobalConfig.CodepageSize = 0x60;
gSettings.GUI.Codepage = 0x400;
gSettings.GUI.CodepageSize = 0x60;
} else if ( Prop->getString()->stringValue().contains("fr")) {
gLanguage = french; //default is extended latin
} else if ( Prop->getString()->stringValue().contains("it")) {
@ -2701,14 +2701,14 @@ GetEarlyUserSettings (
gLanguage = indonesian;
} else if ( Prop->getString()->stringValue().contains("zh_CN")) {
gLanguage = chinese;
GlobalConfig.Codepage = 0x3400;
GlobalConfig.CodepageSize = 0x19C0;
gSettings.GUI.Codepage = 0x3400;
gSettings.GUI.CodepageSize = 0x19C0;
} else if ( Prop->getString()->stringValue().contains("ro")) {
gLanguage = romanian;
} else if ( Prop->getString()->stringValue().contains("ko")) {
gLanguage = korean;
GlobalConfig.Codepage = 0x1100;
GlobalConfig.CodepageSize = 0x100;
gSettings.GUI.Codepage = 0x1100;
gSettings.GUI.CodepageSize = 0x100;
}
}
@ -2769,7 +2769,7 @@ GetEarlyUserSettings (
if (IsPropertyNotNullAndFalse(Prop)) {
gSettings.DisableEntryScan = TRUE;
gSettings.DisableToolScan = TRUE;
GlobalConfig.NoLegacy = TRUE;
gSettings.GUI.NoLegacy = TRUE;
} else if (Prop->isDict()) {
const TagStruct* prop2 = Prop->getDict()->propertyForKey("Entries");
if (IsPropertyNotNullAndFalse(prop2)) {
@ -2784,12 +2784,12 @@ GetEarlyUserSettings (
prop2 = Prop->getDict()->propertyForKey("Legacy");
if (prop2 != NULL) {
if (prop2->isFalse()) {
GlobalConfig.NoLegacy = TRUE;
gSettings.GUI.NoLegacy = TRUE;
} else if ((prop2->isString()) && prop2->getString()->stringValue().notEmpty() ) {
if ((prop2->getString()->stringValue()[0] == 'N') || (prop2->getString()->stringValue()[0] == 'n')) {
GlobalConfig.NoLegacy = TRUE;
gSettings.GUI.NoLegacy = TRUE;
} else if ((prop2->getString()->stringValue()[0] == 'F') || (prop2->getString()->stringValue()[0] == 'f')) {
GlobalConfig.LegacyFirst = TRUE;
gSettings.GUI.LegacyFirst = TRUE;
}
}
}
@ -3901,8 +3901,8 @@ InitTheme(BOOLEAN UseThemeDefinedInNVRam)
ThemeX.Init();
//initialize Daylight when we know timezone
if (GlobalConfig.Timezone != 0xFF) { // 0xFF:default=timezone not set
INT32 NowHour = Now.Hour + GlobalConfig.Timezone;
if (gSettings.GUI.Timezone != 0xFF) { // 0xFF:default=timezone not set
INT32 NowHour = Now.Hour + gSettings.GUI.Timezone;
if (NowHour < 0 ) NowHour += 24;
if (NowHour >= 24 ) NowHour -= 24;
ThemeX.Daylight = (NowHour > 8) && (NowHour < 20);
@ -3950,7 +3950,7 @@ InitTheme(BOOLEAN UseThemeDefinedInNVRam)
ThemeX.GetThemeTagSettings(NULL);
if (ThemeNameArray.size() > 0 &&
(GlobalConfig.Theme.isEmpty() || StriCmp(GlobalConfig.Theme.wc_str(), L"embedded") != 0)) {
(gSettings.GUI.Theme.isEmpty() || StriCmp(gSettings.GUI.Theme.wc_str(), L"embedded") != 0)) {
// Try special theme first
XStringW TestTheme;
// if (Time != NULL) {
@ -3965,7 +3965,7 @@ InitTheme(BOOLEAN UseThemeDefinedInNVRam)
if (ThemeDict != NULL) {
DBG("special theme %ls found and %ls parsed\n", TestTheme.wc_str(), CONFIG_THEME_FILENAME);
// ThemeX.Theme.takeValueFrom(TestTheme);
GlobalConfig.Theme = TestTheme;
gSettings.GUI.Theme = TestTheme;
} else { // special theme not loaded
DBG("special theme %ls not found, skipping\n", TestTheme.wc_str()/*, CONFIG_THEME_FILENAME*/);
@ -3991,10 +3991,10 @@ InitTheme(BOOLEAN UseThemeDefinedInNVRam)
if (ThemeDict != NULL) {
DBG("theme %s defined in NVRAM found and %ls parsed\n", ChosenTheme, CONFIG_THEME_FILENAME);
// ThemeX.Theme.takeValueFrom(TestTheme);
GlobalConfig.Theme = TestTheme;
gSettings.GUI.Theme = TestTheme;
} else { // theme from nvram not loaded
if (GlobalConfig.Theme.notEmpty()) {
DBG("theme %s chosen from nvram is absent, using theme defined in config: %ls\n", ChosenTheme, GlobalConfig.Theme.wc_str());
if (gSettings.GUI.Theme.notEmpty()) {
DBG("theme %s chosen from nvram is absent, using theme defined in config: %ls\n", ChosenTheme, gSettings.GUI.Theme.wc_str());
} else {
DBG("theme %s chosen from nvram is absent, get first theme\n", ChosenTheme);
}
@ -4007,18 +4007,18 @@ InitTheme(BOOLEAN UseThemeDefinedInNVRam)
}
// Try to get theme from settings
if (ThemeDict == NULL) {
if (GlobalConfig.Theme.isEmpty()) {
if (gSettings.GUI.Theme.isEmpty()) {
DBG("no default theme, get random theme %ls\n", ThemeNameArray[Rnd].wc_str());
ThemeDict = ThemeX.LoadTheme(XStringW(ThemeNameArray[Rnd]));
} else {
if (StriCmp(GlobalConfig.Theme.wc_str(), L"random") == 0) {
if (StriCmp(gSettings.GUI.Theme.wc_str(), L"random") == 0) {
ThemeDict = ThemeX.LoadTheme(XStringW(ThemeNameArray[Rnd]));
} else {
ThemeDict = ThemeX.LoadTheme(GlobalConfig.Theme);
ThemeDict = ThemeX.LoadTheme(gSettings.GUI.Theme);
if (ThemeDict == NULL) {
DBG("GlobalConfig: %ls not found, get embedded theme\n", GlobalConfig.Theme.wc_str());
DBG("GlobalConfig: %ls not found, get embedded theme\n", gSettings.GUI.Theme.wc_str());
} else {
DBG("chosen theme %ls\n", GlobalConfig.Theme.wc_str());
DBG("chosen theme %ls\n", gSettings.GUI.Theme.wc_str());
}
}
}
@ -4050,7 +4050,7 @@ finish:
Status = StartupSoundPlay(&ThemeX.getThemeDir(), NULL);
} else { // theme loaded successfully
ThemeX.embedded = false;
ThemeX.Theme.takeValueFrom(GlobalConfig.Theme); //XStringW from CHAR16*)
ThemeX.Theme.takeValueFrom(gSettings.GUI.Theme); //XStringW from CHAR16*)
// read theme settings
if (!ThemeX.TypeSVG) {
const TagDict* DictPointer = ThemeDict->dictPropertyForKey("Theme");
@ -5088,8 +5088,8 @@ GetUserSettings(const TagDict* CfgDict)
if (BootDict != NULL) {
const TagStruct* Prop = BootDict->propertyForKey("Arguments");
if ( Prop != NULL && Prop->isString() && Prop->getString()->stringValue().notEmpty() && !gSettings.BootArgs.contains(Prop->getString()->stringValue()) ) {
gSettings.BootArgs = Prop->getString()->stringValue();
if ( Prop != NULL && Prop->isString() && Prop->getString()->stringValue().notEmpty() && !gSettings.Boot.BootArgs.contains(Prop->getString()->stringValue()) ) {
gSettings.Boot.BootArgs = Prop->getString()->stringValue();
//gBootArgsChanged = TRUE;
//gBootChanged = TRUE;
}
@ -6248,13 +6248,13 @@ GetUserSettings(const TagDict* CfgDict)
//DBG("\n ConfigName: %ls n", gSettings.ConfigName);
}
if (gThemeChanged) {
GlobalConfig.Theme.setEmpty();
gSettings.GUI.Theme.setEmpty();
const TagDict* GUIDict = CfgDict->dictPropertyForKey("GUI");
if (GUIDict != NULL) {
const TagStruct* Prop = GUIDict->propertyForKey("Theme");
if ((Prop != NULL) && (Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
GlobalConfig.Theme.takeValueFrom(Prop->getString()->stringValue());
DBG("Theme from new config: %ls\n", GlobalConfig.Theme.wc_str());
gSettings.GUI.Theme.takeValueFrom(Prop->getString()->stringValue());
DBG("Theme from new config: %ls\n", gSettings.GUI.Theme.wc_str());
}
}
}
@ -8436,7 +8436,7 @@ checkOffset(CpuType);
xb.cat(SetTable132);
xb.cat(TrustSMBIOS);
xb.cat(InjectMemoryTables);
xb.cat(XMPDetection);
xb.cat(Boot.XMPDetection);
xb.cat(UseARTFreq);
// SMBIOS TYPE133
xb.ncat(&pad18, sizeof(pad18));
@ -8448,7 +8448,7 @@ checkOffset(CpuType);
// OS parameters
WriteOldFixLengthString(Language, 16);
checkOffset(BootArgs);
WriteOldFixLengthString(BootArgs, 256);
WriteOldFixLengthString(Boot.BootArgs, 256);
xb.memsetAtPos(xb.size(), 0, 1);
checkOffset(CustomUuid);
WriteOldFixLengthString(XStringW(CustomUuid), 40);
@ -8458,8 +8458,8 @@ checkOffset(DefaultVolume);
xb.cat(uintptr_t(0)); //DefaultLoader was CHAR16*
//Boot
checkOffset(LastBootedVolume);
xb.cat(LastBootedVolume);
xb.cat(SkipHibernateTimeout);
xb.cat(Boot.LastBootedVolume);
xb.cat(Boot.SkipHibernateTimeout);
//Monitor
xb.cat(IntelMaxBacklight);
xb.ncat(&pad21, sizeof(pad21));
@ -8576,15 +8576,15 @@ checkOffset(GraphicsInjector);
// Secure boot white/black list
checkOffset(SecureBootWhiteListCount);
xb.cat(SecureBootWhiteListCount);
xb.cat(SecureBootBlackListCount);
xb.cat(SecureBootWhiteList);
xb.cat(SecureBootBlackList);
xb.cat(Boot.SecureBootWhiteListCount);
xb.cat(Boot.SecureBootBlackListCount);
xb.cat(Boot.SecureBootWhiteList);
xb.cat(Boot.SecureBootBlackList);
// Secure boot
xb.cat(SecureBoot);
xb.cat(SecureBootSetupMode);
xb.cat(SecureBootPolicy);
xb.cat(Boot.SecureBoot);
xb.cat(Boot.SecureBootSetupMode);
xb.cat(Boot.SecureBootPolicy);
// HDA
xb.cat(HDAInjection);
@ -8604,8 +8604,8 @@ checkOffset(SecureBootWhiteListCount);
// LegacyBoot
checkOffset(LegacyBoot);
WriteOldFixLengthString(LegacyBoot, 32);
xb.cat(LegacyBiosDefaultEntry);
WriteOldFixLengthString(Boot.LegacyBoot, 32);
xb.cat(Boot.LegacyBiosDefaultEntry);
//SkyLake
xb.cat(HWP);
@ -8634,9 +8634,9 @@ checkOffset(LegacyBoot);
// UINT8 pad7[6]);
checkOffset(CustomBoot);
xb.cat(CustomBoot);
xb.cat(Boot.CustomBoot);
xb.ncat(&pad29, sizeof(pad29));
xb.cat(CustomLogo);
xb.cat(Boot.CustomLogo);
xb.cat(RefCLK);
// SysVariables
@ -8650,7 +8650,7 @@ checkOffset(CsrActiveConfig);
xb.cat(CsrActiveConfig);
xb.cat(BooterConfig);
WriteOldFixLengthString(BooterCfgStr, 64);
xb.cat(DisableCloverHotkeys);
xb.cat(Boot.DisableCloverHotkeys);
xb.cat(NeverDoRecovery);
// Multi-config

View File

@ -244,6 +244,57 @@ public :
class SETTINGS_DATA {
public:
class BootClass {
public:
INTN Timeout = -1;
bool SkipHibernateTimeout = false;
bool DisableCloverHotkeys = false;
XString8 BootArgs = XString8();
bool LastBootedVolume = false;
XStringW DefaultVolume = XStringW();
XStringW DefaultLoader = XStringW();
bool DebugLog = false;
bool FastBoot = false;
bool NoEarlyProgress = false;
bool NeverHibernate = false;
bool StrictHibernate = false;
bool RtcHibernateAware = false;
bool HibernationFixup = false;
bool SignatureFixup = false;
UINT8 SecureBoot = 0;
UINT8 SecureBootSetupMode = 0;
UINT8 SecureBootPolicy = 0;
// Secure boot white/black list
UINT32 SecureBootWhiteListCount = 0;
UINT32 SecureBootBlackListCount = 0;
CHAR16 **SecureBootWhiteList = 0;
CHAR16 **SecureBootBlackList = 0;
INT8 XMPDetection = 0;
// LegacyBoot
XStringW LegacyBoot = XStringW();
UINT16 LegacyBiosDefaultEntry = 0;
UINT8 CustomBoot = 0;
XImage *CustomLogo = 0;
} Boot = BootClass();
class GUIClass {
public:
INT32 Timezone = 0xFF;
XStringW Theme = XStringW();
bool CustomIcons = false;
bool TextOnly = false;
bool ShowOptimus = false;
XStringW ScreenResolution = XStringW();
INTN ConsoleMode = 0;
INTN Codepage = 0xC0;
INTN CodepageSize = 0xC0;
bool LegacyFirst = false;
bool NoLegacy = false;
} GUI = GUIClass();
// SMBIOS TYPE0
XString8 VendorName;
XString8 RomVersion;
@ -297,7 +348,6 @@ public:
BOOLEAN SetTable132;
BOOLEAN TrustSMBIOS;
BOOLEAN InjectMemoryTables;
INT8 XMPDetection;
BOOLEAN UseARTFreq;
INT8 pad18[3];
@ -310,16 +360,11 @@ public:
// OS parameters
INT8 pad181[7];
XString8 Language;
XString8 BootArgs;
INT8 pad19[2];
XString8 CustomUuid;
INT8 pad20[6];
XStringW DefaultVolume;
XStringW DefaultLoader;
//Boot
BOOLEAN LastBootedVolume;
BOOLEAN SkipHibernateTimeout;
//Monitor
BOOLEAN IntelMaxBacklight;
UINT8 pad21[1];
@ -435,17 +480,6 @@ public:
UINT32 DualLink;
UINT32 IgPlatform;
// Secure boot white/black list
UINT32 SecureBootWhiteListCount;
UINT32 SecureBootBlackListCount;
CHAR16 **SecureBootWhiteList;
CHAR16 **SecureBootBlackList;
// Secure boot
UINT8 SecureBoot;
UINT8 SecureBootSetupMode;
UINT8 SecureBootPolicy;
// HDA
BOOLEAN HDAInjection;
@ -464,9 +498,6 @@ public:
// UINT8 pad61[2];
// LegacyBoot
XStringW LegacyBoot;
UINT16 LegacyBiosDefaultEntry;
//SkyLake
BOOLEAN HWP;
@ -494,9 +525,7 @@ public:
BOOLEAN PointerMirror;
// UINT8 pad7[6];
UINT8 CustomBoot;
UINT8 pad29[6];
XImage *CustomLogo;
UINT32 RefCLK;
@ -508,7 +537,6 @@ public:
UINT32 CsrActiveConfig;
UINT16 BooterConfig;
XString8 BooterCfgStr;
BOOLEAN DisableCloverHotkeys;
BOOLEAN NeverDoRecovery;
// Multi-config
@ -615,9 +643,9 @@ public:
pad0{0}, FamilyName(), OEMProduct(), OEMVendor(), BoardManufactureName(), BoardSerialNumber(), BoardNumber(), LocationInChassis(),
BoardVersion(), OEMBoard(), BoardType(0), pad1(0), Mobile(0), ChassisType(0), ChassisManufacturer(), ChassisAssetTag(), CpuFreqMHz(0),
BusSpeed(0), Turbo(0), EnabledCores(0), UserChange(0), QEMU(0), SmbiosVersion(0), Attribute(0), pad17{0}, MemoryManufacturer(),
MemorySerialNumber(), MemoryPartNumber(), MemorySpeed(), CpuType(0), QPI(0), SetTable132(0), TrustSMBIOS(0), InjectMemoryTables(0), XMPDetection(0),
UseARTFreq(0), PlatformFeature(0), NoRomInfo(0), Language(), BootArgs(), CustomUuid(), DefaultVolume(), DefaultLoader(), LastBootedVolume(0),
SkipHibernateTimeout(0), IntelMaxBacklight(0), VendorEDID(0), ProductEDID(0), BacklightLevel(0), BacklightLevelConfig(0), IntelBacklight(0), MemoryFix(0), WithKexts(0),
MemorySerialNumber(), MemoryPartNumber(), MemorySpeed(), CpuType(0), QPI(0), SetTable132(0), TrustSMBIOS(0), InjectMemoryTables(0),
UseARTFreq(0), PlatformFeature(0), NoRomInfo(0), Language(), CustomUuid(),
IntelMaxBacklight(0), VendorEDID(0), ProductEDID(0), BacklightLevel(0), BacklightLevelConfig(0), IntelBacklight(0), MemoryFix(0), WithKexts(0),
WithKextsIfNoFakeSMC(0), FakeSMCFound(0), NoCaches(0), Debug(0), pad22{0}, DefaultBackgroundColor(0), ResetAddr(0), ResetVal(0), NoASPM(0),
DropSSDT(0), NoOemTableId(0), NoDynamicExtract(0), AutoMerge(0), GeneratePStates(0), GenerateCStates(0), GenerateAPSN(0), GenerateAPLF(0), GeneratePluginType(0),
PLimitDict(0), UnderVoltStep(0), DoubleFirstState(0), SuspendOverride(0), EnableC2(0), EnableC4(0), EnableC6(0), EnableISS(0), SlpSmiEnable(0),
@ -627,11 +655,11 @@ public:
InjectIntel(0), InjectATI(0), InjectNVidia(0), DeInit(0), LoadVBios(0), PatchVBios(0), PatchVBiosBytes(0), PatchVBiosBytesCount(0), InjectEDID(0),
LpcTune(0), DropOEM_DSM(0), CustomEDID(0), CustomEDIDsize(0), EdidFixHorizontalSyncPulseWidth(0), EdidFixVideoInputSignal(0), FBName(), VideoPorts(0), NvidiaGeneric(0),
NvidiaNoEFI(0), NvidiaSingle(0), VRAM(0), Dcfg{0}, NVCAP{0}, BootDisplay(0), NvidiaWeb(0), pad41{0}, DualLink(0),
IgPlatform(0), SecureBootWhiteListCount(0), SecureBootBlackListCount(0), SecureBootWhiteList(0), SecureBootBlackList(0), SecureBoot(0), SecureBootSetupMode(0), SecureBootPolicy(0), HDAInjection(0),
IgPlatform(0), HDAInjection(0),
HDALayoutId(0), USBInjection(0), USBFixOwnership(0), InjectClockID(0), HighCurrent(0), NameEH00(0), NameXH00(0), LANInjection(0), HDMIInjection(0),
LegacyBoot(), LegacyBiosDefaultEntry(0), HWP(0), TDP(0), HWPValue(0), HVHideStrings(), KernelAndKextPatches(), KextPatchesAllowed(0),
KernelPatchesAllowed(0), AirportBridgeDeviceName(), KbdPrevLang(0), PointerEnabled(0), PointerSpeed(0), DoubleClickTime(0), PointerMirror(0), CustomBoot(0), CustomLogo(0),
RefCLK(0), RtMLB(), RtROM(), CsrActiveConfig(0), BooterConfig(0), BooterCfgStr(), DisableCloverHotkeys(0), NeverDoRecovery(0),
HWP(0), TDP(0), HWPValue(0), HVHideStrings(), KernelAndKextPatches(), KextPatchesAllowed(0),
KernelPatchesAllowed(0), AirportBridgeDeviceName(), KbdPrevLang(0), PointerEnabled(0), PointerSpeed(0), DoubleClickTime(0), PointerMirror(0),
RefCLK(0), RtMLB(), RtROM(), CsrActiveConfig(0), BooterConfig(0), BooterCfgStr(), NeverDoRecovery(0),
ConfigName{0}, /*MainConfigName(0),*/ /*BlackListCount(0),*/ DisabledDriverArray(), RPlt{0}, RBr{0}, EPCI{0}, REV{0}, Rtc8Allowed(0),
ForceHPET(0), ResetHDA(0), PlayAsync(0), DisableFunctions(0), DSDTPatchArray(), DebugDSDT(0), SlpWak(0), UseIntelHDMI(0),
AFGLowPowerState(0), PNLF_UID(0), ACPIDropTables(0), DisableEntryScan(0), DisableToolScan(0), KernelScan(0), LinuxScan(0), CustomEntries(0),
@ -832,29 +860,29 @@ extern EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl;
class REFIT_CONFIG
{
public:
INTN Timeout;
// INTN Timeout;
UINTN DisableFlags; //to disable some volume types (optical, firewire etc)
BOOLEAN TextOnly;
// BOOLEAN TextOnly;
BOOLEAN Quiet;
BOOLEAN LegacyFirst;
BOOLEAN NoLegacy;
BOOLEAN DebugLog;
BOOLEAN FastBoot;
BOOLEAN NeverHibernate;
BOOLEAN StrictHibernate;
BOOLEAN RtcHibernateAware;
BOOLEAN HibernationFixup;
BOOLEAN SignatureFixup;
XStringW Theme;
XStringW ScreenResolution;
INTN ConsoleMode;
BOOLEAN CustomIcons;
// BOOLEAN LegacyFirst;
// BOOLEAN NoLegacy;
// BOOLEAN DebugLog;
BOOLEAN SpecialBootMode; // content of nvram var "aptiofixflag"
// BOOLEAN NeverHibernate;
// BOOLEAN StrictHibernate;
// BOOLEAN RtcHibernateAware;
// BOOLEAN HibernationFixup;
// BOOLEAN SignatureFixup;
// XStringW Theme;
// XStringW ScreenResolution;
// INTN ConsoleMode;
// BOOLEAN CustomIcons;
INTN IconFormat;
BOOLEAN NoEarlyProgress;
INT32 Timezone;
BOOLEAN ShowOptimus;
INTN Codepage;
INTN CodepageSize;
// BOOLEAN NoEarlyProgress;
// INT32 Timezone;
// BOOLEAN ShowOptimus;
// INTN Codepage;
// INTN CodepageSize;
/*
* Defqult ctor :
@ -884,14 +912,16 @@ public:
};
*
*/
REFIT_CONFIG() : Timeout(-1), DisableFlags(0), TextOnly(FALSE), Quiet(TRUE), LegacyFirst(FALSE), NoLegacy(FALSE),
DebugLog(FALSE), FastBoot(FALSE), NeverHibernate(FALSE), StrictHibernate(FALSE),
RtcHibernateAware(FALSE), HibernationFixup(FALSE), SignatureFixup(FALSE), Theme(), ScreenResolution(), ConsoleMode(0), CustomIcons(FALSE), IconFormat(ICON_FORMAT_DEF), NoEarlyProgress(FALSE), Timezone(0xFF),
ShowOptimus(FALSE), Codepage(0xC0), CodepageSize(0xC0) {};
REFIT_CONFIG() : DisableFlags(0), Quiet(TRUE),
SpecialBootMode(FALSE),
IconFormat(ICON_FORMAT_DEF)
{};
REFIT_CONFIG(const REFIT_CONFIG& other) = delete; // Can be defined if needed
const REFIT_CONFIG& operator = ( const REFIT_CONFIG & ) = delete; // Can be defined if needed
~REFIT_CONFIG() { }
bool isFastBoot() { return SpecialBootMode || gSettings.Boot.FastBoot; }
} ;

View File

@ -1439,7 +1439,7 @@ void GetDefaultSettings()
gSettings.BooterCfgStr.takeValueFrom(OldCfgStr);
FreePool(OldCfgStr);
}
gSettings.DisableCloverHotkeys = FALSE;
gSettings.Boot.DisableCloverHotkeys = FALSE;
gSettings.UIScale = 1;
ResumeFromCoreStorage = FALSE;

View File

@ -477,7 +477,7 @@ UINT16 getDDRspeedMhz(UINT8 * spd)
if (xmpProfiles) {
MsgLog("Found module with XMP version %d.%d\n", (xmpVersion >> 4) & 0xF, xmpVersion & 0xF);
switch (gSettings.XMPDetection) {
switch (gSettings.Boot.XMPDetection) {
case 0:
// Detect the better XMP profile
if (xmpFrequency1 >= xmpFrequency2) {
@ -516,14 +516,14 @@ UINT16 getDDRspeedMhz(UINT8 * spd)
}
} else {
// Print out XMP not detected
switch (gSettings.XMPDetection) {
switch (gSettings.Boot.XMPDetection) {
case 0:
DBG("Not using XMP because it is not present\n");
break;
case 1:
case 2:
DBG("Not using XMP Profile%d because it is not present\n", gSettings.XMPDetection);
DBG("Not using XMP Profile%d because it is not present\n", gSettings.Boot.XMPDetection);
break;
default:

View File

@ -748,9 +748,9 @@ EFI_STATUS InitBootScreen(IN LOADER_ENTRY *Entry)
if (customBoot == CUSTOM_BOOT_USER) {
logo = Entry->CustomLogo;
} else if (customBoot == CUSTOM_BOOT_DISABLED) {
customBoot = gSettings.CustomBoot;
customBoot = gSettings.Boot.CustomBoot;
if (customBoot == CUSTOM_BOOT_USER) {
logo = *gSettings.CustomLogo;
logo = *gSettings.Boot.CustomLogo;
}
}
switch (customBoot) {

View File

@ -600,7 +600,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
if (OSFLAG_ISSET(Flags, OSFLAG_NODEFAULTARGS)) {
Entry->LoadOptions = LoaderOptions;
}else{
Entry->LoadOptions = Split<XString8Array>(gSettings.BootArgs, " ");
Entry->LoadOptions = Split<XString8Array>(gSettings.Boot.BootArgs, " ");
Entry->LoadOptions.import(LoaderOptions);
}
//actions
@ -740,7 +740,7 @@ if ( Entry->APFSTargetUUID.startWith("99999999") ) {
Entry->ShortcutLetter = (Hotkey == 0) ? ShortcutLetter : Hotkey;
// get custom volume icon if present
if (GlobalConfig.CustomIcons && FileExists(Volume->RootDir, L"\\.VolumeIcon.icns")){
if (gSettings.GUI.CustomIcons && FileExists(Volume->RootDir, L"\\.VolumeIcon.icns")){
Entry->Image.Image.LoadIcns(Volume->RootDir, L"\\.VolumeIcon.icns", 128);
if (!Entry->Image.Image.isEmpty()) {
Entry->Image.setFilled();

View File

@ -63,7 +63,7 @@ void EnableSecureBoot(void)
UINTN CloverSignatureSize = 0;
void *CloverSignature = NULL;
// Check in setup mode
if (gSettings.SecureBoot || !gSettings.SecureBootSetupMode) {
if (gSettings.Boot.SecureBoot || !gSettings.Boot.SecureBootSetupMode) {
return;
}
// Ask user if they want to use default keys
@ -148,12 +148,12 @@ CONST CHAR16 *SecureBootPolicyToStr(IN UINTN Policy)
STATIC void PrintSecureBootInfo(void)
{
// Nothing to do if secure boot is disabled or in setup mode
if (!gSettings.SecureBoot) {
DBG("Secure Boot: %s\n", (gSettings.SecureBootSetupMode ? "Setup" : "Disabled"));
if (!gSettings.Boot.SecureBoot) {
DBG("Secure Boot: %s\n", (gSettings.Boot.SecureBootSetupMode ? "Setup" : "Disabled"));
} else {
// Secure boot is enabled
DBG("Secure Boot: %s\n", (gSettings.SecureBootSetupMode ? "Forced" : "Enabled"));
DBG("Boot Policy: %ls\n", SecureBootPolicyToStr(gSettings.SecureBootPolicy));
DBG("Secure Boot: %s\n", (gSettings.Boot.SecureBootSetupMode ? "Forced" : "Enabled"));
DBG("Boot Policy: %ls\n", SecureBootPolicyToStr(gSettings.Boot.SecureBootPolicy));
}
}
@ -178,7 +178,7 @@ void DisableSecureBoot(void)
EFI_STATUS Status;
CHAR16 *ErrorString = NULL;
// Check in user mode
if (gSettings.SecureBootSetupMode || !gSettings.SecureBoot) {
if (gSettings.Boot.SecureBootSetupMode || !gSettings.Boot.SecureBoot) {
return;
}
UninstallSecureBoot();
@ -221,7 +221,7 @@ PrecheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationSt
if ((AuthenticationStatus == NULL) || (DevicePath == NULL)) {
return FALSE;
}
switch (gSettings.SecureBootPolicy) {
switch (gSettings.Boot.SecureBootPolicy) {
case SECURE_BOOT_POLICY_ALLOW:
// Allow all images
*AuthenticationStatus = EFI_SUCCESS;
@ -233,9 +233,9 @@ PrecheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationSt
if (DevicePathStr == NULL) {
return FALSE;
}
for (Index = 0; Index < gSettings.SecureBootWhiteListCount; ++Index) {
if ((gSettings.SecureBootWhiteList[Index] != NULL) &&
(StriStr(DevicePathStr, gSettings.SecureBootWhiteList[Index]) != NULL)) {
for (Index = 0; Index < gSettings.Boot.SecureBootWhiteListCount; ++Index) {
if ((gSettings.Boot.SecureBootWhiteList[Index] != NULL) &&
(StriStr(DevicePathStr, gSettings.Boot.SecureBootWhiteList[Index]) != NULL)) {
// White listed
*AuthenticationStatus = EFI_SUCCESS;
return TRUE;
@ -249,9 +249,9 @@ PrecheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationSt
if (DevicePathStr == NULL) {
return FALSE;
}
for (Index = 0; Index < gSettings.SecureBootBlackListCount; ++Index) {
if ((gSettings.SecureBootBlackList[Index] != NULL) &&
(StriStr(DevicePathStr, gSettings.SecureBootBlackList[Index]) != NULL)) {
for (Index = 0; Index < gSettings.Boot.SecureBootBlackListCount; ++Index) {
if ((gSettings.Boot.SecureBootBlackList[Index] != NULL) &&
(StriStr(DevicePathStr, gSettings.Boot.SecureBootBlackList[Index]) != NULL)) {
// Black listed
return TRUE;
}
@ -265,17 +265,17 @@ PrecheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationSt
return FALSE;
}
// Check the black list for this image
for (Index = 0; Index < gSettings.SecureBootBlackListCount; ++Index) {
if ((gSettings.SecureBootBlackList[Index] != NULL) &&
(StriStr(DevicePathStr, gSettings.SecureBootBlackList[Index]) != NULL)) {
for (Index = 0; Index < gSettings.Boot.SecureBootBlackListCount; ++Index) {
if ((gSettings.Boot.SecureBootBlackList[Index] != NULL) &&
(StriStr(DevicePathStr, gSettings.Boot.SecureBootBlackList[Index]) != NULL)) {
// Black listed
return TRUE;
}
}
// Check the white list for this image
for (Index = 0; Index < gSettings.SecureBootWhiteListCount; ++Index) {
if ((gSettings.SecureBootWhiteList[Index] != NULL) &&
(StriStr(DevicePathStr, gSettings.SecureBootWhiteList[Index]) != NULL)) {
for (Index = 0; Index < gSettings.Boot.SecureBootWhiteListCount; ++Index) {
if ((gSettings.Boot.SecureBootWhiteList[Index] != NULL) &&
(StriStr(DevicePathStr, gSettings.Boot.SecureBootWhiteList[Index]) != NULL)) {
// White listed
*AuthenticationStatus = EFI_SUCCESS;
return TRUE;
@ -294,7 +294,7 @@ CheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationStatu
IN UINTN FileSize)
{
UINTN UserResponse = SECURE_BOOT_POLICY_DENY;
switch (gSettings.SecureBootPolicy) {
switch (gSettings.Boot.SecureBootPolicy) {
case SECURE_BOOT_POLICY_QUERY:
case SECURE_BOOT_POLICY_USER:
// Query user to allow image or deny image or insert image signature
@ -311,7 +311,7 @@ CheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationStatu
case SECURE_BOOT_POLICY_INSERT:
// If this is forced mode then no insert
if (gSettings.SecureBootSetupMode) {
if (gSettings.Boot.SecureBootSetupMode) {
return TRUE;
}
break;
@ -421,7 +421,7 @@ EFI_STATUS InstallSecureBoot(void)
}
PrintSecureBootInfo();
// Nothing to do if secure boot is disabled or in setup mode
if (!gSettings.SecureBoot || gSettings.SecureBootSetupMode) {
if (!gSettings.Boot.SecureBoot || gSettings.Boot.SecureBootSetupMode) {
return EFI_SUCCESS;
}
// Locate security protocols
@ -471,16 +471,16 @@ void UninstallSecureBoot(void)
void InitializeSecureBoot(void)
{
// Set secure boot variables to firmware values
UINTN Size = sizeof(gSettings.SecureBootSetupMode);
gRT->GetVariable(L"SetupMode", &gEfiGlobalVariableGuid, NULL, &Size, &gSettings.SecureBootSetupMode);
Size = sizeof(gSettings.SecureBoot);
gRT->GetVariable(L"SecureBoot", &gEfiGlobalVariableGuid, NULL, &Size, &gSettings.SecureBoot);
UINTN Size = sizeof(gSettings.Boot.SecureBootSetupMode);
gRT->GetVariable(L"SetupMode", &gEfiGlobalVariableGuid, NULL, &Size, &gSettings.Boot.SecureBootSetupMode);
Size = sizeof(gSettings.Boot.SecureBoot);
gRT->GetVariable(L"SecureBoot", &gEfiGlobalVariableGuid, NULL, &Size, &gSettings.Boot.SecureBoot);
// Make sure that secure boot is disabled if in setup mode, this will
// allow us to specify later in settings that we want to override
// setup mode and pretend like we are in secure boot mode to enforce
// secure boot policy even when secure boot is not present/disabled.
if (gSettings.SecureBootSetupMode) {
gSettings.SecureBoot = 0;
if (gSettings.Boot.SecureBootSetupMode) {
gSettings.Boot.SecureBoot = 0;
}
}

View File

@ -61,10 +61,10 @@ void AddSecureBootTool(void)
{
LOADER_ENTRY *Entry;
// If in forced mode or no secure boot then don't add tool
if (!gSettings.SecureBoot && !gSettings.SecureBootSetupMode) {
if (!gSettings.Boot.SecureBoot && !gSettings.Boot.SecureBootSetupMode) {
return;
}
if (gSettings.SecureBoot) {
if (gSettings.Boot.SecureBoot) {
Entry = new REFIT_MENU_ENTRY_SECURE_BOOT();
Entry->Title.SWPrintf("Clover Secure Boot Configuration");
// Entry->Tag = TAG_SECURE_BOOT_CONFIG;
@ -113,7 +113,7 @@ UINTN QuerySecureBootUser(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
UINTN MenuExit;
// Update the menu
QueryUserMenu.InfoLines = Information;
QueryUserMenu.Entries.size() = gSettings.SecureBootSetupMode ? 2 : 3;
QueryUserMenu.Entries.size() = gSettings.Boot.SecureBootSetupMode ? 2 : 3;
// Debug message
DBG("VerifySecureBootImage: Query user for authentication action for %ls\n", Information[1]);
// Because we may
@ -412,14 +412,14 @@ BOOLEAN ConfigureSecureBoot(void)
REFIT_MENU_ENTRY *ChosenEntry = NULL;
EFI_DEVICE_PATH *DevicePath = NULL;
// Add the entry for secure boot policy
SecureBootPolicyEntry.Title.SPrintf("Secure boot policy: %ls", SecureBootPolicyToStr(gSettings.SecureBootPolicy));
SecureBootPolicyEntry.Title.SPrintf("Secure boot policy: %ls", SecureBootPolicyToStr(gSettings.Boot.SecureBootPolicy));
if (SecureBootPolicyEntry.Title.isEmpty()) {
break;
}
SecureBootPolicyMenu.Title = SecureBootPolicyEntry.Title;
SecureBootMenu.Entries[Index++] = &SecureBootPolicyEntry;
// Get the proper entries for the secure boot mode
if (!gSettings.SecureBootSetupMode) {
if (!gSettings.Boot.SecureBootSetupMode) {
SecureBootMenu.Entries[Index++] = &InsertImageSignatureEntry;
SecureBootMenu.Entries[Index++] = &RemoveImageSignatureEntry;
SecureBootMenu.Entries[Index++] = &ClearImageSignatureEntry;
@ -449,8 +449,8 @@ BOOLEAN ConfigureSecureBoot(void)
case SECURE_BOOT_POLICY_BLACKLIST:
case SECURE_BOOT_POLICY_USER:
// Set a new policy
gSettings.SecureBootPolicy = (UINT8)ChosenEntry->Tag;
DBG("User changed secure boot policy: %ls\n", SecureBootPolicyToStr(gSettings.SecureBootPolicy));
gSettings.Boot.SecureBootPolicy = (UINT8)ChosenEntry->Tag;
DBG("User changed secure boot policy: %ls\n", SecureBootPolicyToStr(gSettings.Boot.SecureBootPolicy));
default:
MenuExit = MENU_EXIT_ESCAPE;
@ -492,7 +492,7 @@ BOOLEAN ConfigureSecureBoot(void)
if (YesNoMessage(L"Disable Secure Boot", L"Are you sure you want to disable secure boot?")) {
DBG("User disabled secure boot\n");
DisableSecureBoot();
if (!gSettings.SecureBoot) {
if (!gSettings.Boot.SecureBoot) {
return TRUE;
}
AlertMessage(L"Disable Secure Boot", L"Disabling secure boot failed!\nClover does not appear to own the PK");

View File

@ -402,7 +402,7 @@ EFI_STATUS SetSignedVariable(IN CHAR16 *DatabaseName,
}
DBG("Timestamp: %t\n", Timestamp);
// In user mode we need to sign the database with exchange key
if (!gSettings.SecureBootSetupMode) {
if (!gSettings.Boot.SecureBootSetupMode) {
// Initialize the cyphers and digests
ERR_load_crypto_strings();
OpenSSL_add_all_digests();
@ -504,8 +504,8 @@ EFI_STATUS SetSignatureDatabase(IN CHAR16 *DatabaseName,
{
EFI_STATUS Status;
// Check is valid to set database
if ((gSettings.SecureBoot && gSettings.SecureBootSetupMode) ||
(!gSettings.SecureBoot && !gSettings.SecureBootSetupMode)) {
if ((gSettings.Boot.SecureBoot && gSettings.Boot.SecureBootSetupMode) ||
(!gSettings.Boot.SecureBoot && !gSettings.Boot.SecureBootSetupMode)) {
return EFI_NOT_FOUND;
}
// Erase database

View File

@ -797,8 +797,8 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN MENU_STYLE_FUNC StyleFunc, IN OUT INT
// do this BEFORE calling StyleFunc.
EFI_TIME Now;
gRT->GetTime(&Now, NULL);
if (GlobalConfig.Timezone != 0xFF) {
INT32 NowHour = Now.Hour + GlobalConfig.Timezone;
if (gSettings.GUI.Timezone != 0xFF) {
INT32 NowHour = Now.Hour + gSettings.GUI.Timezone;
if (NowHour < 0 ) NowHour += 24;
if (NowHour >= 24 ) NowHour -= 24;
Daylight = (NowHour > 8) && (NowHour < 20); //this is the screen member
@ -1953,7 +1953,7 @@ void REFIT_MENU_SCREEN::DrawTextCorner(UINTN TextC, UINT8 Align)
// HIDEUI_ALL - included
((TextC == TEXT_CORNER_REVISION) && ((ThemeX.HideUIFlags & HIDEUI_FLAG_REVISION) != 0)) ||
((TextC == TEXT_CORNER_HELP) && ((ThemeX.HideUIFlags & HIDEUI_FLAG_HELP) != 0)) ||
((TextC == TEXT_CORNER_OPTIMUS) && (GlobalConfig.ShowOptimus == FALSE))
((TextC == TEXT_CORNER_OPTIMUS) && (gSettings.GUI.ShowOptimus == FALSE))
) {
return;
}
@ -2596,8 +2596,8 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC
if (MenuExit == MENU_EXIT_DETAILS && MainChosenEntry->SubScreen != NULL) {
XString8Array TmpArgs;
if ( gSettings.BootArgs.length() > 0) {
TmpArgs = Split<XString8Array>(gSettings.BootArgs, " ");
if ( gSettings.Boot.BootArgs.length() > 0) {
TmpArgs = Split<XString8Array>(gSettings.Boot.BootArgs, " ");
}
SubMenuIndex = -1;
@ -2658,11 +2658,11 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC
if (/*MenuExit == MENU_EXIT_ENTER &&*/ TempChosenEntry->getLOADER_ENTRY()) {
if (TempChosenEntry->getLOADER_ENTRY()->LoadOptions.notEmpty()) {
gSettings.BootArgs = TempChosenEntry->getLOADER_ENTRY()->LoadOptions.ConcatAll(" "_XS8);
gSettings.Boot.BootArgs = TempChosenEntry->getLOADER_ENTRY()->LoadOptions.ConcatAll(" "_XS8);
} else {
gSettings.BootArgs.setEmpty();
gSettings.Boot.BootArgs.setEmpty();
}
DBG(" boot with args: %s\n", gSettings.BootArgs.c_str());
DBG(" boot with args: %s\n", gSettings.Boot.BootArgs.c_str());
}
//---- Details submenu (kexts disabling etc)

View File

@ -286,8 +286,8 @@ public:
{
EFI_TIME Now;
gRT->GetTime(&Now, NULL);
if (GlobalConfig.Timezone != 0xFF) {
INT32 NowHour = Now.Hour + GlobalConfig.Timezone;
if (gSettings.GUI.Timezone != 0xFF) {
INT32 NowHour = Now.Hour + gSettings.GUI.Timezone;
if (NowHour < 0 ) NowHour += 24;
if (NowHour >= 24 ) NowHour -= 24;
Daylight = (NowHour > 8) && (NowHour < 20); //this is the screen member

View File

@ -50,7 +50,7 @@
//
//#define REFIT_DEBUG (2)
//#define Print if ((!GlobalConfig.Quiet) || (GlobalConfig.TextOnly)) Print
//#define Print if ((!GlobalConfig.Quiet) || (gSettings.GUI.TextOnly)) Print
////#include "GenericBdsLib.h"

View File

@ -721,7 +721,7 @@ void XImage::CopyRect(const XImage& Image, const EG_RECT& OwnPlace, const EG_REC
//
EFI_STATUS XImage::LoadIcns(const EFI_FILE* BaseDir, IN CONST CHAR16 *FileName, IN UINTN PixelSize)
{
if (GlobalConfig.TextOnly) // skip loading if it's not used anyway
if (gSettings.GUI.TextOnly) // skip loading if it's not used anyway
return EFI_SUCCESS;
if (BaseDir) {
EFI_STATUS Status = EFI_NOT_FOUND;

View File

@ -173,8 +173,8 @@ void egDumpSetConsoleVideoModes(void)
MsgLog(" - [%02llu]: %llux%llu%ls\n", i, Width, Height, (i-1==(UINTN)gST->ConOut->Mode->Mode)?L" (current mode)":L"");
}
// Select highest mode (-1) or lowest mode (-2) as/if requested
if ((GlobalConfig.ConsoleMode == -1 && (BestMode == 0 || Height > BestHeight || (Height == BestHeight && Width > BestWidth))) ||
(GlobalConfig.ConsoleMode == -2 && (BestMode == 0 || Height < BestHeight || (Height == BestHeight && Width < BestWidth)))) {
if ((gSettings.GUI.ConsoleMode == -1 && (BestMode == 0 || Height > BestHeight || (Height == BestHeight && Width > BestWidth))) ||
(gSettings.GUI.ConsoleMode == -2 && (BestMode == 0 || Height < BestHeight || (Height == BestHeight && Width < BestWidth)))) {
BestMode = i;
BestWidth = Width;
BestHeight = Height;
@ -187,9 +187,9 @@ void egDumpSetConsoleVideoModes(void)
return;
}
if (GlobalConfig.ConsoleMode > 0) {
if (gSettings.GUI.ConsoleMode > 0) {
// Specific mode chosen, try to set it
BestMode = GlobalConfig.ConsoleMode;
BestMode = gSettings.GUI.ConsoleMode;
}
if (BestMode >= 1 && BestMode <= (UINTN)gST->ConOut->Mode->MaxMode) {
@ -397,8 +397,8 @@ void egInitScreen(IN BOOLEAN SetMaxResolution)
egHasGraphics = FALSE;
if (GraphicsOutput != NULL) {
// egDumpGOPVideoModes();
if (GlobalConfig.ScreenResolution.notEmpty()) {
if (EFI_ERROR(egSetScreenResolution(GlobalConfig.ScreenResolution.wc_str()))) {
if (gSettings.GUI.ScreenResolution.notEmpty()) {
if (EFI_ERROR(egSetScreenResolution(gSettings.GUI.ScreenResolution.wc_str()))) {
if (SetMaxResolution) {
egSetMaxResolution();
}

View File

@ -303,7 +303,7 @@ INTN XTheme::RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
Bukva.YPos = 0;
Bukva.Width = FontWidth;
Bukva.Height = FontHeight;
DBG("codepage=%llx, asciiPage=%x\n", GlobalConfig.Codepage, AsciiPageSize);
DBG("codepage=%llx, asciiPage=%x\n", gSettings.GUI.Codepage, AsciiPageSize);
for (UINTN i = 0; i < TextLength && c0 != 0; i++) {
UINT16 c = Text.wc_str()[i]; //including UTF8 -> UTF16 conversion
DBG("initial char to render 0x%hx\n", c); //good
@ -312,7 +312,7 @@ INTN XTheme::RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
//we have russian raster fonts with chars at 0xC0
c -= 0x350;
} else {
INTN c2 = (c >= GlobalConfig.Codepage) ? (c - GlobalConfig.Codepage + AsciiPageSize) : c; //International letters
INTN c2 = (c >= gSettings.GUI.Codepage) ? (c - gSettings.GUI.Codepage + AsciiPageSize) : c; //International letters
c = c2 & 0xFF; //this maximum raster font size
}
// DBG("char to render 0x%hhx\n", c);

View File

@ -763,7 +763,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
DBG("HD path is not found\n"); //master volume!
}*/
// if (GlobalConfig.FastBoot) {
// if (GlobalConfig.isFastBoot()) {
// return EFI_SUCCESS;
// }

View File

@ -305,7 +305,7 @@ static EFI_STATUS LoadEFIImage(IN EFI_DEVICE_PATH *DevicePath,
#ifdef ENABLE_SECURE_BOOT
// Verify secure boot policy
if (gSettings.SecureBoot && gSettings.SecureBootSetupMode) {
if (gSettings.Boot.SecureBoot && gSettings.Boot.SecureBootSetupMode) {
// Only verify if in forced secure boot mode
EFI_STATUS Status = VerifySecureBootImage(DevicePath);
if (EFI_ERROR(Status)) {
@ -944,7 +944,7 @@ void LOADER_ENTRY::StartLoader()
if ( GlobalConfig.DebugLog ) {
if ( gSettings.Boot.DebugLog ) {
mOpenCoreConfiguration.Misc.Debug.AppleDebug = true;
mOpenCoreConfiguration.Misc.Debug.ApplePanic = true;
// mOpenCoreConfiguration.Misc.Debug.DisableWatchDog = true; // already done by Clover ?
@ -1123,7 +1123,7 @@ void LOADER_ENTRY::StartLoader()
mOpenCoreConfiguration.Kernel.Quirks.CustomSmbiosGuid = gSettings.KernelAndKextPatches.KPDELLSMBIOS;
#endif
mOpenCoreConfiguration.Uefi.Output.ProvideConsoleGop = gSettings.ProvideConsoleGop;
OC_STRING_ASSIGN(mOpenCoreConfiguration.Uefi.Output.Resolution, XString8(GlobalConfig.ScreenResolution).c_str());
OC_STRING_ASSIGN(mOpenCoreConfiguration.Uefi.Output.Resolution, XString8(gSettings.GUI.ScreenResolution).c_str());
// if OC is NOT initialized with OcMain, we need the following
@ -1469,7 +1469,7 @@ void LOADER_ENTRY::StartLoader()
//PauseForKey(L"continue");
}
if (gSettings.LastBootedVolume) {
if (gSettings.Boot.LastBootedVolume) {
if ( APFSTargetUUID.notEmpty() ) {
// Jief : we need to LoaderPath. If not, GUI can't know which target was selected.
SetStartupDiskVolume(Volume, LoaderPath);
@ -1478,7 +1478,7 @@ void LOADER_ENTRY::StartLoader()
// Let's do it like it was before when not in case of APFSTargetUUID
SetStartupDiskVolume(Volume, LoaderType == OSTYPE_OSX ? NullXStringW : LoaderPath);
}
} else if (gSettings.DefaultVolume.notEmpty()) {
} else if (gSettings.Boot.DefaultVolume.notEmpty()) {
// DefaultVolume specified in Config.plist or in Boot Option
// we'll remove macOS Startup Disk vars which may be present if it is used
// to reboot into another volume
@ -1602,9 +1602,9 @@ void LEGACY_ENTRY::StartLegacy()
gEmuVariableControl->UninstallEmulation(gEmuVariableControl);
}
if (gSettings.LastBootedVolume) {
if (gSettings.Boot.LastBootedVolume) {
SetStartupDiskVolume(Volume, NullXStringW);
} else if (gSettings.DefaultVolume.notEmpty()) {
} else if (gSettings.Boot.DefaultVolume.notEmpty()) {
// DefaultVolume specified in Config.plist:
// we'll remove macOS Startup Disk vars which may be present if it is used
// to reboot into another volume
@ -1628,11 +1628,11 @@ void LEGACY_ENTRY::StartLegacy()
Status = bootMBR(Volume);
break;
case BOOTING_BY_PBR:
if (gSettings.LegacyBoot == "LegacyBiosDefault"_XS8) {
Status = bootLegacyBiosDefault(gSettings.LegacyBiosDefaultEntry);
} else if (gSettings.LegacyBoot == "PBRtest"_XS8) {
if (gSettings.Boot.LegacyBoot == "LegacyBiosDefault"_XS8) {
Status = bootLegacyBiosDefault(gSettings.Boot.LegacyBiosDefaultEntry);
} else if (gSettings.Boot.LegacyBoot == "PBRtest"_XS8) {
Status = bootPBRtest(Volume);
} else if (gSettings.LegacyBoot == "PBRsata"_XS8) {
} else if (gSettings.Boot.LegacyBoot == "PBRsata"_XS8) {
Status = bootPBR(Volume, TRUE);
} else {
// default
@ -2183,17 +2183,17 @@ INTN FindDefaultEntry(void)
//
// if not found, then try DefaultVolume from config.plist
// if not null or empty, search volume that matches gSettings.DefaultVolume
// if not null or empty, search volume that matches gSettings.Boot.DefaultVolume
//
if (gSettings.DefaultVolume.notEmpty()) {
if (gSettings.Boot.DefaultVolume.notEmpty()) {
// if not null or empty, also search for loader that matches gSettings.DefaultLoader
SearchForLoader = gSettings.DefaultLoader.notEmpty();
// if not null or empty, also search for loader that matches gSettings.Boot.DefaultLoader
SearchForLoader = gSettings.Boot.DefaultLoader.notEmpty();
/*
if (SearchForLoader) {
DBG("Searching for DefaultVolume '%ls', DefaultLoader '%ls' ...\n", gSettings.DefaultVolume, gSettings.DefaultLoader);
DBG("Searching for DefaultVolume '%ls', DefaultLoader '%ls' ...\n", gSettings.Boot.DefaultVolume, gSettings.Boot.DefaultLoader);
} else {
DBG("Searching for DefaultVolume '%ls' ...\n", gSettings.DefaultVolume);
DBG("Searching for DefaultVolume '%ls' ...\n", gSettings.Boot.DefaultVolume);
}
*/
for (Index = 0; Index < (INTN)MainMenu.Entries.size() && MainMenu.Entries[Index].getLOADER_ENTRY() && MainMenu.Entries[Index].getLOADER_ENTRY()->Row == 0 ; Index++) {
@ -2204,13 +2204,13 @@ INTN FindDefaultEntry(void)
}
Volume = Entry.Volume;
if ( (Volume->VolName.isEmpty() || Volume->VolName != gSettings.DefaultVolume) &&
!Volume->DevicePathString.contains(gSettings.DefaultVolume) ) {
if ( (Volume->VolName.isEmpty() || Volume->VolName != gSettings.Boot.DefaultVolume) &&
!Volume->DevicePathString.contains(gSettings.Boot.DefaultVolume) ) {
continue;
}
// we alreday know that Entry.isLoader
if (SearchForLoader && (/*Entry.Tag != TAG_LOADER ||*/ !Entry.LoaderPath.containsIC(gSettings.DefaultLoader))) {
if (SearchForLoader && (/*Entry.Tag != TAG_LOADER ||*/ !Entry.LoaderPath.containsIC(gSettings.Boot.DefaultLoader))) {
continue;
}
@ -2282,15 +2282,15 @@ void SetVariablesFromNvram()
DBG("...ignoring arg:%s\n", arg);
continue;
}
if (!gSettings.BootArgs.contains(arg)) {
if (!gSettings.Boot.BootArgs.contains(arg)) {
//this arg is not present will add
DBG("...adding arg:%s\n", arg);
gSettings.BootArgs.trim();
gSettings.BootArgs += ' ';
gSettings.Boot.BootArgs.trim();
gSettings.Boot.BootArgs += ' ';
for (i = 0; i < index2; i++) {
gSettings.BootArgs += arg[i];
gSettings.Boot.BootArgs += arg[i];
}
gSettings.BootArgs += ' ';
gSettings.Boot.BootArgs += ' ';
}
}
FreePool(arg);
@ -2386,7 +2386,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
// get TSC freq and init MemLog if needed
gCPUStructure.TSCCalibr = GetMemLogTscTicksPerSecond(); //ticks for 1second
//GlobalConfig.TextOnly = TRUE;
//gSettings.GUI.TextOnly = TRUE;
// bootstrap
gST = SystemTable;
@ -2449,7 +2449,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
Now.Day, Now.Month, Now.Year, Now.Hour, Now.Minute, Now.Second);
} else {
MsgLog("Now is %02d.%02d.%d, %02d:%02d:%02d (GMT+%d)\n",
Now.Day, Now.Month, Now.Year, Now.Hour, Now.Minute, Now.Second, GlobalConfig.Timezone);
Now.Day, Now.Month, Now.Year, Now.Hour, Now.Minute, Now.Second, gSettings.GUI.Timezone);
}
//MsgLog("Starting Clover rev %ls on %ls EFI\n", gFirmwareRevision, gST->FirmwareVendor);
MsgLog("Starting %s on %ls EFI\n", gRevisionStr, gST->FirmwareVendor);
@ -2636,12 +2636,23 @@ RefitMain (IN EFI_HANDLE ImageHandle,
*/
}
#endif
if (!GlobalConfig.FastBoot) {
if (!GlobalConfig.isFastBoot()) {
GetListOfThemes();
GetListOfConfigs();
}
// ThemeX.FillByEmbedded(); //init XTheme before EarlyUserSettings
{
void *Value = NULL;
UINTN Size = 0;
//read aptiofixflag from nvram for special boot
Status = GetVariable2(L"aptiofixflag", &gEfiAppleBootGuid, &Value, &Size);
if (!EFI_ERROR(Status)) {
GlobalConfig.SpecialBootMode = TRUE;
FreePool(Value);
DBG("Fast option enabled\n");
}
}
for (i=0; i<2; i++) {
if (gConfigDict[i]) {
@ -2657,7 +2668,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
#endif // ENABLE_SECURE_BOOT
MainMenu.TimeoutSeconds = GlobalConfig.Timeout >= 0 ? GlobalConfig.Timeout : 0;
MainMenu.TimeoutSeconds = gSettings.Boot.Timeout >= 0 ? gSettings.Boot.Timeout : 0;
//DBG("LoadDrivers() start\n");
LoadDrivers();
//DBG("LoadDrivers() end\n");
@ -2683,7 +2694,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
DbgHeader("InitScreen");
if (!GlobalConfig.FastBoot) {
if (!GlobalConfig.isFastBoot()) {
// init screen and dump video modes to log
if (gDriversFlags.VideoLoaded) {
InitScreen(FALSE);
@ -2709,7 +2720,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
// DBG("DBG: messages\n");
if (!GlobalConfig.NoEarlyProgress && !GlobalConfig.FastBoot && GlobalConfig.Timeout>0) {
if (!gSettings.Boot.NoEarlyProgress && !GlobalConfig.isFastBoot() && gSettings.Boot.Timeout>0) {
XStringW Message = SWPrintf(" Welcome to Clover %ls ", gFirmwareRevision);
BootScreen.DrawTextXY(Message, (UGAWidth >> 1), UGAHeight >> 1, X_IS_CENTER);
BootScreen.DrawTextXY(L"... testing hardware ..."_XSW, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
@ -2771,7 +2782,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
break;
}
if (!GlobalConfig.NoEarlyProgress && !GlobalConfig.FastBoot && GlobalConfig.Timeout>0) {
if (!gSettings.Boot.NoEarlyProgress && !GlobalConfig.isFastBoot() && gSettings.Boot.Timeout>0) {
XStringW Message = SWPrintf("... user settings ...");
BootScreen.EraseTextXY();
BootScreen.DrawTextXY(Message, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
@ -2824,17 +2835,17 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
/*
if (gFirmwareClover || gDriversFlags.EmuVariableLoaded) {
if (GlobalConfig.StrictHibernate) {
if (gSettings.Boot.StrictHibernate) {
DBG(" Don't use StrictHibernate with emulated NVRAM!\n");
}
GlobalConfig.StrictHibernate = FALSE;
gSettings.Boot.StrictHibernate = FALSE;
}
*/
HaveDefaultVolume = gSettings.DefaultVolume.notEmpty();
HaveDefaultVolume = gSettings.Boot.DefaultVolume.notEmpty();
if (!gFirmwareClover &&
!gDriversFlags.EmuVariableLoaded &&
!HaveDefaultVolume &&
GlobalConfig.Timeout == 0 && !ReadAllKeyStrokes()) {
gSettings.Boot.Timeout == 0 && !ReadAllKeyStrokes()) {
// UEFI boot: get gEfiBootDeviceGuid from NVRAM.
// if present, ScanVolumes() will skip scanning other volumes
// in the first run.
@ -2842,7 +2853,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
GetEfiBootDeviceFromNvram();
}
if (!GlobalConfig.NoEarlyProgress && !GlobalConfig.FastBoot && GlobalConfig.Timeout>0) {
if (!gSettings.Boot.NoEarlyProgress && !GlobalConfig.isFastBoot() && gSettings.Boot.Timeout>0) {
XStringW Message = SWPrintf("... scan entries ...");
BootScreen.EraseTextXY();
BootScreen.DrawTextXY(Message, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
@ -2879,7 +2890,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
}
if (!GlobalConfig.FastBoot) {
if (!GlobalConfig.isFastBoot()) {
// CHAR16 *TmpArgs;
if (gThemeNeedInit) {
InitTheme(TRUE);
@ -2898,20 +2909,20 @@ RefitMain (IN EFI_HANDLE ImageHandle,
DBG("Chosen theme %ls\n", ThemeX.Theme.wc_str());
}
// DBG("initial boot-args=%s\n", gSettings.BootArgs);
// DBG("initial boot-args=%s\n", gSettings.Boot.BootArgs);
//now it is a time to set RtVariables
SetVariablesFromNvram();
XString8Array TmpArgs = Split<XString8Array>(gSettings.BootArgs, " ");
DBG("after NVRAM boot-args=%s\n", gSettings.BootArgs.c_str());
XString8Array TmpArgs = Split<XString8Array>(gSettings.Boot.BootArgs, " ");
DBG("after NVRAM boot-args=%s\n", gSettings.Boot.BootArgs.c_str());
gSettings.OptionsBits = EncodeOptions(TmpArgs);
// DBG("initial OptionsBits %X\n", gSettings.OptionsBits);
FillInputs(TRUE);
// scan for loaders and tools, add then to the menu
if (GlobalConfig.LegacyFirst){
if (gSettings.GUI.LegacyFirst){
AddCustomLegacy();
if (!GlobalConfig.NoLegacy) {
if (!gSettings.GUI.NoLegacy) {
ScanLegacy();
}
}
@ -2926,10 +2937,10 @@ RefitMain (IN EFI_HANDLE ImageHandle,
ScanLoader();
}
if (!GlobalConfig.FastBoot) {
if (!GlobalConfig.LegacyFirst) {
if (!GlobalConfig.isFastBoot()) {
if (!gSettings.GUI.LegacyFirst) {
AddCustomLegacy();
if (!GlobalConfig.NoLegacy) {
if (!gSettings.GUI.NoLegacy) {
ScanLegacy();
}
}
@ -2949,30 +2960,30 @@ RefitMain (IN EFI_HANDLE ImageHandle,
MenuEntryOptions.Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_OPTIONS);
// DBG("Options: IconID=%lld name=%s empty=%s\n", MenuEntryOptions.Image.Id, MenuEntryOptions.Image.Name.c_str(),
// MenuEntryOptions.Image.isEmpty()?"пусто":"нет");
if (gSettings.DisableCloverHotkeys)
if (gSettings.Boot.DisableCloverHotkeys)
MenuEntryOptions.ShortcutLetter = 0x00;
MainMenu.AddMenuEntry(&MenuEntryOptions, false);
MenuEntryAbout.Image = ThemeX.GetIcon((INTN)BUILTIN_ICON_FUNC_ABOUT);
// DBG("About: IconID=%lld name=%s empty=%s\n", MenuEntryAbout.Image.Id, MenuEntryAbout.Image.Name.c_str(),
// MenuEntryAbout.Image.isEmpty()?"пусто":"нет");
if (gSettings.DisableCloverHotkeys)
if (gSettings.Boot.DisableCloverHotkeys)
MenuEntryAbout.ShortcutLetter = 0x00;
MainMenu.AddMenuEntry(&MenuEntryAbout, false);
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_FUNCS) || MainMenu.Entries.size() == 0) {
if (gSettings.DisableCloverHotkeys)
if (gSettings.Boot.DisableCloverHotkeys)
MenuEntryReset.ShortcutLetter = 0x00;
MenuEntryReset.Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_RESET);
MainMenu.AddMenuEntry(&MenuEntryReset, false);
if (gSettings.DisableCloverHotkeys)
if (gSettings.Boot.DisableCloverHotkeys)
MenuEntryShutdown.ShortcutLetter = 0x00;
MenuEntryShutdown.Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_EXIT);
MainMenu.AddMenuEntry(&MenuEntryShutdown, false);
}
// font already changed and this message very quirky, clear line here
// if (!GlobalConfig.NoEarlyProgress && !GlobalConfig.FastBoot && GlobalConfig.Timeout>0) {
// if (!gSettings.Boot.NoEarlyProgress && !GlobalConfig.isFastBoot() && gSettings.Boot.Timeout>0) {
// XStringW Message = L" "_XSW;
// BootScreen.EraseTextXY();
// DrawTextXY(Message, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
@ -2993,9 +3004,9 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
MainLoopRunning = TRUE;
// MainMenu.TimeoutSeconds = GlobalConfig.Timeout >= 0 ? GlobalConfig.Timeout : 0;
if (DefaultEntry && (GlobalConfig.FastBoot ||
(gSettings.SkipHibernateTimeout &&
// MainMenu.TimeoutSeconds = gSettings.Boot.Timeout >= 0 ? gSettings.Boot.Timeout : 0;
if (DefaultEntry && (GlobalConfig.isFastBoot() ||
(gSettings.Boot.SkipHibernateTimeout &&
DefaultEntry->getLOADER_ENTRY()
&& OSFLAG_ISSET(DefaultEntry->getLOADER_ENTRY()->Flags, OSFLAG_HIBERNATED)
)
@ -3007,7 +3018,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
} else if (DefaultEntry->getLEGACY_ENTRY()){
DefaultEntry->StartLegacy();
}
GlobalConfig.FastBoot = FALSE; //Hmm... will never be here
gSettings.Boot.FastBoot = FALSE; //Hmm... will never be here
}
// BOOLEAN MainAnime = MainMenu.GetAnime();
// DBG("MainAnime=%d\n", MainAnime);
@ -3015,7 +3026,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
gEvent = 0; //clear to cancel loop
while (MainLoopRunning) {
// CHAR8 *LastChosenOS = NULL;
if (GlobalConfig.Timeout == 0 && DefaultEntry != NULL && !ReadAllKeyStrokes()) {
if (gSettings.Boot.Timeout == 0 && DefaultEntry != NULL && !ReadAllKeyStrokes()) {
// go strait to DefaultVolume loading
MenuExit = MENU_EXIT_TIMEOUT;
} else {
@ -3028,7 +3039,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
// DBG("exit from MainMenu %llu\n", MenuExit); //MENU_EXIT_ENTER=(1) MENU_EXIT_DETAILS=3
// disable default boot - have sense only in the first run
GlobalConfig.Timeout = -1;
gSettings.Boot.Timeout = -1;
if ((DefaultEntry != NULL) && (MenuExit == MENU_EXIT_TIMEOUT)) {
if (DefaultEntry->getLOADER_ENTRY()) {
DefaultEntry->StartLoader();

View File

@ -141,7 +141,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = ASString; //0
//even though Ascii we will keep value as Unicode to convert later
// no need for extra space here, it is added by ApplyInputs()
InputItems[InputItemsCount++].SValue.takeValueFrom(gSettings.BootArgs);
InputItems[InputItemsCount++].SValue.takeValueFrom(gSettings.Boot.BootArgs);
InputItems[InputItemsCount].ItemType = UNIString; //1
InputItems[InputItemsCount++].SValue.takeValueFrom(gSettings.DsdtName); // 1-> 2
InputItems[InputItemsCount].ItemType = UNIString; //2
@ -476,8 +476,8 @@ void ApplyInputs(void)
// DBG("ApplyInputs\n");
if (InputItems[i].Valid) {
gSettings.BootArgs = InputItems[i].SValue;
gSettings.BootArgs.replaceAll('\\', '_');
gSettings.Boot.BootArgs = InputItems[i].SValue;
gSettings.Boot.BootArgs.replaceAll('\\', '_');
gBootChanged = TRUE;
}
i++; //1
@ -491,9 +491,9 @@ void ApplyInputs(void)
i++; //3
if (InputItems[i].Valid) {
if (OldChosenTheme == 0xFFFF) {
GlobalConfig.Theme = L"embedded"_XSW;
gSettings.GUI.Theme = L"embedded"_XSW;
} else {
GlobalConfig.Theme.takeValueFrom(ThemeNameArray[OldChosenTheme]);
gSettings.GUI.Theme.takeValueFrom(ThemeNameArray[OldChosenTheme]);
}
//will change theme after ESC

View File

@ -123,7 +123,7 @@ void InitScreen(IN BOOLEAN SetMaxResolution)
void SetupScreen(void)
{
if (GlobalConfig.TextOnly) {
if (gSettings.GUI.TextOnly) {
// switch to text mode if requested
AllowGraphicsMode = FALSE;
SwitchToText(FALSE);