Refactoring CutomLegacyEntries and CustomToolsEntries.

Refactor ACPIPatchedAML as a XObjArray<ACPI_PATCHED_AML>.
move Codepage in GlobalConfig.
This commit is contained in:
jief666 2021-03-23 22:59:30 +03:00
parent ff4c90bc99
commit ac7bd4308d
13 changed files with 408 additions and 308 deletions

@ -1 +1 @@
Subproject commit 57d21de62dca2d1cca8ac3bc8dd581242b835aa3
Subproject commit 061ae899b5249cb67cf2a2e7b897ab6995cf2caf

View File

@ -36,7 +36,6 @@
9A358B3525CF115200A3850D /* Config_Devices_Arbitrary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A358B1925CF115100A3850D /* Config_Devices_Arbitrary.cpp */; };
9A358B3D25CF117A00A3850D /* XmlLiteCompositeTypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A358B3925CF117A00A3850D /* XmlLiteCompositeTypes.cpp */; };
9A358B3E25CF117A00A3850D /* XmlLiteParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A358B3A25CF117A00A3850D /* XmlLiteParser.cpp */; };
9A358B3F25CF117A00A3850D /* xmlLiteSimpleTypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A358B3B25CF117A00A3850D /* xmlLiteSimpleTypes.cpp */; };
9A36E4F024F3B537007A1107 /* TagString8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A36E4DB24F3B536007A1107 /* TagString8.cpp */; };
9A36E4F424F3B537007A1107 /* plist.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A36E4DD24F3B536007A1107 /* plist.cpp */; };
9A36E4F824F3B537007A1107 /* xml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A36E4DF24F3B536007A1107 /* xml.cpp */; };
@ -153,6 +152,7 @@
9AA9E53D25CD306700BD5E8B /* loader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AA9E51B25CD306700BD5E8B /* loader.cpp */; };
9AD0358C25C57A4500E58351 /* MemoryAllocationLib.c in Sources */ = {isa = PBXBuildFile; fileRef = 9AD0358B25C57A4500E58351 /* MemoryAllocationLib.c */; };
9AD0359425C57C8A00E58351 /* PrintLib.c in Sources */ = {isa = PBXBuildFile; fileRef = 9AD0359325C57C8A00E58351 /* PrintLib.c */; };
9AD0EB24260A497600093F23 /* XmlLiteSimpleTypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AD0EB22260A497500093F23 /* XmlLiteSimpleTypes.cpp */; };
9AD7B15026079F5D00E850D1 /* REFIT_MAINMENU_SCREEN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AD7B14F26079F5D00E850D1 /* REFIT_MAINMENU_SCREEN.cpp */; };
9AFDCEA325CD9A3300EEAF06 /* OcDevicePathLib.lib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AFDCEA225CD9A3200EEAF06 /* OcDevicePathLib.lib */; };
9AFDCEA525CD9B1C00EEAF06 /* BaseCpuLib.lib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AFDCEA425CD9B1C00EEAF06 /* BaseCpuLib.lib */; };
@ -324,10 +324,8 @@
9A358B1E25CF115100A3850D /* Config_Devices_USB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Config_Devices_USB.h; sourceTree = "<group>"; };
9A358B1F25CF115100A3850D /* Config_Devices_AddProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Config_Devices_AddProperties.h; sourceTree = "<group>"; };
9A358B3725CF117A00A3850D /* XmlLiteParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlLiteParser.h; sourceTree = "<group>"; };
9A358B3825CF117A00A3850D /* xmlLiteSimpleTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xmlLiteSimpleTypes.h; sourceTree = "<group>"; };
9A358B3925CF117A00A3850D /* XmlLiteCompositeTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XmlLiteCompositeTypes.cpp; sourceTree = "<group>"; };
9A358B3A25CF117A00A3850D /* XmlLiteParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XmlLiteParser.cpp; sourceTree = "<group>"; };
9A358B3B25CF117A00A3850D /* xmlLiteSimpleTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xmlLiteSimpleTypes.cpp; sourceTree = "<group>"; };
9A358B3C25CF117A00A3850D /* XmlLiteCompositeTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlLiteCompositeTypes.h; sourceTree = "<group>"; };
9A36E4DA24F3B536007A1107 /* TagBool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagBool.h; sourceTree = "<group>"; };
9A36E4DB24F3B536007A1107 /* TagString8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagString8.cpp; sourceTree = "<group>"; };
@ -371,6 +369,7 @@
9A5022C125CC44C900E2099D /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; };
9A57C266241A799B0029A39F /* XString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XString.h; sourceTree = "<group>"; };
9A6BA73C2449977300BDA52C /* XStringAbstract.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringAbstract.h; sourceTree = "<group>"; };
9A78DF7E260A531100FE811A /* Languages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Languages.h; sourceTree = "<group>"; };
9A7AEDE82459696C003AAD04 /* XToolsCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XToolsCommon.h; sourceTree = "<group>"; };
9A7D518024FC32F700FA1CC3 /* XBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XBuffer.h; sourceTree = "<group>"; };
9A7D518124FC32F700FA1CC3 /* XBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XBuffer.cpp; sourceTree = "<group>"; };
@ -5014,6 +5013,8 @@
9AD0358A25C579B200E58351 /* PrintLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrintLib.h; sourceTree = "<group>"; };
9AD0358B25C57A4500E58351 /* MemoryAllocationLib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = MemoryAllocationLib.c; sourceTree = "<group>"; };
9AD0359325C57C8A00E58351 /* PrintLib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = PrintLib.c; sourceTree = "<group>"; };
9AD0EB22260A497500093F23 /* XmlLiteSimpleTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XmlLiteSimpleTypes.cpp; sourceTree = "<group>"; };
9AD0EB23260A497500093F23 /* XmlLiteSimpleTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlLiteSimpleTypes.h; sourceTree = "<group>"; };
9AD469472452B33700D6D0DB /* shared_with_menu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = shared_with_menu.cpp; sourceTree = "<group>"; };
9AD469482452B33700D6D0DB /* shared_with_menu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shared_with_menu.h; sourceTree = "<group>"; };
9AD7B14E26079F5C00E850D1 /* REFIT_MAINMENU_SCREEN.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = REFIT_MAINMENU_SCREEN.h; sourceTree = "<group>"; };
@ -5437,12 +5438,12 @@
9A358B3625CF117A00A3850D /* cpp_lib */ = {
isa = PBXGroup;
children = (
9AD0EB22260A497500093F23 /* XmlLiteSimpleTypes.cpp */,
9AD0EB23260A497500093F23 /* XmlLiteSimpleTypes.h */,
9A4147662604F82900440186 /* undefinable.h */,
9A358B3725CF117A00A3850D /* XmlLiteParser.h */,
9A358B3825CF117A00A3850D /* xmlLiteSimpleTypes.h */,
9A358B3925CF117A00A3850D /* XmlLiteCompositeTypes.cpp */,
9A358B3A25CF117A00A3850D /* XmlLiteParser.cpp */,
9A358B3B25CF117A00A3850D /* xmlLiteSimpleTypes.cpp */,
9A358B3C25CF117A00A3850D /* XmlLiteCompositeTypes.h */,
);
path = cpp_lib;
@ -5658,19 +5659,20 @@
isa = PBXGroup;
children = (
9AB6EB9E25CF1FAD0001BDBB /* BootTypes.h */,
9AB6EB9F25CF1FAD0001BDBB /* OSFlags.h */,
9AB6EBA025CF1FAD0001BDBB /* OSTypes.h */,
9AB6EB9D25CF1FAC0001BDBB /* VolumeTypes.h */,
9AA3911A25CC56E60099DC1F /* Devices.h */,
9AA3912325CC56E60099DC1F /* Efi.h */,
9AA3911F25CC56E60099DC1F /* Handle.h */,
9A78DF7E260A531100FE811A /* Languages.h */,
9AA3912425CC56E60099DC1F /* OC.h */,
9AA3912025CC56E60099DC1F /* OneLinerMacros.h */,
9AB6EB9F25CF1FAD0001BDBB /* OSFlags.h */,
9AB6EBA025CF1FAD0001BDBB /* OSTypes.h */,
9AA3912225CC56E60099DC1F /* Pci.h */,
9AA3911D25CC56E60099DC1F /* printf_lite-test-cpp_conf.h */,
9AA3911B25CC56E60099DC1F /* printlib-test-cpp_conf.h */,
9AA3911E25CC56E60099DC1F /* rename_helper.h */,
9AA3911C25CC56E60099DC1F /* syslinux_mbr.h */,
9AB6EB9D25CF1FAC0001BDBB /* VolumeTypes.h */,
9AA3912525CC56E60099DC1F /* XToolsConf.h */,
);
path = include;
@ -15915,6 +15917,7 @@
9A358B3D25CF117A00A3850D /* XmlLiteCompositeTypes.cpp in Sources */,
9AA9250325CD5B2E00BD5E8B /* StateGenerator.cpp in Sources */,
9AA9253125CD74CC00BD5E8B /* securemenu.cpp in Sources */,
9AD0EB24260A497600093F23 /* XmlLiteSimpleTypes.cpp in Sources */,
9AFDD0A525CE731000EEAF06 /* all_tests.cpp in Sources */,
9AFDD0AD25CE731000EEAF06 /* XArray_tests.cpp in Sources */,
9A4FFA7E2451C8330050B38B /* XString.cpp in Sources */,
@ -15947,7 +15950,6 @@
9AA9247B25CD5B2E00BD5E8B /* platformdata.cpp in Sources */,
9AA9E4EA25CD283400BD5E8B /* XImage.cpp in Sources */,
9AA9241B25CD5B2E00BD5E8B /* Edid.cpp in Sources */,
9A358B3F25CF117A00A3850D /* xmlLiteSimpleTypes.cpp in Sources */,
9A358B3525CF115200A3850D /* Config_Devices_Arbitrary.cpp in Sources */,
9AA9252D25CD74CC00BD5E8B /* securehash.cpp in Sources */,
9AA9252E25CD74CC00BD5E8B /* legacy.cpp in Sources */,

View File

@ -231,8 +231,6 @@
<string>Apple</string>
<key>Debug</key>
<true/>
<key>EmptyDebugLogAtStart</key>
<true/>
<key>DefaultLoader</key>
<string>ii</string>
<key>DefaultVolume</key>
@ -497,6 +495,17 @@
<string>Dark</string>
<key>ConsoleMode</key>
<string>Max</string>
<key>Mouse</key>
<dict>
<key>DoubleClickTime</key>
<integer>501</integer>
<key>Enabled</key>
<true/>
<key>Mirror</key>
<true/>
<key>Speed</key>
<integer>5</integer>
</dict>
<key>Custom</key>
<dict>
<key>Entries</key>
@ -504,7 +513,7 @@
<dict>
<key>AddArguments</key>
<string>addarg</string>
<key>Arguments</key>
<key>#Arguments</key>
<string>arg</string>
<key>BootBgColor</key>
<string>bootbgcolor</string>
@ -529,31 +538,10 @@
<key>SubEntries</key>
<array>
<dict>
<key>CustomLogo</key>
<string>WinRepairTool128x128.png</string>
<key>AddArguments</key>
<string>arg2</string>
<key>FullTitle</key>
<string>title111</string>
<key>Settings</key>
<string>settingsSub</string>
<key>SubEntries</key>
<array>
<dict>
<key>Disabled</key>
<false/>
<key>Title</key>
<string>GDiskSub</string>
<key>Path</key>
<string>\EFI\GDISK\gdisk_x64.efi</string>
<key>Type</key>
<string>Windows</string>
<key>Image</key>
<string>\EFI\GDISK\GDisk.png</string>
<key>Hidden</key>
<false/>
</dict>
</array>
</dict>
<dict>
<key>AddArguments</key>
@ -592,7 +580,7 @@
<key>Hidden</key>
<true/>
<key>Hotkey</key>
<string></string>
<string>I</string>
<key>Type</key>
<string>Windows</string>
<key>Volume</key>
@ -628,29 +616,18 @@
</array>
<key>Language</key>
<string>es</string>
<key>Mouse</key>
<dict>
<key>DoubleClickTime</key>
<integer>501</integer>
<key>Enabled</key>
<true/>
<key>Mirror</key>
<true/>
<key>Speed</key>
<integer>5</integer>
</dict>
<key>Scan</key>
<dict>
<key>Entries</key>
<true/>
<key>Kernel</key>
<string>First</string>
<key>Legacy</key>
<string>First</string>
<key>Linux</key>
<true/>
<false/>
<key>Tool</key>
<true/>
<false/>
<key>Linux</key>
<false/>
<key>Legacy</key>
<false/>
<key>Kernel</key>
<false/>
</dict>
<key>ScreenResolution</key>
<string>1366x768</string>
@ -659,7 +636,7 @@
<key>TextOnly</key>
<true/>
<key>Theme</key>
<string></string>
<string>theme</string>
</dict>
<key>Graphics</key>
<dict>
@ -700,7 +677,7 @@
<integer>1</integer>
<key>EDID</key>
<dict>
<key>#Custom</key>
<key>Custom</key>
<data>AP///////wBMo0cwAAAAAAAUAQOAHBB46h2FkVZZjyYYUFQAAAABAQEBAQEBAQEBAQEBAQEBOB1W1FAAFjAwICUAFZwQAAAZAAAADwAAAAAAAAAAACXZBmoAAAAA/gBTQU1TVU5HCiBMo0FUAAAA/gBMVE4xMjVBVDAxNDAxAF0=</data>
<key>Inject</key>
<true/>

View File

@ -1623,7 +1623,7 @@ void LoadAllPatchedAML(const XStringW& acpiPathUnderOem, UINTN Pass)
// nothing to do in this case, since AutoMerge=false -> no tables ever merged
return;
}
if (ACPIPatchedAML) {
if ( ACPIPatchedAML.notEmpty() ) {
DbgHeader("ACPIPatchedAML");
if (gSettings.ACPI.AutoMerge) {
DBG("AutoMerge pass %llu\n", Pass);
@ -1633,22 +1633,24 @@ void LoadAllPatchedAML(const XStringW& acpiPathUnderOem, UINTN Pass)
UINTN Index;
DBG("Sorted\n");
for (Index = 0; Index < gSettings.ACPI.SortedACPI.size(); Index++) {
ACPI_PATCHED_AML *ACPIPatchedAMLTmp;
for (ACPIPatchedAMLTmp = ACPIPatchedAML; ACPIPatchedAMLTmp; ACPIPatchedAMLTmp = ACPIPatchedAMLTmp->Next) {
if (0 == StriCmp(ACPIPatchedAMLTmp->FileName, gSettings.ACPI.SortedACPI[Index].wc_str()) && ACPIPatchedAMLTmp->MenuItem.BValue) {
if (BVALUE_ATTEMPTED != ACPIPatchedAMLTmp->MenuItem.BValue)
DBG("Disabled: %ls, skip\n", ACPIPatchedAMLTmp->FileName);
ACPIPatchedAMLTmp->MenuItem.BValue = BVALUE_ATTEMPTED;
size_t idx;
for ( idx = 0 ; idx < ACPIPatchedAML.size() ; ++idx) {
ACPI_PATCHED_AML& ACPIPatchedAMLTmp = ACPIPatchedAML[idx];
if ( ACPIPatchedAMLTmp.FileName == gSettings.ACPI.SortedACPI[Index] && ACPIPatchedAMLTmp.MenuItem.BValue) {
if (BVALUE_ATTEMPTED != ACPIPatchedAMLTmp.MenuItem.BValue)
DBG("Disabled: %s, skip\n", ACPIPatchedAMLTmp.FileName.c_str());
ACPIPatchedAMLTmp.MenuItem.BValue = BVALUE_ATTEMPTED;
break;
}
}
if (!ACPIPatchedAMLTmp) { // NULL when not disabled
DBG("Inserting table[%llu]:%ls from %ls\\%ls: ", Index, gSettings.ACPI.SortedACPI[Index].wc_str(), selfOem.getConfigDirFullPath().wc_str(), acpiPathUnderOem.wc_str());
if (LoadPatchedAML(selfOem.getConfigDir(), acpiPathUnderOem, gSettings.ACPI.SortedACPI[Index].wc_str(), Pass)) {
if ( idx == ACPIPatchedAML.size() ) { // NULL when not disabled
DBG("Inserting table[%llu]:%s from %ls\\%ls: ", Index, gSettings.ACPI.SortedACPI[Index].c_str(), selfOem.getConfigDirFullPath().wc_str(), acpiPathUnderOem.wc_str());
if (LoadPatchedAML(selfOem.getConfigDir(), acpiPathUnderOem, XStringW(gSettings.ACPI.SortedACPI[Index]).wc_str(), Pass)) {
// avoid inserting table again on second pass
for (ACPI_PATCHED_AML* temp2 = ACPIPatchedAML; temp2; temp2 = temp2->Next) {
if (0 == StriCmp(temp2->FileName, gSettings.ACPI.SortedACPI[Index].wc_str())) {
temp2->MenuItem.BValue = BVALUE_ATTEMPTED;
for ( idx = 0 ; idx < ACPIPatchedAML.size() ; ++idx) {
ACPI_PATCHED_AML& temp2 = ACPIPatchedAML[idx];
if ( temp2.FileName == gSettings.ACPI.SortedACPI[Index] ) {
temp2.MenuItem.BValue = BVALUE_ATTEMPTED;
break;
}
}
@ -1656,19 +1658,19 @@ void LoadAllPatchedAML(const XStringW& acpiPathUnderOem, UINTN Pass)
}
}
} else {
ACPI_PATCHED_AML *ACPIPatchedAMLTmp;
DBG("Unsorted\n");
for (ACPIPatchedAMLTmp = ACPIPatchedAML; ACPIPatchedAMLTmp; ACPIPatchedAMLTmp = ACPIPatchedAMLTmp->Next) {
if (!ACPIPatchedAMLTmp->MenuItem.BValue) {
DBG("Inserting %ls from %ls\\%ls: ", ACPIPatchedAMLTmp->FileName, selfOem.getConfigDirFullPath().wc_str(), acpiPathUnderOem.wc_str());
if (LoadPatchedAML(selfOem.getConfigDir(), acpiPathUnderOem, ACPIPatchedAMLTmp->FileName, Pass)) {
for ( size_t idx = 0 ; idx < ACPIPatchedAML.size() ; ++idx) {
ACPI_PATCHED_AML& ACPIPatchedAMLTmp = ACPIPatchedAML[idx];
if (!ACPIPatchedAMLTmp.MenuItem.BValue) {
DBG("Inserting %s from %ls\\%ls: ", ACPIPatchedAMLTmp.FileName.c_str(), selfOem.getConfigDirFullPath().wc_str(), acpiPathUnderOem.wc_str());
if (LoadPatchedAML(selfOem.getConfigDir(), acpiPathUnderOem, XStringW(ACPIPatchedAMLTmp.FileName).wc_str(), Pass)) {
// avoid inserting table again on second pass
ACPIPatchedAMLTmp->MenuItem.BValue = BVALUE_ATTEMPTED;
ACPIPatchedAMLTmp.MenuItem.BValue = BVALUE_ATTEMPTED;
}
} else {
if (BVALUE_ATTEMPTED != ACPIPatchedAMLTmp->MenuItem.BValue)
DBG("Disabled: %ls, skip\n", ACPIPatchedAMLTmp->FileName);
ACPIPatchedAMLTmp->MenuItem.BValue = BVALUE_ATTEMPTED;
if (BVALUE_ATTEMPTED != ACPIPatchedAMLTmp.MenuItem.BValue)
DBG("Disabled: %s, skip\n", ACPIPatchedAMLTmp.FileName.c_str());
ACPIPatchedAMLTmp.MenuItem.BValue = BVALUE_ATTEMPTED;
}
}
}

View File

@ -67,7 +67,7 @@ INTN LayoutBannerOffset = 64;
INTN LayoutTextOffset = 0;
INTN LayoutButtonOffset = 0;
ACPI_PATCHED_AML *ACPIPatchedAML = NULL;
XObjArray<ACPI_PATCHED_AML> ACPIPatchedAML;
//SYSVARIABLES *SysVariables;
CHAR16 *IconFormat = NULL;
@ -278,6 +278,11 @@ const XString8& CUSTOM_LOADER_SUBENTRY::getFullTitle() const {
};
bool SETTINGS_DATA::GUIClass::getDarkEmbedded(bool isDaylight) const {
if ( EmbeddedThemeType.equalIC("Dark") ) return true;
if ( EmbeddedThemeType.equalIC("Daytime") ) return !isDaylight;
return false;
}
@ -663,7 +668,7 @@ LoadUserSettings (
// return TRUE;
//}
//STATIC BOOLEAN AddCustomLegacyEntry (IN CUSTOM_LEGACY_ENTRY *Entry)
//STATIC BOOLEAN AddCustomLegacyEntry (IN CUSTOM_LEGACY_ENTRY_SETTINGS *Entry)
//{
// if (Entry == NULL) return FALSE;
// gSettings.GUI.CustomLegacy.AddReference(Entry, true);
@ -2185,7 +2190,7 @@ FillinCustomEntry (
static BOOLEAN
FillingCustomLegacy (
IN OUT CUSTOM_LEGACY_ENTRY *Entry,
IN OUT CUSTOM_LEGACY_ENTRY_SETTINGS *Entry,
const TagDict* DictPointer
)
{
@ -2196,7 +2201,7 @@ FillingCustomLegacy (
Prop = DictPointer->propertyForKey("Disabled");
if (IsPropertyNotNullAndTrue(Prop)) {
return FALSE;
Entry->Disabled = true;
}
Prop = DictPointer->propertyForKey("Volume");
@ -2216,32 +2221,36 @@ FillingCustomLegacy (
Prop = DictPointer->propertyForKey("Image");
if (Prop != NULL) {
if (Prop->isString()) {
Entry->Image.LoadXImage(&ThemeX.getThemeDir(), Prop->getString()->stringValue());
Entry->ImagePath = Prop->getString()->stringValue();
// Entry->Image.LoadXImage(&ThemeX.getThemeDir(), Prop->getString()->stringValue());
}
} else {
UINTN DataLen = 0;
UINT8 *TmpData = GetDataSetting (DictPointer, "ImageData", &DataLen);
if (TmpData) {
if (!EFI_ERROR(Entry->Image.Image.FromPNG(TmpData, DataLen))) {
Entry->Image.setFilled();
}
FreePool(TmpData);
Entry->ImageData.stealValueFrom(TmpData, DataLen);
// if (!EFI_ERROR(Entry->Image.Image.FromPNG(TmpData, DataLen))) {
// Entry->Image.setFilled();
// }
// FreePool(TmpData);
}
}
Prop = DictPointer->propertyForKey("DriveImage");
if (Prop != NULL) {
if (Prop->isString()) {
Entry->Image.LoadXImage(&ThemeX.getThemeDir(), Prop->getString()->stringValue());
Entry->DriveImagePath = Prop->getString()->stringValue();
// Entry->Image.LoadXImage(&ThemeX.getThemeDir(), Prop->getString()->stringValue());
}
} else {
UINTN DataLen = 0;
UINT8 *TmpData = GetDataSetting (DictPointer, "DriveImageData", &DataLen);
if (TmpData) {
if (!EFI_ERROR(Entry->DriveImage.Image.FromPNG(TmpData, DataLen))) {
Entry->DriveImage.setFilled();
}
FreePool(TmpData);
Entry->DriveImageData.stealValueFrom(TmpData, DataLen);
// if (!EFI_ERROR(Entry->DriveImage.Image.FromPNG(TmpData, DataLen))) {
// Entry->DriveImage.setFilled();
// }
// FreePool(TmpData);
}
}
@ -2260,7 +2269,8 @@ FillingCustomLegacy (
if (Prop != NULL) {
if ((Prop->isString()) &&
(Prop->getString()->stringValue().equalIC("Always"))) {
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED);
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED);
Entry->AlwaysHidden = true;
} else if (IsPropertyNotNullAndTrue(Prop)) {
DBG(" hiding entry because Hidden flag is YES\n");
Entry->Hidden = true;
@ -2285,7 +2295,7 @@ FillingCustomLegacy (
}
static BOOLEAN
FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY *Entry, const TagDict* DictPointer)
FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY_SETTINGS *Entry, const TagDict* DictPointer)
{
const TagStruct* Prop;
if ((Entry == NULL) || (DictPointer == NULL)) {
@ -2294,7 +2304,7 @@ FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY *Entry, const TagDict* DictPointer)
Prop = DictPointer->propertyForKey("Disabled");
if (IsPropertyNotNullAndTrue(Prop)) {
return FALSE;
Entry->Disabled = true;
}
Prop = DictPointer->propertyForKey("Volume");
@ -2314,7 +2324,8 @@ FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY *Entry, const TagDict* DictPointer)
// } else {
// Entry->Options.SPrintf("%s", Prop->getString()->stringValue());
// }
Entry->LoadOptions = Split<XString8Array>(Prop->getString()->stringValue(), " ");
// Entry->LoadOptions = Split<XString8Array>(Prop->getString()->stringValue(), " ");
Entry->Arguments = Prop->getString()->stringValue();
}
Prop = DictPointer->propertyForKey("Title");
@ -2333,15 +2344,16 @@ FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY *Entry, const TagDict* DictPointer)
if (Prop->isString()) {
Entry->ImagePath = Prop->getString()->stringValue();
}
Entry->Image.LoadXImage(&ThemeX.getThemeDir(), Entry->ImagePath);
// Entry->Image.LoadXImage(&ThemeX.getThemeDir(), Entry->ImagePath);
} else {
UINTN DataLen = 0;
UINT8 *TmpData = GetDataSetting (DictPointer, "ImageData", &DataLen);
if (TmpData) {
if (!EFI_ERROR(Entry->Image.Image.FromPNG(TmpData, DataLen))) {
Entry->Image.setFilled();
}
FreePool(TmpData);
Entry->ImageData.stealValueFrom(TmpData, DataLen);
// if (!EFI_ERROR(Entry->Image.Image.FromPNG(TmpData, DataLen))) {
// Entry->Image.setFilled();
// }
// FreePool(TmpData);
}
}
Prop = DictPointer->propertyForKey("Hotkey");
@ -2359,7 +2371,8 @@ FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY *Entry, const TagDict* DictPointer)
if (Prop != NULL) {
if ((Prop->isString()) &&
(Prop->getString()->stringValue().equalIC("Always"))) {
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED);
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED);
Entry->AlwaysHidden = true;
} else if (IsPropertyNotNullAndTrue(Prop)) {
DBG(" hiding entry because Hidden flag is YES\n");
Entry->Hidden = true;
@ -2404,7 +2417,7 @@ GetEDIDSettings(const TagDict* DictPointer, SETTINGS_DATA& gSettings)
} else {
DBG(" Custom EDID is ok\n");
gSettings.CustomEDIDsize = (UINT16)j;
InitializeEdidOverride();
// InitializeEdidOverride();
}
}
@ -2783,41 +2796,42 @@ EFI_STATUS GetEarlyUserSettings (
if (GUIDict != NULL) {
const TagStruct* Prop = GUIDict->propertyForKey("Timezone");
gSettings.GUI.Timezone = (INT32)GetPropertyAsInteger(Prop, gSettings.GUI.Timezone);
//initialize Daylight when we know timezone
#ifdef CLOVER_BUILD
EFI_TIME Now;
gRT->GetTime(&Now, NULL);
INT32 NowHour = Now.Hour + gSettings.GUI.Timezone;
if (NowHour < 0 ) NowHour += 24;
if (NowHour >= 24 ) NowHour -= 24;
ThemeX.Daylight = (NowHour > 8) && (NowHour < 20);
#endif
// //initialize Daylight when we know timezone
//#ifdef CLOVER_BUILD
// EFI_TIME Now;
// gRT->GetTime(&Now, NULL);
// INT32 NowHour = Now.Hour + gSettings.GUI.Timezone;
// if (NowHour < 0 ) NowHour += 24;
// if (NowHour >= 24 ) NowHour -= 24;
// ThemeX.Daylight = (NowHour > 8) && (NowHour < 20);
//#endif
Prop = GUIDict->propertyForKey("Theme");
if (Prop != NULL && (Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
ThemeX.Theme.takeValueFrom(Prop->getString()->stringValue());
// ThemeX.Theme.takeValueFrom(Prop->getString()->stringValue());
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 ( gSettings.GUI.Theme.equalIC(ThemeNameArray[i]) ) {
OldChosenTheme = i;
break;
}
}
// 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 ( gSettings.GUI.Theme.equalIC(ThemeNameArray[i]) ) {
// OldChosenTheme = i;
// break;
// }
// }
}
// get embedded theme property even when starting with other themes, as they may be changed later
Prop = GUIDict->propertyForKey("EmbeddedThemeType");
if (Prop && (Prop->isString()) && Prop->getString()->stringValue().notEmpty()) {
gSettings.GUI.EmbeddedThemeType = Prop->getString()->stringValue();
if (Prop->getString()->stringValue().equalIC("Dark")) {
gSettings.GUI.DarkEmbedded = TRUE;
// gSettings.GUI.DarkEmbedded = TRUE;
//ThemeX.Font = FONT_GRAY;
} else if (Prop->getString()->stringValue().equalIC("Light")) {
gSettings.GUI.DarkEmbedded = FALSE;
// gSettings.GUI.DarkEmbedded = FALSE;
//ThemeX.Font = FONT_ALFA;
} else if (Prop->getString()->stringValue().equalIC("Daytime")) {
gSettings.GUI.DarkEmbedded = !ThemeX.Daylight;
// gSettings.GUI.DarkEmbedded = !ThemeX.Daylight;
//ThemeX.Font = ThemeX.Daylight?FONT_ALFA:FONT_GRAY;
}
}
@ -2867,16 +2881,16 @@ EFI_STATUS GetEarlyUserSettings (
gSettings.Language = Prop->getString()->stringValue();
if ( Prop->getString()->stringValue().contains("en") ) {
gSettings.GUI.gLanguage = english;
gSettings.GUI.Codepage = 0xC0;
gSettings.GUI.CodepageSize = 0;
// gSettings.GUI.Codepage = 0xC0;
// gSettings.GUI.CodepageSize = 0;
} else if ( Prop->getString()->stringValue().contains("ru")) {
gSettings.GUI.gLanguage = russian;
gSettings.GUI.Codepage = 0x410;
gSettings.GUI.CodepageSize = 0x40;
// gSettings.GUI.Codepage = 0x410;
// gSettings.GUI.CodepageSize = 0x40;
} else if ( Prop->getString()->stringValue().contains("ua")) {
gSettings.GUI.gLanguage = ukrainian;
gSettings.GUI.Codepage = 0x400;
gSettings.GUI.CodepageSize = 0x60;
// gSettings.GUI.Codepage = 0x400;
// gSettings.GUI.CodepageSize = 0x60;
} else if ( Prop->getString()->stringValue().contains("fr")) {
gSettings.GUI.gLanguage = french; //default is extended latin
} else if ( Prop->getString()->stringValue().contains("it")) {
@ -2901,14 +2915,14 @@ EFI_STATUS GetEarlyUserSettings (
gSettings.GUI.gLanguage = indonesian;
} else if ( Prop->getString()->stringValue().contains("zh_CN")) {
gSettings.GUI.gLanguage = chinese;
gSettings.GUI.Codepage = 0x3400;
gSettings.GUI.CodepageSize = 0x19C0;
// gSettings.GUI.Codepage = 0x3400;
// gSettings.GUI.CodepageSize = 0x19C0;
} else if ( Prop->getString()->stringValue().contains("ro")) {
gSettings.GUI.gLanguage = romanian;
} else if ( Prop->getString()->stringValue().contains("ko")) {
gSettings.GUI.gLanguage = korean;
gSettings.GUI.Codepage = 0x1100;
gSettings.GUI.CodepageSize = 0x100;
// gSettings.GUI.Codepage = 0x1100;
// gSettings.GUI.CodepageSize = 0x100;
}
}
@ -3037,17 +3051,17 @@ EFI_STATUS GetEarlyUserSettings (
}
const TagArray* LegacyArray = CustomDict2->arrayPropertyForKey("Legacy"); // is an array of dict
if (LegacyArray != NULL) {
CUSTOM_LEGACY_ENTRY *Entry;
CUSTOM_LEGACY_ENTRY_SETTINGS *Entry;
INTN i;
INTN Count = LegacyArray->arrayContent().size();
if (Count > 0) {
for (i = 0; i < Count; i++) {
const TagDict* Dict3 = LegacyArray->dictElementAt(i, "Legacy"_XS8);
// Allocate an entry
Entry = new CUSTOM_LEGACY_ENTRY;
Entry = new CUSTOM_LEGACY_ENTRY_SETTINGS;
// Fill it in
if ( FillingCustomLegacy(Entry, Dict3) ) {
gSettings.GUI.CustomLegacy.AddReference(Entry, true);
gSettings.GUI.CustomLegacySettings.AddReference(Entry, true);
}else{
delete Entry;
}
@ -3056,17 +3070,16 @@ EFI_STATUS GetEarlyUserSettings (
}
const TagArray* ToolArray = CustomDict2->arrayPropertyForKey("Tool"); // is an array of dict
if (ToolArray != NULL) {
CUSTOM_TOOL_ENTRY *Entry;
INTN i;
INTN Count = ToolArray->arrayContent().size();
if (Count > 0) {
for (i = 0; i < Count; i++) {
const TagDict* Dict3 = ToolArray->dictElementAt(i, "Tool"_XS8);
// Allocate an entry
Entry = new CUSTOM_TOOL_ENTRY;
CUSTOM_TOOL_ENTRY_SETTINGS* Entry = new CUSTOM_TOOL_ENTRY_SETTINGS;
// Fill it in
if ( FillingCustomTool(Entry, Dict3) ) {
gSettings.GUI.CustomTool.AddReference(Entry, true);
gSettings.GUI.CustomToolSettings.AddReference(Entry, true);
}else{
delete Entry;
}

View File

@ -5,6 +5,7 @@
#include "../gui/menu_items/menu_items.h"
#include "../include/OSFlags.h"
#include "../include/OSTypes.h"
#include "../include/Languages.h"
#include "../Platform/plist/plist.h"
#include "../Platform/guid.h"
#include "MacOsVersion.h"
@ -34,27 +35,6 @@
#define QUIRK_PERM bit(15)
typedef enum {
english = 0, //en
russian, //ru
french, //fr
german, //de
dutch, //nl
italian, //it
spanish, //es
portuguese, //pt
brasil, //br
polish, //pl
ukrainian, //ua
croatian, //hr
czech, //cs
indonesian, //id
korean, //ko
chinese, //cn
romanian //ro
//something else? add, please
} LANGUAGES;
//// SysVariables
//typedef struct SYSVARIABLES SYSVARIABLES;
//struct SYSVARIABLES
@ -313,49 +293,102 @@ public:
}
};
class CUSTOM_LEGACY_ENTRY
class CUSTOM_LEGACY_ENTRY_SETTINGS
{
public:
XIcon Image = XIcon();
XIcon DriveImage = XIcon();
bool Disabled = 0;
XStringW ImagePath = XStringW();
XBuffer<UINT8> ImageData = XBuffer<UINT8>();
XStringW DriveImagePath = XStringW();
XBuffer<UINT8> DriveImageData = XBuffer<UINT8>();
XStringW Volume = XStringW();
XStringW FullTitle = XStringW();
XStringW Title = XStringW();
CHAR16 Hotkey = 0;
UINT8 Flags = 0;
// UINT8 Flags = 0;
bool Hidden = 0;
bool AlwaysHidden = 0;
UINT8 Type = 0;
UINT8 VolumeType = 0;
};
class CUSTOM_LEGACY_ENTRY
{
public:
const CUSTOM_LEGACY_ENTRY_SETTINGS& settings = CUSTOM_LEGACY_ENTRY_SETTINGS();
XIcon Image = XIcon();
XIcon DriveImage = XIcon();
CUSTOM_LEGACY_ENTRY(const CUSTOM_LEGACY_ENTRY_SETTINGS& _settings, EFI_FILE& ThemeDir) : settings(_settings)
{
if ( settings.ImagePath.notEmpty() ) {
Image.LoadXImage(&ThemeDir, settings.ImagePath);
}else if ( settings.ImageData.notEmpty() ) {
if ( !EFI_ERROR(Image.Image.FromPNG(settings.ImageData.data(), settings.ImageData.size())) ) {
Image.setFilled();
}
}
if ( settings.DriveImagePath.notEmpty() ) {
DriveImage.LoadXImage(&ThemeDir, settings.DriveImagePath);
}else if ( settings.DriveImageData.notEmpty() ) {
if ( !EFI_ERROR(DriveImage.Image.FromPNG(settings.DriveImageData.data(), settings.DriveImageData.size())) ) {
DriveImage.setFilled();
}
}
}
UINT8 getFlags() const {
UINT8 Flags = 0;
if ( settings.Disabled || settings.AlwaysHidden ) Flags = OSFLAG_SET(Flags, OSFLAG_DISABLED);
return Flags;
}
};
class CUSTOM_TOOL_ENTRY_SETTINGS
{
public:
bool Disabled = 0;
XStringW ImagePath = XStringW();
XBuffer<UINT8> ImageData = XBuffer<UINT8>();
XStringW Volume = XStringW();
XStringW Path = XStringW();
// XString8Array LoadOptions = XString8Array();
XString8 Arguments = XString8();
XStringW FullTitle = XStringW();
XStringW Title = XStringW();
CHAR16 Hotkey = 0;
// UINT8 Flags = 0;
bool Hidden = 0;
bool AlwaysHidden = 0;
UINT8 VolumeType = 0;
// CUSTOM_LEGACY_ENTRY() {}
//
// // Not sure if default are valid. Delete them. If needed, proper ones can be created
// CUSTOM_LEGACY_ENTRY(const CUSTOM_LEGACY_ENTRY&) = delete;
// CUSTOM_LEGACY_ENTRY& operator=(const CUSTOM_LEGACY_ENTRY&) = delete;
};
class CUSTOM_TOOL_ENTRY
{
public:
XIcon Image = XIcon();
XStringW ImagePath = XStringW();
XStringW Volume = XStringW();
XStringW Path = XStringW();
XString8Array LoadOptions = XString8Array();
XStringW FullTitle = XStringW();
XStringW Title = XStringW();
CHAR16 Hotkey = 0;
UINT8 Flags = 0;
bool Hidden = 0;
UINT8 VolumeType = 0;
// CUSTOM_TOOL_ENTRY() {}
//
// // Not sure if default are valid. Delete them. If needed, proper ones can be created
// CUSTOM_TOOL_ENTRY(const CUSTOM_TOOL_ENTRY&) = delete;
// CUSTOM_TOOL_ENTRY& operator=(const CUSTOM_TOOL_ENTRY&) = delete;
const CUSTOM_TOOL_ENTRY_SETTINGS& settings = CUSTOM_TOOL_ENTRY_SETTINGS();
CUSTOM_TOOL_ENTRY(const CUSTOM_TOOL_ENTRY_SETTINGS& _settings, EFI_FILE& ThemeDir) : settings(_settings)
{
if ( settings.ImagePath.notEmpty() ) {
Image.LoadXImage(&ThemeDir, settings.ImagePath);
} else if ( settings.ImageData.notEmpty() ) {
if ( !EFI_ERROR(Image.Image.FromPNG(settings.ImageData.data(), settings.ImageData.size())) ) {
Image.setFilled();
}
}
}
UINT8 getFlags() const {
UINT8 Flags = 0;
if ( settings.Disabled || settings.AlwaysHidden ) Flags = OSFLAG_SET(Flags, OSFLAG_DISABLED);
return Flags;
}
XString8Array getLoadOptions() const {
return Split<XString8Array>(settings.Arguments, " ");
}
};
class DEV_PROPERTY
@ -463,13 +496,13 @@ public:
{
public:
XStringW DsdtName = XStringW();
BOOLEAN DebugDSDT = 0;
BOOLEAN Rtc8Allowed = 0;
bool DebugDSDT = 0;
bool Rtc8Allowed = 0;
UINT8 PNLF_UID = 0;
UINT32 FixDsdt = 0;
XObjArray<DSDT_Patch> DSDTPatchArray = XObjArray<DSDT_Patch>();
BOOLEAN ReuseFFFF = 0;
BOOLEAN SuspendOverride = 0;
bool ReuseFFFF = 0;
bool SuspendOverride = 0;
} DSDT = DSDTClass();
class SSDTClass
@ -478,24 +511,24 @@ public:
class GenerateClass
{
public:
BOOLEAN GeneratePStates = 0;
BOOLEAN GenerateCStates = 0;
BOOLEAN GenerateAPSN = 0;
BOOLEAN GenerateAPLF = 0;
BOOLEAN GeneratePluginType = 0;
bool GeneratePStates = 0;
bool GenerateCStates = 0;
bool GenerateAPSN = 0;
bool GenerateAPLF = 0;
bool GeneratePluginType = 0;
} Generate = GenerateClass();
BOOLEAN DropSSDTSetting = 0;
BOOLEAN NoOemTableId = 0;
BOOLEAN NoDynamicExtract = 0;
BOOLEAN EnableISS = 0;
BOOLEAN EnableC7 = 0;
BOOLEAN _EnableC6 = 0;
BOOLEAN _EnableC4 = 0;
BOOLEAN _EnableC2 = 0;
bool DropSSDTSetting = 0;
bool NoOemTableId = 0;
bool NoDynamicExtract = 0;
bool EnableISS = 0;
bool EnableC7 = 0;
bool _EnableC6 = 0;
bool _EnableC4 = 0;
bool _EnableC2 = 0;
UINT16 _C3Latency = 0;
UINT8 PLimitDict = 0;
UINT8 UnderVoltStep = 0;
BOOLEAN DoubleFirstState = 0;
bool DoubleFirstState = 0;
UINT8 MinMultiplier = 0;
UINT8 MaxMultiplier = 0;
UINT8 PluginType = 0;
@ -503,14 +536,14 @@ public:
UINT64 ResetAddr = 0;
UINT8 ResetVal = 0;
BOOLEAN SlpSmiEnable = 0;
BOOLEAN FixHeaders = 0;
BOOLEAN FixMCFG = 0;
BOOLEAN NoASPM = 0;
BOOLEAN smartUPS = 0;
BOOLEAN PatchNMI = 0;
XStringWArray SortedACPI = XStringWArray();
BOOLEAN AutoMerge = 0;
bool SlpSmiEnable = 0;
bool FixHeaders = 0;
bool FixMCFG = 0;
bool NoASPM = 0;
bool smartUPS = 0;
bool PatchNMI = 0;
XString8Array SortedACPI = XString8Array();
bool AutoMerge = 0;
XStringWArray DisabledAML = XStringWArray();
XObjArray<ACPI_NAME_LIST> DeviceRename = XObjArray<ACPI_NAME_LIST>();
@ -518,9 +551,10 @@ public:
class GUIClass {
public:
INT32 Timezone = 0xFF;
INT32 Timezone = -1;
XStringW Theme = XStringW();
bool DarkEmbedded = 0;
// bool DarkEmbedded = 0;
XString8 EmbeddedThemeType = XString8();
bool PlayAsync = 0;
bool CustomIcons = false;
bool TextOnly = false;
@ -529,29 +563,29 @@ public:
bool ProvideConsoleGop = 0;
INTN ConsoleMode = 0;
LANGUAGES gLanguage = english;
INTN Codepage = 0xC0;
INTN CodepageSize = 0xC0;
BOOLEAN KbdPrevLang = 0;
bool KbdPrevLang = 0;
class MouseClass {
public:
INTN PointerSpeed = 0;
BOOLEAN PointerEnabled = 0;
bool PointerEnabled = 0;
UINT64 DoubleClickTime = 0;
BOOLEAN PointerMirror = 0;
bool PointerMirror = 0;
} Mouse = MouseClass();
XString8Array HVHideStrings = XString8Array();
class ScanClass {
public:
BOOLEAN DisableEntryScan = 0;
BOOLEAN DisableToolScan = 0;
UINT8 KernelScan = 0;
BOOLEAN LinuxScan = 0;
bool LegacyFirst = false;
bool NoLegacy = false;
bool DisableEntryScan = 0;
bool DisableToolScan = 0;
UINT8 KernelScan = 0;
bool LinuxScan = 0;
bool LegacyFirst = false;
bool NoLegacy = false;
} Scan = ScanClass();
XObjArray<CUSTOM_LOADER_ENTRY_SETTINGS> CustomEntriesSettings = XObjArray<CUSTOM_LOADER_ENTRY_SETTINGS>();
XObjArray<CUSTOM_LEGACY_ENTRY> CustomLegacy = XObjArray<CUSTOM_LEGACY_ENTRY>();
XObjArray<CUSTOM_TOOL_ENTRY> CustomTool = XObjArray<CUSTOM_TOOL_ENTRY>();
XObjArray<CUSTOM_LEGACY_ENTRY_SETTINGS> CustomLegacySettings = XObjArray<CUSTOM_LEGACY_ENTRY_SETTINGS>();
XObjArray<CUSTOM_TOOL_ENTRY_SETTINGS> CustomToolSettings = XObjArray<CUSTOM_TOOL_ENTRY_SETTINGS>();
bool getDarkEmbedded(bool isDaylight) const;
} GUI = GUIClass();
@ -937,11 +971,10 @@ typedef struct {
class ACPI_PATCHED_AML
{
public:
ACPI_PATCHED_AML *Next;
CHAR16 *FileName;
INPUT_ITEM MenuItem = INPUT_ITEM();
XString8 FileName = XString8();
INPUT_ITEM MenuItem = INPUT_ITEM();
ACPI_PATCHED_AML() : Next(0), FileName(0) {};
ACPI_PATCHED_AML() {};
ACPI_PATCHED_AML(const ACPI_PATCHED_AML& other) = delete; // Can be defined if needed
const ACPI_PATCHED_AML& operator = ( const ACPI_PATCHED_AML & ) = delete; // Can be defined if needed
~ACPI_PATCHED_AML() { }
@ -1023,7 +1056,7 @@ extern UINT16 gBacklightLevel;
extern TagDict* gConfigDict[];
// ACPI/PATCHED/AML
extern ACPI_PATCHED_AML *ACPIPatchedAML;
extern XObjArray<ACPI_PATCHED_AML> ACPIPatchedAML;
// SysVariables
@ -1080,6 +1113,11 @@ public:
uint16_t C3Latency = 0;
XObjArray<CUSTOM_LOADER_ENTRY> CustomEntries = XObjArray<CUSTOM_LOADER_ENTRY>();
XObjArray<CUSTOM_LEGACY_ENTRY> CustomLegacyEntries = XObjArray<CUSTOM_LEGACY_ENTRY>();
XObjArray<CUSTOM_TOOL_ENTRY> CustomToolsEntries = XObjArray<CUSTOM_TOOL_ENTRY>();
INTN Codepage = 0xC0;
INTN CodepageSize = 0xC0;
REFIT_CONFIG() {};

View File

@ -146,21 +146,21 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi
// If this isn't a custom entry make sure it's not hidden by a custom entry
if (!CustomEntry) {
for (size_t CustomIndex = 0 ; CustomIndex < gSettings.GUI.CustomLegacy.size() ; ++CustomIndex ) {
CUSTOM_LEGACY_ENTRY& Custom = gSettings.GUI.CustomLegacy[CustomIndex];
if ( OSFLAG_ISSET(Custom.Flags, OSFLAG_DISABLED) || Custom.Hidden ) {
if (Custom.Volume.notEmpty()) {
if ( !Volume->DevicePathString.contains(Custom.Volume) && !Volume->VolName.contains(Custom.Volume) ) {
if (Custom.Type != 0) {
if (Custom.Type == Volume->LegacyOS->Type) {
for (size_t CustomIndex = 0 ; CustomIndex < GlobalConfig.CustomLegacyEntries.size() ; ++CustomIndex ) {
CUSTOM_LEGACY_ENTRY& Custom = GlobalConfig.CustomLegacyEntries[CustomIndex];
if ( Custom.settings.Disabled || OSFLAG_ISSET(Custom.getFlags(), OSFLAG_DISABLED) || Custom.settings.Hidden ) {
if (Custom.settings.Volume.notEmpty()) {
if ( !Volume->DevicePathString.contains(Custom.settings.Volume) && !Volume->VolName.contains(Custom.settings.Volume) ) {
if (Custom.settings.Type != 0) {
if (Custom.settings.Type == Volume->LegacyOS->Type) {
Entry->Hidden = true;
}
} else {
Entry->Hidden = true;
}
}
} else if (Custom.Type != 0) {
if (Custom.Type == Volume->LegacyOS->Type) {
} else if (Custom.settings.Type != 0) {
if (Custom.settings.Type == Volume->LegacyOS->Type) {
Entry->Hidden = true;
}
}
@ -283,14 +283,14 @@ void AddCustomLegacy(void)
XIcon DriveIcon;
// DBG("Custom legacy start\n");
if (gSettings.GUI.CustomLegacy.notEmpty()) {
if (GlobalConfig.CustomLegacyEntries.notEmpty()) {
DbgHeader("AddCustomLegacy");
}
// Traverse the custom entries
for (size_t i = 0 ; i < gSettings.GUI.CustomLegacy.size() ; ++i ) {
CUSTOM_LEGACY_ENTRY& Custom = gSettings.GUI.CustomLegacy[i];
if (OSFLAG_ISSET(Custom.Flags, OSFLAG_DISABLED)) {
for (size_t i = 0 ; i < GlobalConfig.CustomLegacyEntries.size() ; ++i ) {
CUSTOM_LEGACY_ENTRY& Custom = GlobalConfig.CustomLegacyEntries[i];
if (Custom.settings.Disabled || OSFLAG_ISSET(Custom.getFlags(), OSFLAG_DISABLED)) {
DBG("Custom legacy %zu skipped because it is disabled.\n", i);
continue;
}
@ -298,8 +298,8 @@ void AddCustomLegacy(void)
// DBG("Custom legacy %llu skipped because it is hidden.\n", i);
// continue;
// }
if (Custom.Volume.notEmpty()) {
DBG("Custom legacy %zu matching \"%ls\" ...\n", i, Custom.Volume.wc_str());
if (Custom.settings.Volume.notEmpty()) {
DBG("Custom legacy %zu matching \"%ls\" ...\n", i, Custom.settings.Volume.wc_str());
}
for (VolumeIndex = 0; VolumeIndex < Volumes.size(); ++VolumeIndex) {
Volume = &Volumes[VolumeIndex];
@ -313,8 +313,8 @@ void AddCustomLegacy(void)
continue;
}
if (Custom.VolumeType != 0) {
if (((1ull<<Volume->DiskKind) & Custom.VolumeType) == 0) {
if (Custom.settings.VolumeType != 0) {
if (((1ull<<Volume->DiskKind) & Custom.settings.VolumeType) == 0) {
DBG("skipped because media is ignored\n");
continue;
}
@ -358,34 +358,34 @@ void AddCustomLegacy(void)
}
// Check for exact volume matches
if (Custom.Volume.notEmpty()) {
if ((StrStr(Volume->DevicePathString.wc_str(), Custom.Volume.wc_str()) == NULL) &&
((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom.Volume.wc_str()) == NULL))) {
if (Custom.settings.Volume.notEmpty()) {
if ((StrStr(Volume->DevicePathString.wc_str(), Custom.settings.Volume.wc_str()) == NULL) &&
((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom.settings.Volume.wc_str()) == NULL))) {
DBG("skipped\n");
continue;
}
// Check if the volume should be of certain os type
if ((Custom.Type != 0) && (Custom.Type != Volume->LegacyOS->Type)) {
if ((Custom.settings.Type != 0) && (Custom.settings.Type != Volume->LegacyOS->Type)) {
DBG("skipped because wrong type\n");
continue;
}
} else if ((Custom.Type != 0) && (Custom.Type != Volume->LegacyOS->Type)) {
} else if ((Custom.settings.Type != 0) && (Custom.settings.Type != Volume->LegacyOS->Type)) {
DBG("skipped because wrong type\n");
continue;
}
// Change to custom image if needed
MainIcon = Custom.Image;
if (MainIcon.Image.isEmpty()) {
MainIcon.Image.LoadXImage(&ThemeX.getThemeDir(), Custom.ImagePath);
MainIcon.Image.LoadXImage(&ThemeX.getThemeDir(), Custom.settings.ImagePath);
}
// Change to custom drive image if needed
DriveIcon = Custom.DriveImage;
if (DriveIcon.Image.isEmpty()) {
DriveIcon.Image.LoadXImage(&ThemeX.getThemeDir(), Custom.DriveImagePath);
DriveIcon.Image.LoadXImage(&ThemeX.getThemeDir(), Custom.settings.DriveImagePath);
}
// Create a legacy entry for this volume
if (AddLegacyEntry(Custom.FullTitle, Custom.Title, Volume, &MainIcon, &DriveIcon, Custom.Hotkey, TRUE))
if (AddLegacyEntry(Custom.settings.FullTitle, Custom.settings.Title, Volume, &MainIcon, &DriveIcon, Custom.settings.Hotkey, TRUE))
{
DBG("match!\n");
}

View File

@ -246,9 +246,9 @@ void AddCustomTool(void)
// DBG("Custom tool start\n");
DbgHeader("AddCustomTool");
// Traverse the custom entries
for (size_t i = 0 ; i < gSettings.GUI.CustomTool.size(); ++i) {
CUSTOM_TOOL_ENTRY& Custom = gSettings.GUI.CustomTool[i];
if (OSFLAG_ISSET(Custom.Flags, OSFLAG_DISABLED)) {
for (size_t i = 0 ; i < GlobalConfig.CustomToolsEntries.size(); ++i) {
CUSTOM_TOOL_ENTRY& Custom = GlobalConfig.CustomToolsEntries[i];
if (OSFLAG_ISSET(Custom.getFlags(), OSFLAG_DISABLED)) {
DBG("Custom tool %llu skipped because it is disabled.\n", i);
continue;
}
@ -257,7 +257,7 @@ void AddCustomTool(void)
// continue;
// }
if (Custom.Volume.notEmpty()) {
if (Custom.settings.Volume.notEmpty()) {
DBG("Custom tool %llu matching \"%ls\" ...\n", i, Custom.Volume);
}
for (VolumeIndex = 0; VolumeIndex < Volumes.size(); ++VolumeIndex) {
@ -278,8 +278,8 @@ void AddCustomTool(void)
continue;
}
if (Custom.VolumeType != 0) {
if (((1ull<<Volume->DiskKind) & Custom.VolumeType) == 0) {
if (Custom.settings.VolumeType != 0) {
if (((1ull<<Volume->DiskKind) & Custom.settings.VolumeType) == 0) {
DBG("skipped because media is ignored\n");
continue;
}
@ -291,28 +291,28 @@ void AddCustomTool(void)
}
// Check for exact volume matches
if (Custom.Volume.notEmpty()) {
if ((StrStr(Volume->DevicePathString.wc_str(), Custom.Volume.wc_str()) == NULL) &&
((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom.Volume.wc_str()) == NULL))) {
if (Custom.settings.Volume.notEmpty()) {
if ((StrStr(Volume->DevicePathString.wc_str(), Custom.settings.Volume.wc_str()) == NULL) &&
((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom.settings.Volume.wc_str()) == NULL))) {
DBG("skipped\n");
continue;
}
}
// Check the tool exists on the volume
if (!FileExists(Volume->RootDir, Custom.Path)) {
if (!FileExists(Volume->RootDir, Custom.settings.Path)) {
DBG("skipped because path '%s' does not exist\n", Custom.Path.wc_str());
continue;
}
// Change to custom image if needed
Image = Custom.Image;
if (Image.isEmpty() && Custom.ImagePath.notEmpty()) {
Image.LoadXImage(&ThemeX.getThemeDir(), Custom.ImagePath);
if (Image.isEmpty() && Custom.settings.ImagePath.notEmpty()) {
Image.LoadXImage(&ThemeX.getThemeDir(), Custom.settings.ImagePath);
}
if (Image.isEmpty()) {
AddToolEntry(Custom.Path, Custom.FullTitle.wc_str(), Custom.Title.wc_str(), Volume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), Custom.Hotkey, Custom.LoadOptions);
AddToolEntry(Custom.settings.Path, Custom.settings.FullTitle.wc_str(), Custom.settings.Title.wc_str(), Volume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), Custom.settings.Hotkey, Custom.getLoadOptions());
} else {
// Create a legacy entry for this volume
AddToolEntry(Custom.Path, Custom.FullTitle.wc_str(), Custom.Title.wc_str(), Volume, Image, Custom.Hotkey, Custom.LoadOptions);
AddToolEntry(Custom.settings.Path, Custom.settings.FullTitle.wc_str(), Custom.settings.Title.wc_str(), Volume, Image, Custom.settings.Hotkey, Custom.getLoadOptions());
}
DBG("match!\n");
// break; // break scan volumes, continue scan entries -- why?

View File

@ -0,0 +1,35 @@
//
// Languages.h
// CloverX64TestNewParser
//
// Created by Jief on 23/03/2021.
// Copyright © 2021 Jief_Machak. All rights reserved.
//
#ifndef Languages_h
#define Languages_h
typedef enum {
english = 0, //en
russian, //ru
french, //fr
german, //de
dutch, //nl
italian, //it
spanish, //es
portuguese, //pt
brasil, //br
polish, //pl
ukrainian, //ua
croatian, //hr
czech, //cs
indonesian, //id
korean, //ko
chinese, //cn
romanian //ro
//something else? add, please
} LANGUAGES;
#endif /* Languages_h */

View File

@ -304,7 +304,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", gSettings.GUI.Codepage, AsciiPageSize);
DBG("codepage=%llx, asciiPage=%x\n", GlobalConfig.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
@ -313,7 +313,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 >= gSettings.GUI.Codepage) ? (c - gSettings.GUI.Codepage + AsciiPageSize) : c; //International letters
INTN c2 = (c >= GlobalConfig.Codepage) ? (c - GlobalConfig.Codepage + AsciiPageSize) : c; //International letters
c = c2 & 0xFF; //this maximum raster font size
}
// DBG("char to render 0x%hhx\n", c);

View File

@ -41,6 +41,7 @@
include/DsdtFixList.h
include/Efi.h
include/Handle.h
include/Languages.h
include/OneLinerMacros.h
include/Pci.h
include/XToolsConf.h

View File

@ -2437,19 +2437,10 @@ GetListOfACPI()
{
REFIT_DIR_ITER DirIter;
EFI_FILE_INFO *DirEntry = NULL;
ACPI_PATCHED_AML *ACPIPatchedAMLTmp;
// XStringW AcpiPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str());
// DBG("Get list of ACPI at path %ls\n", AcpiPath.wc_str());
while (ACPIPatchedAML != NULL) {
if (ACPIPatchedAML->FileName) {
FreePool(ACPIPatchedAML->FileName);
}
ACPIPatchedAMLTmp = ACPIPatchedAML;
ACPIPatchedAML = ACPIPatchedAML->Next;
FreePool(ACPIPatchedAMLTmp);
}
ACPIPatchedAML = NULL;
// DBG("free acpi list done\n");
ACPIPatchedAML.setEmpty();
DirIterOpen(&selfOem.getConfigDir(), L"ACPI\\patched", &DirIter);
while (DirIterNext(&DirIter, 2, L"*.aml", &DirEntry)) {
@ -2462,8 +2453,8 @@ GetListOfACPI()
}
// DBG("Found name %ls\n", DirEntry->FileName);
BOOLEAN ACPIDisabled = FALSE;
ACPIPatchedAMLTmp = new ACPI_PATCHED_AML; // if changing, notice freepool above
ACPIPatchedAMLTmp->FileName = SWPrintf("%ls", DirEntry->FileName).forgetDataWithoutFreeing(); // if changing, notice freepool above
ACPI_PATCHED_AML* ACPIPatchedAMLTmp = new ACPI_PATCHED_AML;
ACPIPatchedAMLTmp->FileName.takeValueFrom(DirEntry->FileName);
INTN Count = gSettings.ACPI.DisabledAML.size();
for (INTN i = 0; i < Count; i++) {
@ -2476,8 +2467,7 @@ GetListOfACPI()
}
}
ACPIPatchedAMLTmp->MenuItem.BValue = ACPIDisabled;
ACPIPatchedAMLTmp->Next = ACPIPatchedAML;
ACPIPatchedAML = ACPIPatchedAMLTmp;
ACPIPatchedAML.AddReference(ACPIPatchedAMLTmp, true);
}
DirIterClose(&DirIter);
@ -2550,6 +2540,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
* To ease copy/paste and text replacement from GetUserSettings, the parameter has the same name as the global
* and is passed by non-const reference.
* This temporary during the refactoring
* All code from this comes from settings.cpp. I am taking out all the init code from settings.cpp so I can replace the reading layer.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
@ -2634,13 +2625,60 @@ void afterGetUserSettings(const SETTINGS_DATA& gSettings)
}
}
ThemeX.DarkEmbedded = gSettings.GUI.DarkEmbedded;
for ( size_t idx = 0 ; idx < gSettings.GUI.CustomEntriesSettings.size() ; ++idx ) {
const CUSTOM_LOADER_ENTRY_SETTINGS& CustomEntrySettings = gSettings.GUI.CustomEntriesSettings[idx];
CUSTOM_LOADER_ENTRY* entry = new CUSTOM_LOADER_ENTRY(CustomEntrySettings);
GlobalConfig.CustomEntries.AddReference(entry, true);
}
if ( gSettings.GUI.Theme.notEmpty() )
{
ThemeX.Theme.takeValueFrom(gSettings.GUI.Theme);
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 ( gSettings.GUI.Theme.equalIC(ThemeNameArray[i]) ) {
OldChosenTheme = i;
break;
}
}
}
EFI_TIME Now;
gRT->GetTime(&Now, NULL);
INT32 NowHour = Now.Hour + gSettings.GUI.Timezone;
if (NowHour < 0 ) NowHour += 24;
if (NowHour >= 24 ) NowHour -= 24;
ThemeX.Daylight = (NowHour > 8) && (NowHour < 20);
ThemeX.DarkEmbedded = gSettings.GUI.getDarkEmbedded(ThemeX.Daylight);
if ( gSettings.GUI.gLanguage == english ) {
GlobalConfig.Codepage = 0xC0;
GlobalConfig.CodepageSize = 0;
} else if ( gSettings.GUI.gLanguage == russian ) {
GlobalConfig.Codepage = 0x410;
GlobalConfig.CodepageSize = 0x40;
} else if ( gSettings.GUI.gLanguage == ukrainian ) {
GlobalConfig.Codepage = 0x400;
GlobalConfig.CodepageSize = 0x60;
} else if ( gSettings.GUI.gLanguage == chinese ) {
GlobalConfig.Codepage = 0x3400;
GlobalConfig.CodepageSize = 0x19C0;
} else if ( gSettings.GUI.gLanguage == korean ) {
GlobalConfig.Codepage = 0x1100;
GlobalConfig.CodepageSize = 0x100;
}
if (gSettings.InjectEDID){
//DBG("Inject EDID\n");
if ( gSettings.CustomEDIDsize > 0 && gSettings.CustomEDIDsize % 128 == 0 ) {
InitializeEdidOverride();
}
}
}
#pragma GCC diagnostic pop

View File

@ -457,12 +457,9 @@ void FillInputs(BOOLEAN New)
}
}
if (ACPIPatchedAML) {
ACPI_PATCHED_AML *ACPIPatchedAMLTmp = ACPIPatchedAML;
while (ACPIPatchedAMLTmp) {
ACPIPatchedAMLTmp->MenuItem.ItemType = BoolValue;
ACPIPatchedAMLTmp = ACPIPatchedAMLTmp->Next;
}
for ( size_t idx = 0 ; idx < ACPIPatchedAML.size() ; ++idx) {
ACPI_PATCHED_AML& ACPIPatchedAMLTmp = ACPIPatchedAML[idx];
ACPIPatchedAMLTmp.MenuItem.ItemType = BoolValue;
}
}
@ -1982,19 +1979,16 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropTables()
SubScreen->AddMenuItemInput(4, "Drop all OEM SSDT", FALSE);
SubScreen->AddMenuItemInput(113, "Automatic smart merge", FALSE);
if (ACPIPatchedAML) {
ACPI_PATCHED_AML *ACPIPatchedAMLTmp = ACPIPatchedAML;
while (ACPIPatchedAMLTmp) {
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf("Drop \"%ls\"", ACPIPatchedAMLTmp->FileName);
for ( size_t idx = 0 ; idx < ACPIPatchedAML.size() ; ++idx) {
ACPI_PATCHED_AML& ACPIPatchedAMLTmp = ACPIPatchedAML[idx];
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf("Drop \"%s\"", ACPIPatchedAMLTmp.FileName.c_str());
// InputBootArgs->Tag = TAG_INPUT;
InputBootArgs->Row = 0xFFFF; //cursor
InputBootArgs->Item = &(ACPIPatchedAMLTmp->MenuItem);
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
ACPIPatchedAMLTmp = ACPIPatchedAMLTmp->Next;
}
InputBootArgs->Row = 0xFFFF; //cursor
InputBootArgs->Item = &(ACPIPatchedAMLTmp.MenuItem);
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);