mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-02-22 02:01:47 +01:00
Create Properties, Arbitrary and AddProperties menu.
hex2bin returns the length when passing NULL for out parameter instead of 0. Buildid in OEMString for my own build. Create TagTypes.h. Rename AddProperties to AddPropertiesArray. devprop_generate_string now returns a XString8. Add cpy method in XBuffer. Add strsicpy in XString.
This commit is contained in:
parent
a5494a89f6
commit
69a47c5fac
@ -35,7 +35,11 @@ XString8 stdio_static_buf = XString8().takeValueFrom("XXXXXXXX-XXXX-XXXX-XXXX-XX
|
||||
static char efiStrError_buf[40];
|
||||
const char* efiStrError(EFI_STATUS Status)
|
||||
{
|
||||
snprintf(efiStrError_buf, sizeof(efiStrError_buf), "efi error %llu(0x%llx)", Status, Status);
|
||||
if ( !EFI_ERROR(Status) ) {
|
||||
snprintf(efiStrError_buf, sizeof(efiStrError_buf), "efi success (%llu,0x%llx)", Status, Status);
|
||||
}else{
|
||||
snprintf(efiStrError_buf, sizeof(efiStrError_buf), "efi error (%llu,0x%llx)", Status, Status);
|
||||
}
|
||||
return efiStrError_buf;
|
||||
}
|
||||
|
||||
|
@ -149,6 +149,7 @@
|
||||
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 */; };
|
||||
9AFB5F78261060CB0078E53D /* CompareSettingsRtVariables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AFB5F76261060CB0078E53D /* CompareSettingsRtVariables.cpp */; };
|
||||
9AFB5F7A2610EDD50078E53D /* Config_Quirks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AFB5F792610EDD50078E53D /* Config_Quirks.cpp */; };
|
||||
9AFDCEA325CD9A3300EEAF06 /* OcDevicePathLib.lib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AFDCEA225CD9A3200EEAF06 /* OcDevicePathLib.lib */; };
|
||||
9AFDCEA525CD9B1C00EEAF06 /* BaseCpuLib.lib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AFDCEA425CD9B1C00EEAF06 /* BaseCpuLib.lib */; };
|
||||
9AFDCEA725CD9B2C00EEAF06 /* BaseSerialPortLib16550.lib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AFDCEA625CD9B2B00EEAF06 /* BaseSerialPortLib16550.lib */; };
|
||||
@ -5020,6 +5021,7 @@
|
||||
9AD7B14F26079F5D00E850D1 /* REFIT_MAINMENU_SCREEN.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = REFIT_MAINMENU_SCREEN.cpp; sourceTree = "<group>"; };
|
||||
9AFB5F76261060CB0078E53D /* CompareSettingsRtVariables.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CompareSettingsRtVariables.cpp; sourceTree = "<group>"; };
|
||||
9AFB5F77261060CB0078E53D /* CompareSettingsRtVariables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompareSettingsRtVariables.h; sourceTree = "<group>"; };
|
||||
9AFB5F792610EDD50078E53D /* Config_Quirks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Config_Quirks.cpp; sourceTree = "<group>"; };
|
||||
9AFDCEA225CD9A3200EEAF06 /* OcDevicePathLib.lib */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = OcDevicePathLib.lib; path = ../../../../Build/Clover/DEBUGMACOS_XCODE8/X64/OpenCorePkg/Library/OcDevicePathLib/OcDevicePathLib/OUTPUT/OcDevicePathLib.lib; sourceTree = "<group>"; };
|
||||
9AFDCEA425CD9B1C00EEAF06 /* BaseCpuLib.lib */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = BaseCpuLib.lib; path = ../../../../Build/Clover/DEBUGMACOS_XCODE8/X64/MdePkg/Library/BaseCpuLib/BaseCpuLib/OUTPUT/BaseCpuLib.lib; sourceTree = "<group>"; };
|
||||
9AFDCEA625CD9B2B00EEAF06 /* BaseSerialPortLib16550.lib */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = BaseSerialPortLib16550.lib; path = ../../../../Build/Clover/DEBUGMACOS_XCODE8/X64/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550/OUTPUT/BaseSerialPortLib16550.lib; sourceTree = "<group>"; };
|
||||
@ -5265,10 +5267,6 @@
|
||||
9A28CCAC241B816400F3D247 /* Platform */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A272A7D25D5062D00F03E19 /* DataHub.cpp */,
|
||||
9A272A7E25D5062E00F03E19 /* DataHub.h */,
|
||||
9A272A7C25D5062D00F03E19 /* DataHubExt.h */,
|
||||
9A358AF325CF115100A3850D /* ConfigPlist */,
|
||||
9AA9240D25CD5B2D00BD5E8B /* AcpiPatcher.cpp */,
|
||||
9AA9240825CD5B2C00BD5E8B /* AcpiPatcher.h */,
|
||||
9AA923FB25CD5B2900BD5E8B /* AmlGenerator.cpp */,
|
||||
@ -5288,12 +5286,16 @@
|
||||
9AA923DE25CD5B2600BD5E8B /* BootOptions.h */,
|
||||
9AA9E4D425CD1C9400BD5E8B /* card_vlist.cpp */,
|
||||
9AA9E4D525CD1C9400BD5E8B /* card_vlist.h */,
|
||||
9A358AF325CF115100A3850D /* ConfigPlist */,
|
||||
9AA9240025CD5B2A00BD5E8B /* Console.cpp */,
|
||||
9AA9239725CD5B1B00BD5E8B /* Console.h */,
|
||||
9AA923FE25CD5B2A00BD5E8B /* cpu.cpp */,
|
||||
9AA923CB25CD5B2100BD5E8B /* cpu.h */,
|
||||
9A272A7D25D5062D00F03E19 /* DataHub.cpp */,
|
||||
9A272A7E25D5062E00F03E19 /* DataHub.h */,
|
||||
9AA923D825CD5B2500BD5E8B /* DataHubCpu.cpp */,
|
||||
9AA923DC25CD5B2600BD5E8B /* DataHubCpu.h */,
|
||||
9A272A7C25D5062D00F03E19 /* DataHubExt.h */,
|
||||
9AA9240725CD5B2C00BD5E8B /* device_inject.cpp */,
|
||||
9AA923C625CD5B2000BD5E8B /* device_inject.h */,
|
||||
9AA9240925CD5B2C00BD5E8B /* DevicePath.cpp */,
|
||||
@ -5388,6 +5390,7 @@
|
||||
9A358AF325CF115100A3850D /* ConfigPlist */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9AFB5F792610EDD50078E53D /* Config_Quirks.cpp */,
|
||||
9AA316CE260EF7750033D29F /* CompareField.cpp */,
|
||||
9AA316CF260EF7760033D29F /* CompareField.h */,
|
||||
9A358B1625CF115100A3850D /* CompareSettings.cpp */,
|
||||
@ -15961,6 +15964,7 @@
|
||||
9AA9252E25CD74CC00BD5E8B /* legacy.cpp in Sources */,
|
||||
9AA924A725CD5B2E00BD5E8B /* Self.cpp in Sources */,
|
||||
9AA925A125CD770F00BD5E8B /* VectorGraphics.cpp in Sources */,
|
||||
9AFB5F7A2610EDD50078E53D /* Config_Quirks.cpp in Sources */,
|
||||
9A9223312402FD1000483CBA /* main.cpp in Sources */,
|
||||
9AA316D3260EFC410033D29F /* CompareSettingsACPI.cpp in Sources */,
|
||||
9AA924D725CD5B2E00BD5E8B /* cpu.cpp in Sources */,
|
||||
|
@ -313,58 +313,56 @@
|
||||
</dict>
|
||||
<key>Devices</key>
|
||||
<dict>
|
||||
<key>AddProperties</key>
|
||||
<array>
|
||||
<key>Properties</key>
|
||||
<dict>
|
||||
<key>!Properties_key1</key>
|
||||
<dict>
|
||||
<key>Device</key>
|
||||
<string>SATA</string>
|
||||
<key>Disabled</key>
|
||||
<false/>
|
||||
<key>Key</key>
|
||||
<string>10</string>
|
||||
<key>Value</key>
|
||||
<integer>11</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Device</key>
|
||||
<string>LPC</string>
|
||||
<key>Disabled</key>
|
||||
<true/>
|
||||
<key>Key</key>
|
||||
<string>12</string>
|
||||
<key>Value</key>
|
||||
<integer>13</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Device</key>
|
||||
<string>SmBUS</string>
|
||||
<key>Disabled</key>
|
||||
<false/>
|
||||
<key>Key</key>
|
||||
<string>kk</string>
|
||||
<key>Value</key>
|
||||
<string>ll</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Device</key>
|
||||
<string>Firewire</string>
|
||||
<key>Disabled</key>
|
||||
<false/>
|
||||
<key>Key</key>
|
||||
<string>14</string>
|
||||
<key>Value</key>
|
||||
<key>pci-aspm-default</key>
|
||||
<integer>0</integer>
|
||||
<key>AAPL,GfxYTile</key>
|
||||
<data>
|
||||
FQ==
|
||||
AQAAAA==
|
||||
</data>
|
||||
<key>AAPL,ig-platform-id</key>
|
||||
<data>
|
||||
AAAbWQ==
|
||||
</data>
|
||||
<key>AAPL,slot-name</key>
|
||||
<string>Internal@0,2,0</string>
|
||||
<key>device-id</key>
|
||||
<data>
|
||||
G1kAAA==
|
||||
</data>
|
||||
</dict>
|
||||
</array>
|
||||
<key>AirportBridgeDeviceName</key>
|
||||
<string>airp</string>
|
||||
<key>Test2</key>
|
||||
<dict>
|
||||
<key>Test2Key1</key>
|
||||
<data>AQAAAA==</data>
|
||||
<key>Test2Key2</key>
|
||||
<string>Test2Value2</string>
|
||||
</dict>
|
||||
<key>!PrimaryGPU</key>
|
||||
<dict>
|
||||
<key>TestPrimaryGPU</key>
|
||||
<data>AQAAAA==</data>
|
||||
<key>Test2Key2</key>
|
||||
<string>Test2Value2</string>
|
||||
</dict>
|
||||
<key>SecondaryGPU</key>
|
||||
<dict>
|
||||
<key>Test2SecondaryGPU</key>
|
||||
<data>AQAAAA==</data>
|
||||
<key>Test2Key2</key>
|
||||
<string>Test2Value2</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>Arbitrary</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Comment</key>
|
||||
<string>C1</string>
|
||||
<key>PciAddr</key>
|
||||
<string>00:00.01</string>
|
||||
<key>CustomProperties</key>
|
||||
<array>
|
||||
<dict>
|
||||
@ -394,10 +392,23 @@
|
||||
</data>
|
||||
</dict>
|
||||
</array>
|
||||
<key>PciAddr</key>
|
||||
<string>00:00.01</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>AddProperties</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Device</key>
|
||||
<string>SATA</string>
|
||||
<key>Disabled</key>
|
||||
<false/>
|
||||
<key>Key</key>
|
||||
<string>10</string>
|
||||
<key>Value</key>
|
||||
<integer>11</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>AirportBridgeDeviceName</key>
|
||||
<string>airp</string>
|
||||
<key>Audio</key>
|
||||
<dict>
|
||||
<key>AFGLowPowerState</key>
|
||||
@ -436,35 +447,6 @@
|
||||
<string>0x710</string>
|
||||
<key>NoDefaultProperties</key>
|
||||
<true/>
|
||||
<key>Properties</key>
|
||||
<dict>
|
||||
<key>PciRoot(0x0)/Pci(0x2,0x0)</key>
|
||||
<dict>
|
||||
<key>pci-aspm-default</key>
|
||||
<integer>0</integer>
|
||||
<key>AAPL,GfxYTile</key>
|
||||
<data>
|
||||
AQAAAA==
|
||||
</data>
|
||||
<key>AAPL,ig-platform-id</key>
|
||||
<data>
|
||||
AAAbWQ==
|
||||
</data>
|
||||
<key>AAPL,slot-name</key>
|
||||
<string>Internal@0,2,0</string>
|
||||
<key>device-id</key>
|
||||
<data>
|
||||
G1kAAA==
|
||||
</data>
|
||||
</dict>
|
||||
<key>Test2</key>
|
||||
<dict>
|
||||
<key>Test2Key1</key>
|
||||
<data>AQAAAA==</data>
|
||||
<key>Test2Key2</key>
|
||||
<string>Test2Value2</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SetIntelBacklight</key>
|
||||
<true/>
|
||||
<key>SetIntelMaxBacklight</key>
|
||||
@ -671,36 +653,6 @@
|
||||
<integer>3</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>BootDisplay</key>
|
||||
<integer>12</integer>
|
||||
<key>DualLink</key>
|
||||
<integer>1</integer>
|
||||
<key>EDID</key>
|
||||
<dict>
|
||||
<key>Custom</key>
|
||||
<data>AP///////wBMo0cwAAAAAAAUAQOAHBB46h2FkVZZjyYYUFQAAAABAQEBAQEBAQEBAQEBAQEBOB1W1FAAFjAwICUAFZwQAAAZAAAADwAAAAAAAAAAACXZBmoAAAAA/gBTQU1TVU5HCiBMo0FUAAAA/gBMVE4xMjVBVDAxNDAxAF0=</data>
|
||||
<key>Inject</key>
|
||||
<true/>
|
||||
<key>ProductID</key>
|
||||
<string>0x9777</string>
|
||||
<key>VendorID</key>
|
||||
<string>0x1007</string>
|
||||
</dict>
|
||||
<key>FBName</key>
|
||||
<string>Exmoor</string>
|
||||
<key>Inject</key>
|
||||
<dict>
|
||||
<key>ATI</key>
|
||||
<true/>
|
||||
<key>Intel</key>
|
||||
<true/>
|
||||
<key>NVidia</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>LoadVBios</key>
|
||||
<true/>
|
||||
<key>NVCAP</key>
|
||||
<string>0304</string>
|
||||
<key>NVIDIA</key>
|
||||
<array>
|
||||
<dict>
|
||||
@ -732,6 +684,29 @@
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>BootDisplay</key>
|
||||
<integer>12</integer>
|
||||
<key>DualLink</key>
|
||||
<integer>1</integer>
|
||||
<key>EDID</key>
|
||||
<dict>
|
||||
<key>Custom</key>
|
||||
<data>AP///////wBMo0cwAAAAAAAUAQOAHBB46h2FkVZZjyYYUFQAAAABAQEBAQEBAQEBAQEBAQEBOB1W1FAAFjAwICUAFZwQAAAZAAAADwAAAAAAAAAAACXZBmoAAAAA/gBTQU1TVU5HCiBMo0FUAAAA/gBMVE4xMjVBVDAxNDAxAF0=</data>
|
||||
<key>Inject</key>
|
||||
<true/>
|
||||
<key>ProductID</key>
|
||||
<string>0x9777</string>
|
||||
<key>VendorID</key>
|
||||
<string>0x1007</string>
|
||||
</dict>
|
||||
<key>FBName</key>
|
||||
<string>Exmoor</string>
|
||||
<key>Inject</key>
|
||||
<true/>
|
||||
<key>LoadVBios</key>
|
||||
<true/>
|
||||
<key>NVCAP</key>
|
||||
<string>0304</string>
|
||||
<key>NvidiaGeneric</key>
|
||||
<true/>
|
||||
<key>NvidiaNoEFI</key>
|
||||
@ -1617,5 +1592,97 @@
|
||||
<key>NvidiaWeb</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>Quirks</key>
|
||||
<dict>
|
||||
<key>AvoidRuntimeDefrag</key>
|
||||
<false/>
|
||||
<key>DevirtualiseMmio</key>
|
||||
<false/>
|
||||
<key>DisableSingleUser</key>
|
||||
<false/>
|
||||
<key>DisableVariableWrite</key>
|
||||
<false/>
|
||||
<key>DiscardHibernateMap</key>
|
||||
<false/>
|
||||
<key>EnableSafeModeSlide</key>
|
||||
<false/>
|
||||
<key>EnableWriteUnprotector</key>
|
||||
<true/>
|
||||
<key>ForceExitBootServices</key>
|
||||
<false/>
|
||||
<key>MmioWhitelist</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Comment</key>
|
||||
<string>c1</string>
|
||||
<key>Address</key>
|
||||
<string>12345678</string>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Comment</key>
|
||||
<string></string>
|
||||
<key>Address</key>
|
||||
<string>12345678</string>
|
||||
<key>Enabled</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>#Comment</key>
|
||||
<string>c1</string>
|
||||
<key>Address</key>
|
||||
<string>abcde</string>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</array>
|
||||
<key>ProtectMemoryRegions</key>
|
||||
<false/>
|
||||
<key>ProtectSecureBoot</key>
|
||||
<false/>
|
||||
<key>ProtectUefiServices</key>
|
||||
<false/>
|
||||
<key>ProvideConsoleGopEnable</key>
|
||||
<false/>
|
||||
<key>ProvideCustomSlide</key>
|
||||
<true/>
|
||||
<key>ProvideMaxSlide</key>
|
||||
<integer>0</integer>
|
||||
<key>RebuildAppleMemoryMap</key>
|
||||
<false/>
|
||||
<key>SetupVirtualMap</key>
|
||||
<false/>
|
||||
<key>SignalAppleOS</key>
|
||||
<false/>
|
||||
<key>SyncRuntimePermissions</key>
|
||||
<false/>
|
||||
|
||||
|
||||
<key>FuzzyMatch</key>
|
||||
<false/>
|
||||
<key>KernelCache</key>
|
||||
<string>Auto</string>
|
||||
<key>AppleXcpmExtraMsrs</key>
|
||||
<false/>
|
||||
<key>AppleXcpmForceBoost</key>
|
||||
<false/>
|
||||
<key>DisableIoMapper</key>
|
||||
<false/>
|
||||
<key>DisableLinkeditJettison</key>
|
||||
<false/>
|
||||
<key>DummyPowerManagement</key>
|
||||
<false/>
|
||||
<key>ExternalDiskIcons</key>
|
||||
<false/>
|
||||
<key>IncreasePciBarSize</key>
|
||||
<false/>
|
||||
<key>PowerTimeoutKernelPanic</key>
|
||||
<false/>
|
||||
<key>ThirdPartyDrives</key>
|
||||
<false/>
|
||||
<key>XhciPortLimit</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -20,11 +20,13 @@
|
||||
#include "../../../rEFIt_UEFI/Platform/ConfigPlist/CompareSettings.h"
|
||||
|
||||
|
||||
|
||||
int test1()
|
||||
{
|
||||
char *source = NULL;
|
||||
size_t newLen = 0;
|
||||
FILE *fp = fopen("config-test1.plist", "r");
|
||||
// FILE *fp = fopen("/JiefLand/5.Devel/Clover/user config/eng_redaesm/config.plist", "r");
|
||||
if (fp == NULL) {
|
||||
fputs("Error fopen config plist", stderr);
|
||||
exit(-1);
|
||||
@ -70,10 +72,19 @@ int test1()
|
||||
|
||||
SETTINGS_DATA settings;
|
||||
Status = GetEarlyUserSettings(dict, settings);
|
||||
//printf("settings=%llx, &ResetHDA=%llx %d\n", uintptr_t(&settings), uintptr_t(&settings.Devices.Audio.ResetHDA), settings.Devices.Audio.ResetHDA);
|
||||
printf("GetEarlyUserSettings returns %s\n", efiStrError(Status));
|
||||
Status = GetUserSettings(dict, settings);
|
||||
printf("GetUserSettings returns %s\n", efiStrError(Status));
|
||||
|
||||
if ( !settings.Devices.compareOldAndCompatibleArb() ) {
|
||||
printf("!compareOldAndCompatibleArb");
|
||||
}
|
||||
|
||||
// if ( !compareOldAndNewArb(settings.Devices.newArbProperties, settings.Devices.oldArbProperties) ) {
|
||||
// printf("aie");
|
||||
// }
|
||||
|
||||
bool b;
|
||||
ConfigPlistClass configPlist;
|
||||
|
||||
@ -99,9 +110,81 @@ int test1()
|
||||
}
|
||||
|
||||
|
||||
class PlistTest : public XmlDict
|
||||
{
|
||||
public:
|
||||
XmlStringWArray DisableDrivers = XmlStringWArray();
|
||||
|
||||
XmlDictField m_fields[1] = {
|
||||
{"DisableDrivers", DisableDrivers},
|
||||
};
|
||||
virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); };
|
||||
};
|
||||
|
||||
int test2()
|
||||
{
|
||||
char *source = NULL;
|
||||
size_t newLen = 0;
|
||||
FILE *fp = fopen("config-test2.plist", "r");
|
||||
if (fp == NULL) {
|
||||
fputs("Error fopen config plist", stderr);
|
||||
exit(-1);
|
||||
}
|
||||
/* Go to the end of the file. */
|
||||
if (fseek(fp, 0L, SEEK_END) == 0) {
|
||||
/* Get the size of the file. */
|
||||
long bufsize = ftell(fp);
|
||||
if (bufsize == -1) {
|
||||
fputs("Error ftell config plist", stderr);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* Allocate our buffer to that size. */
|
||||
source = (char*)malloc(sizeof(char) * (bufsize + 1));
|
||||
|
||||
/* Go back to the start of the file. */
|
||||
if (fseek(fp, 0L, SEEK_SET) != 0) {
|
||||
fputs("Error fseek config plist", stderr);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* Read the entire file into memory. */
|
||||
newLen = fread(source, sizeof(char), bufsize, fp);
|
||||
if ( ferror( fp ) != 0 ) {
|
||||
fputs("Error reading config plist", stderr);
|
||||
exit(-1);
|
||||
} else {
|
||||
source[newLen++] = '\0'; /* Just to be safe. */
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
|
||||
|
||||
bool b;
|
||||
PlistTest plistTest;
|
||||
|
||||
XmlLiteParser xmlLiteParser;
|
||||
xmlLiteParser.init(source, newLen);
|
||||
xmlLiteParser.moveForwardUntilSignificant();
|
||||
xmlLiteParser.skipHeader();
|
||||
printf("\n");
|
||||
printf("=== [ Parse ] ====================\n");
|
||||
b = plistTest.parseFromXmlLite(&xmlLiteParser, ""_XS8, true);
|
||||
if ( b )
|
||||
{
|
||||
b = plistTest.validate(&xmlLiteParser, ""_XS8, XmlParserPosition(), true);
|
||||
}
|
||||
if ( xmlLiteParser.getErrorsAndWarnings().size() > 0 ) {
|
||||
for ( size_t idx = 0 ; idx < xmlLiteParser.getErrorsAndWarnings().size() ; idx++ ) {
|
||||
const XmlParserMessage& xmlMsg = xmlLiteParser.getErrorsAndWarnings()[idx];
|
||||
printf("%s: %s\n", xmlMsg.isError ? "Error" : "Warning", xmlMsg.msg.c_str());
|
||||
}
|
||||
}else{
|
||||
printf("Your plist looks so wonderful. Well done!\n");
|
||||
}
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" void tmp();
|
||||
|
||||
@ -122,6 +205,7 @@ s5.S8Printf("%s", buf);
|
||||
|
||||
|
||||
return test1();
|
||||
|
||||
// return test2();
|
||||
|
||||
// return all_tests() ? 0 : -1 ;
|
||||
}
|
||||
|
@ -1581,21 +1581,21 @@ BOOLEAN CustProperties(AML_CHUNK* pack, UINT32 Dev)
|
||||
{
|
||||
UINTN i;
|
||||
BOOLEAN Injected = FALSE;
|
||||
if (gSettings.Devices.AddProperties.size() == 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
if (gSettings.Devices.AddPropertyArray.size() == 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
return FALSE; // not do this for Arbitrary properties?
|
||||
}
|
||||
for (i = 0; i < gSettings.Devices.AddProperties.size(); i++) {
|
||||
if (gSettings.Devices.AddProperties[i].Device != Dev) {
|
||||
for (i = 0; i < gSettings.Devices.AddPropertyArray.size(); i++) {
|
||||
if (gSettings.Devices.AddPropertyArray[i].Device != Dev) {
|
||||
continue;
|
||||
}
|
||||
Injected = TRUE;
|
||||
|
||||
if (!gSettings.Devices.AddProperties[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
} else {
|
||||
aml_add_string(pack, gSettings.Devices.AddProperties[i].Key.c_str());
|
||||
aml_add_byte_buffer(pack, gSettings.Devices.AddProperties[i].Value.data(), (UINT32)gSettings.Devices.AddProperties[i].Value.size()); // unsafe cast
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
aml_add_string(pack, gSettings.Devices.AddPropertyArray[i].Key.c_str());
|
||||
aml_add_byte_buffer(pack, gSettings.Devices.AddPropertyArray[i].Value.data(), (UINT32)gSettings.Devices.AddPropertyArray[i].Value.size()); // unsafe cast
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
}
|
||||
}
|
||||
return Injected;
|
||||
|
@ -962,7 +962,7 @@ EFI_STATUS bootPBR(REFIT_VOLUME* volume, BOOLEAN SataReset)
|
||||
Regs.X.SI = (UINT16)(UINTN)pMBR;
|
||||
}
|
||||
|
||||
DBG("mbr: %hhX index: %llX pointer: %llX dx: %hX si: %hX\n", volume->IsMbrPartition, volume->MbrPartitionIndex, (uintptr_t)volume->MbrPartitionTable, Regs.X.DX, Regs.X.SI);
|
||||
DBG("mbr: %d index: %llX pointer: %llX dx: %hX si: %hX\n", volume->IsMbrPartition, volume->MbrPartitionIndex, (uintptr_t)volume->MbrPartitionTable, Regs.X.DX, Regs.X.SI);
|
||||
DBG("pmbr: %llX start: %X size: %X\n", (uintptr_t)&pMBR[volume->MbrPartitionIndex], pMBR[volume->MbrPartitionIndex].StartLBA, pMBR[volume->MbrPartitionIndex].Size);
|
||||
|
||||
//
|
||||
|
@ -556,7 +556,7 @@ SetBootCurrent(REFIT_MENU_ITEM_BOOTNUM *Entry)
|
||||
// data can be specified in <data></data> base64 encoded
|
||||
// or in <string></string> hex encoded
|
||||
//
|
||||
static UINT8
|
||||
UINT8
|
||||
*GetDataSetting (
|
||||
IN const TagDict* Dict,
|
||||
IN CONST CHAR8 *PropName,
|
||||
@ -4379,6 +4379,257 @@ static void getACPISettings(const TagDict *CfgDict, SETTINGS_DATA& gSettings)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 2021-04, Jief : this is untouched old code (except a small bug when name starts with '#') to create ArbProperties the old way
|
||||
* Old way = only one structure DEV_PROPERTY, Properties and ArbProperties are mixed together, no objetcs (XString, XBuffer).
|
||||
* This is temporary and is used to check that new code gives the same result as the old. To be remove in a while
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
void SETTINGS_DATA::DevicesClass::FillDevicePropertiesOld(SETTINGS_DATA& gSettings, const TagDict* DevicesDict)
|
||||
{
|
||||
#pragma GCC diagnostic pop
|
||||
/*
|
||||
* Properties is a single string, or a dict
|
||||
*/
|
||||
const TagStruct* Prop = DevicesDict->propertyForKey("Properties");
|
||||
if (Prop != NULL) {
|
||||
if (Prop->isString()) {
|
||||
}
|
||||
else if ( Prop->isDict() ) {
|
||||
INTN i;
|
||||
const TagDict* PropertiesDict = Prop->getDict();
|
||||
INTN Count = PropertiesDict->dictKeyCount(); //ok
|
||||
//gSettings.Devices.AddProperties = new DEV_PROPERTY[Count]; // seems bug, only ArbProperties is used in this block
|
||||
DEV_PROPERTY *DevPropDevice;
|
||||
DEV_PROPERTY *DevProps;
|
||||
DEV_PROPERTY **Child;
|
||||
|
||||
if (Count > 0) {
|
||||
DBG("Add %lld devices (kTagTypeDict):\n", Count);
|
||||
|
||||
for (i = 0; i < Count; i++) {
|
||||
const TagKey* key;
|
||||
const TagStruct* value;
|
||||
EFI_DEVICE_PATH_PROTOCOL* DevicePath = NULL;
|
||||
if ( !EFI_ERROR(PropertiesDict->getKeyAndValueAtIndex(i, &key, &value)) ) { //take a <key> with DevicePath. If GetKeyValueAtIndex return success, key and value != NULL
|
||||
XStringW DevicePathStr = key->keyStringValue();
|
||||
// DBG("Device: %ls\n", DevicePathStr);
|
||||
|
||||
// when key in Devices/Properties is one of the strings "PrimaryGPU" / "SecondaryGPU", use device path of first / second gpu accordingly
|
||||
#ifdef CLOVER_BUILD
|
||||
if ( DevicePathStr.equalIC("PrimaryGPU") ) {
|
||||
DevicePath = DevicePathFromHandle(gGraphics[0].Handle); // first gpu
|
||||
} else if ( DevicePathStr.equalIC("SecondaryGPU") && NGFX > 1) {
|
||||
DevicePath = DevicePathFromHandle(gGraphics[1].Handle); // second gpu
|
||||
} else {
|
||||
DevicePath = ConvertTextToDevicePath(DevicePathStr.wc_str()); //TODO
|
||||
}
|
||||
if (DevicePath == NULL) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
//Create Device node
|
||||
DevPropDevice = gSettings.Devices.ArbProperties;
|
||||
gSettings.Devices.ArbProperties = new DEV_PROPERTY;
|
||||
gSettings.Devices.ArbProperties->Next = DevPropDevice; //next device
|
||||
gSettings.Devices.ArbProperties->Child = NULL;
|
||||
gSettings.Devices.ArbProperties->Device = 0; //to differ from arbitrary
|
||||
gSettings.Devices.ArbProperties->DevicePath = DevicePath; //this is pointer
|
||||
gSettings.Devices.ArbProperties->Label = S8Printf("%s", key->keyStringValue().c_str()).forgetDataWithoutFreeing();
|
||||
Child = &(gSettings.Devices.ArbProperties->Child);
|
||||
|
||||
if ((value != NULL) && (value->isDict())) {
|
||||
INTN PropCount = 0;
|
||||
const TagDict* valueDict = value->getDict();
|
||||
PropCount = valueDict->dictKeyCount();
|
||||
// DBG("Add %d properties:\n", PropCount);
|
||||
for (INTN j = 0; j < PropCount; j++) {
|
||||
DevProps = *Child;
|
||||
*Child = new DEV_PROPERTY;
|
||||
// *Child = new (__typeof_am__(**Child))();
|
||||
(*Child)->Next = DevProps;
|
||||
|
||||
const TagKey* key2;
|
||||
const TagStruct* value2;
|
||||
if (EFI_ERROR(valueDict->getKeyAndValueAtIndex(j, &key2, &value2))) {
|
||||
continue;
|
||||
}
|
||||
if (key2->keyStringValue()[0] != '#') {
|
||||
(*Child)->MenuItem.BValue = TRUE;
|
||||
(*Child)->Key = S8Printf("%s", key2->keyStringValue().c_str()).forgetDataWithoutFreeing();
|
||||
}
|
||||
else {
|
||||
(*Child)->MenuItem.BValue = FALSE;
|
||||
(*Child)->Key = S8Printf("%s", key2->keyStringValue().c_str() + 1).forgetDataWithoutFreeing();
|
||||
}
|
||||
|
||||
// DBG("<key>%s\n <value> type %d\n", (*Child)->Key, Prop3->type);
|
||||
if (value2 && (value2->isString()) && value2->getString()->stringValue().notEmpty()) {
|
||||
//first suppose it is Ascii string
|
||||
(*Child)->Value = (UINT8*)S8Printf("%s", value2->getString()->stringValue().c_str()).forgetDataWithoutFreeing();
|
||||
(*Child)->ValueLen = value2->getString()->stringValue().sizeInBytesIncludingTerminator();
|
||||
(*Child)->ValueType = kTagTypeString;
|
||||
}
|
||||
else if (value2 && (value2->isInt64())) {
|
||||
if ( value2->getInt64()->intValue() < MIN_INT32 || value2->getInt64()->intValue() > MAX_INT32 ) {
|
||||
MsgLog("Invalid int value for key %s\n", key2->keyStringValue().c_str());
|
||||
}else{
|
||||
INT32 intValue = (INT32)value2->getInt64()->intValue();
|
||||
(*Child)->Value = (__typeof__((*Child)->Value))AllocatePool(sizeof(intValue));
|
||||
*(INT32*)((*Child)->Value) = intValue;
|
||||
(*Child)->ValueLen = sizeof(intValue);
|
||||
(*Child)->ValueType = kTagTypeInteger;
|
||||
}
|
||||
}
|
||||
else if (value2 && value2->isTrue() ) {
|
||||
(*Child)->Value = (__typeof__((*Child)->Value))AllocateZeroPool(4);
|
||||
(*Child)->Value[0] = TRUE;
|
||||
(*Child)->ValueLen = 1;
|
||||
(*Child)->ValueType = kTagTypeTrue;
|
||||
}
|
||||
else if ( value2 && value2->isFalse() ) {
|
||||
(*Child)->Value = (__typeof__((*Child)->Value))AllocateZeroPool(4);
|
||||
//(*Child)->Value[0] = FALSE;
|
||||
(*Child)->ValueLen = 1;
|
||||
(*Child)->ValueType = kTagTypeFalse;
|
||||
}
|
||||
else if (value2 && (value2->isData())) {
|
||||
UINTN Size = value2->getData()->dataLenValue();
|
||||
// (*Child)->Value = GetDataSetting(value2, "Value", &Size); //TODO
|
||||
UINT8* Data = (__typeof__(Data))AllocateZeroPool(Size);
|
||||
CopyMem(Data, value2->getData()->dataValue(), Size);
|
||||
(*Child)->Value = Data;
|
||||
(*Child)->ValueLen = Size;
|
||||
(*Child)->ValueType = kTagTypeData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const TagArray* ArbitraryTagArray = DevicesDict->arrayPropertyForKey("Arbitrary"); // array of dict
|
||||
if (ArbitraryTagArray != NULL) {
|
||||
INTN Index;
|
||||
INTN Count = ArbitraryTagArray->arrayContent().size();
|
||||
DEV_PROPERTY *DevProp;
|
||||
|
||||
if (Count > 0) {
|
||||
DBG("Add %lld devices (Arbitrary):\n", Count);
|
||||
for (Index = 0; Index < Count; Index++) {
|
||||
UINTN DeviceAddr = 0U;
|
||||
XString8 Label;
|
||||
DBG(" - [%02lld]:", Index);
|
||||
const TagDict* Dict2 = ArbitraryTagArray->dictElementAt(Index, "Arbitrary"_XS8);
|
||||
const TagStruct* Prop3;
|
||||
Prop3 = Dict2->propertyForKey("PciAddr");
|
||||
if (Prop3 != NULL) {
|
||||
UINT8 Bus, Dev, Func;
|
||||
|
||||
if ( !Prop3->isString() ) {
|
||||
MsgLog("ATTENTION : property not string in PciAddr\n");
|
||||
continue;
|
||||
}
|
||||
if ( Prop3->getString()->stringValue().length() < 2 || Prop3->getString()->stringValue()[2] != ':') {
|
||||
DBG(" wrong PciAddr string: %s\n", Prop3->getString()->stringValue().c_str());
|
||||
continue;
|
||||
}
|
||||
CONST CHAR8* Str = Prop3->getString()->stringValue().c_str();
|
||||
Bus = hexstrtouint8(Str);
|
||||
Dev = hexstrtouint8(&Str[3]);
|
||||
Func = hexstrtouint8(&Str[6]);
|
||||
DeviceAddr = PCIADDR(Bus, Dev, Func);
|
||||
Label.S8Printf("[%02hhX:%02hhX.%02hhX] ", Bus, Dev, Func);
|
||||
DBG(" %s", Label.c_str());
|
||||
} else {
|
||||
DBG(" no PciAddr\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
Prop3 = Dict2->propertyForKey("Comment");
|
||||
if (Prop3 != NULL) {
|
||||
if ( !Prop3->isString() ) {
|
||||
MsgLog("ATTENTION : property not string in Comment\n");
|
||||
}else{
|
||||
Label += Prop3->getString()->stringValue();
|
||||
DBG(" (%s)", Prop3->getString()->stringValue().c_str());
|
||||
}
|
||||
}
|
||||
DBG("\n");
|
||||
const TagArray* CustomPropertiesArray = Dict2->arrayPropertyForKey("CustomProperties"); // array of dict
|
||||
if (CustomPropertiesArray != NULL) {
|
||||
const TagDict* Dict3;
|
||||
INTN PropIndex;
|
||||
INTN PropCount = CustomPropertiesArray->arrayContent().size();
|
||||
|
||||
for (PropIndex = 0; PropIndex < PropCount; PropIndex++) {
|
||||
Dict3 = CustomPropertiesArray->dictElementAt(PropIndex, "CustomProperties"_XS8);
|
||||
DevProp = gSettings.Devices.ArbProperties;
|
||||
gSettings.Devices.ArbProperties = new DEV_PROPERTY;
|
||||
gSettings.Devices.ArbProperties->Next = DevProp;
|
||||
|
||||
gSettings.Devices.ArbProperties->Device = (UINT32)DeviceAddr;
|
||||
gSettings.Devices.ArbProperties->Label = (__typeof__(gSettings.Devices.ArbProperties->Label))AllocateCopyPool(Label.sizeInBytesIncludingTerminator(), Label.c_str());
|
||||
|
||||
const TagStruct* DisabledProp = Dict3->propertyForKey("Disabled");
|
||||
gSettings.Devices.ArbProperties->MenuItem.BValue = !IsPropertyNotNullAndTrue(DisabledProp);
|
||||
|
||||
DisabledProp = Dict3->propertyForKey("Key");
|
||||
if (DisabledProp && (DisabledProp->isString()) && DisabledProp->getString()->stringValue().notEmpty()) {
|
||||
gSettings.Devices.ArbProperties->Key = S8Printf("%s", DisabledProp->getString()->stringValue().c_str()).forgetDataWithoutFreeing();
|
||||
}
|
||||
|
||||
DisabledProp = Dict3->propertyForKey("Value");
|
||||
if (DisabledProp && (DisabledProp->isString()) && DisabledProp->getString()->stringValue().notEmpty()) {
|
||||
//first suppose it is Ascii string
|
||||
gSettings.Devices.ArbProperties->Value = (UINT8*)S8Printf("%s", DisabledProp->getString()->stringValue().c_str()).forgetDataWithoutFreeing();
|
||||
gSettings.Devices.ArbProperties->ValueLen = DisabledProp->getString()->stringValue().sizeInBytesIncludingTerminator();
|
||||
gSettings.Devices.ArbProperties->ValueType = kTagTypeString;
|
||||
} else if (DisabledProp && (DisabledProp->isInt64())) {
|
||||
if ( DisabledProp->getInt64()->intValue() < MIN_INT32 || DisabledProp->getInt64()->intValue() > MAX_INT32 ) {
|
||||
MsgLog("Invalid int value for key 'Value'\n");
|
||||
}else{
|
||||
INT32 intValue = (INT32)DisabledProp->getInt64()->intValue();
|
||||
gSettings.Devices.ArbProperties->Value = (__typeof__(gSettings.Devices.ArbProperties->Value))AllocatePool(sizeof(intValue));
|
||||
// CopyMem(settingsData.ArbProperties->Value, &Prop3->intValue, 4);
|
||||
*(INT32*)(gSettings.Devices.ArbProperties->Value) = intValue;
|
||||
gSettings.Devices.ArbProperties->ValueLen = sizeof(intValue);
|
||||
gSettings.Devices.ArbProperties->ValueType = kTagTypeInteger;
|
||||
}
|
||||
} else if ( DisabledProp && DisabledProp->isTrue() ) {
|
||||
gSettings.Devices.ArbProperties->Value = (__typeof__(gSettings.Devices.ArbProperties->Value))AllocateZeroPool(4);
|
||||
gSettings.Devices.ArbProperties->Value[0] = TRUE;
|
||||
gSettings.Devices.ArbProperties->ValueLen = 1;
|
||||
gSettings.Devices.ArbProperties->ValueType = kTagTypeTrue;
|
||||
} else if ( DisabledProp && DisabledProp->isFalse() ) {
|
||||
gSettings.Devices.ArbProperties->Value = (__typeof__(gSettings.Devices.ArbProperties->Value))AllocateZeroPool(4);
|
||||
//settingsData.ArbProperties->Value[0] = FALSE;
|
||||
gSettings.Devices.ArbProperties->ValueLen = 1;
|
||||
gSettings.Devices.ArbProperties->ValueType = kTagTypeFalse;
|
||||
} else {
|
||||
//else data
|
||||
UINTN Size = 0;
|
||||
gSettings.Devices.ArbProperties->Value = GetDataSetting (Dict3, "Value", &Size);
|
||||
gSettings.Devices.ArbProperties->ValueLen = Size;
|
||||
gSettings.Devices.ArbProperties->ValueType = kTagTypeData;
|
||||
}
|
||||
|
||||
//Special case. In future there must be more such cases
|
||||
if ((AsciiStrStr(gSettings.Devices.ArbProperties->Key, "-platform-id") != NULL)) {
|
||||
CopyMem((CHAR8*)&gSettings.Graphics.IgPlatform, gSettings.Devices.ArbProperties->Value, 4);
|
||||
}
|
||||
} //for() device properties
|
||||
}
|
||||
} //for() devices
|
||||
}
|
||||
// settingsData.NrAddProperties = 0xFFFE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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.
|
||||
@ -4530,16 +4781,6 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
|
||||
FillCardList(GraphicsDict, gSettings); //#@ Getcardslist
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//done until here
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const TagDict* DevicesDict = CfgDict->dictPropertyForKey("Devices");
|
||||
if (DevicesDict != NULL) {
|
||||
@ -4555,45 +4796,26 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
Prop = DevicesDict->propertyForKey("IntelMaxValue");
|
||||
gSettings.Devices.IntelMaxValue = (UINT16)GetPropertyAsInteger(Prop, gSettings.Devices.IntelMaxValue);
|
||||
|
||||
|
||||
gSettings.Devices.FillDevicePropertiesOld(gSettings, DevicesDict);
|
||||
|
||||
/*
|
||||
* Properties is a single string, or a dict
|
||||
*/
|
||||
Prop = DevicesDict->propertyForKey("Properties");
|
||||
if (Prop != NULL) {
|
||||
if (Prop->isString()) {
|
||||
|
||||
gSettings.Devices.Properties.cDeviceProperties = Prop->getString()->stringValue();
|
||||
if ( gSettings.Devices.Properties.cDeviceProperties.sizeInBytesIncludingTerminator() > MAX_UINT32-1 ) {
|
||||
gSettings.Devices.Properties.propertiesAsString = Prop->getString()->stringValue();
|
||||
size_t binaryPropSize = hex2bin(gSettings.Devices.Properties.propertiesAsString, NULL, 0);
|
||||
if ( binaryPropSize > MAX_UINT32 ) {
|
||||
MsgLog("gSettings.Devices.Properties.cDeviceProperties is too big");
|
||||
gSettings.Devices.Properties.cDeviceProperties.setEmpty();
|
||||
gSettings.Devices.Properties.propertiesAsString.setEmpty();
|
||||
}
|
||||
//-------
|
||||
#ifdef CLOVER_BUILD
|
||||
EFI_PHYSICAL_ADDRESS BufferPtr = EFI_SYSTEM_TABLE_MAX_ADDRESS; //0xFE000000;
|
||||
EFI_STATUS Status = gBS->AllocatePages (
|
||||
AllocateMaxAddress,
|
||||
EfiACPIReclaimMemory,
|
||||
EFI_SIZE_TO_PAGES (gSettings.Devices.Properties.cDeviceProperties.sizeInBytes()) + 1,
|
||||
&BufferPtr
|
||||
);
|
||||
|
||||
if (!EFI_ERROR(Status)) {
|
||||
cProperties = (UINT8*)(UINTN)BufferPtr;
|
||||
//cPropSize = (UINT32)(gSettings.Devices.Properties.cDeviceProperties.length() >> 1);
|
||||
cPropSize = (UINT32)hex2bin(gSettings.Devices.Properties.cDeviceProperties, cProperties, EFI_PAGES_TO_SIZE(EFI_SIZE_TO_PAGES (gSettings.Devices.Properties.cDeviceProperties.sizeInBytesIncludingTerminator()))); // cast should be safe gSettings.Devices.Properties.cDeviceProperties.sizeInBytesIncludingTerminator() <= MAX_UINT32-1
|
||||
DBG("Injected EFIString of length %d\n", cPropSize);
|
||||
}
|
||||
//---------
|
||||
#endif
|
||||
}
|
||||
else if ( Prop->isDict() ) {
|
||||
INTN i;
|
||||
const TagDict* PropertiesDict = Prop->getDict();
|
||||
INTN Count = PropertiesDict->dictKeyCount(); //ok
|
||||
//gSettings.Devices.AddProperties = new DEV_PROPERTY[Count]; // seems bug, only ArbProperties is used in this block
|
||||
DEV_PROPERTY *DevPropDevice;
|
||||
DEV_PROPERTY *DevProps;
|
||||
DEV_PROPERTY **Child;
|
||||
|
||||
if (Count > 0) {
|
||||
DBG("Add %lld devices (kTagTypeDict):\n", Count);
|
||||
@ -4601,33 +4823,49 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
for (i = 0; i < Count; i++) {
|
||||
const TagKey* key;
|
||||
const TagStruct* value;
|
||||
EFI_DEVICE_PATH_PROTOCOL* DevicePath = NULL;
|
||||
// EFI_DEVICE_PATH_PROTOCOL* DevicePath = NULL;
|
||||
if ( !EFI_ERROR(PropertiesDict->getKeyAndValueAtIndex(i, &key, &value)) ) { //take a <key> with DevicePath. If GetKeyValueAtIndex return success, key and value != NULL
|
||||
|
||||
if ( key->keyStringValue().startWithOrEqualTo('#') ) continue; // Commented out, ignored. This is a tempororay litle change of behavior because that's how the new parser will works.
|
||||
if ( key->keyStringValue().equal("!") ) {
|
||||
// '!' means disabled. If Label is only '!', means an empty disabled label...
|
||||
continue;
|
||||
}
|
||||
|
||||
XStringW DevicePathStr = key->keyStringValue();
|
||||
// DBG("Device: %ls\n", DevicePathStr);
|
||||
|
||||
// when key in Devices/Properties is one of the strings "PrimaryGPU" / "SecondaryGPU", use device path of first / second gpu accordingly
|
||||
#ifdef CLOVER_BUILD
|
||||
if ( DevicePathStr.equalIC("PrimaryGPU") ) {
|
||||
DevicePath = DevicePathFromHandle(gGraphics[0].Handle); // first gpu
|
||||
} else if ( DevicePathStr.equalIC("SecondaryGPU") && NGFX > 1) {
|
||||
DevicePath = DevicePathFromHandle(gGraphics[1].Handle); // second gpu
|
||||
} else {
|
||||
DevicePath = ConvertTextToDevicePath(DevicePathStr.wc_str()); //TODO
|
||||
}
|
||||
if (DevicePath == NULL) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
//#ifdef CLOVER_BUILD
|
||||
// if ( DevicePathStr.equalIC("PrimaryGPU") ) {
|
||||
// DevicePath = DevicePathFromHandle(gGraphics[0].Handle); // first gpu
|
||||
// } else if ( DevicePathStr.equalIC("SecondaryGPU") && NGFX > 1) {
|
||||
// DevicePath = DevicePathFromHandle(gGraphics[1].Handle); // second gpu
|
||||
// } else {
|
||||
// DevicePath = ConvertTextToDevicePath(DevicePathStr.wc_str()); //TODO
|
||||
// }
|
||||
// if (DevicePath == NULL) {
|
||||
// continue;
|
||||
// }
|
||||
//#endif
|
||||
//Create Device node
|
||||
DevPropDevice = gSettings.Devices.ArbProperties;
|
||||
gSettings.Devices.ArbProperties = new DEV_PROPERTY;
|
||||
gSettings.Devices.ArbProperties->Next = DevPropDevice; //next device
|
||||
gSettings.Devices.ArbProperties->Child = NULL;
|
||||
gSettings.Devices.ArbProperties->Device = 0; //to differ from arbitrary
|
||||
gSettings.Devices.ArbProperties->DevicePath = DevicePath; //this is pointer
|
||||
gSettings.Devices.ArbProperties->Label = S8Printf("%s", key->keyStringValue().c_str()).forgetDataWithoutFreeing();
|
||||
Child = &(gSettings.Devices.ArbProperties->Child);
|
||||
// DevPropDevice = gSettings.Devices.ArbProperties;
|
||||
SETTINGS_DATA::DevicesClass::PropertiesClass::PropertyClass* devProperty = new SETTINGS_DATA::DevicesClass::PropertiesClass::PropertyClass;
|
||||
// devProperty->DevicePath = DevicePath; //this is pointer TODO ?
|
||||
devProperty->DevicePathAsString.SWPrintf("%s", key->keyStringValue().c_str());
|
||||
if ( key->keyStringValue().startWith('!') ) {
|
||||
// '!' means disabled. If Label is only '!', means an empty disabled label...
|
||||
devProperty->DevicePathAsString = key->keyStringValue().subString(1, MAX_XSIZE);
|
||||
devProperty->Enabled = false;
|
||||
// devProperty->MenuItem.BValue = true;
|
||||
}else{
|
||||
devProperty->DevicePathAsString = key->keyStringValue();
|
||||
devProperty->Enabled = true;
|
||||
// devProperty->MenuItem.BValue = false;
|
||||
}
|
||||
|
||||
// gSettings.Devices.ArbProperties.InsertRef(devProperty, 0, false); // TODO
|
||||
gSettings.Devices.Properties.PropertyArray.AddReference(devProperty, true);
|
||||
|
||||
if ((value != NULL) && (value->isDict())) {
|
||||
INTN PropCount = 0;
|
||||
@ -4635,64 +4873,57 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
PropCount = valueDict->dictKeyCount();
|
||||
// DBG("Add %d properties:\n", PropCount);
|
||||
for (INTN j = 0; j < PropCount; j++) {
|
||||
DevProps = *Child;
|
||||
*Child = new DEV_PROPERTY;
|
||||
// *Child = new (__typeof_am__(**Child))();
|
||||
(*Child)->Next = DevProps;
|
||||
|
||||
const TagKey* key2;
|
||||
const TagStruct* value2;
|
||||
if (EFI_ERROR(valueDict->getKeyAndValueAtIndex(j, &key2, &value2))) {
|
||||
continue;
|
||||
}
|
||||
if (key2->keyStringValue()[0] != '#') {
|
||||
(*Child)->MenuItem.BValue = TRUE;
|
||||
(*Child)->Key = S8Printf("%s", key2->keyStringValue().c_str()).forgetDataWithoutFreeing();
|
||||
if ( key2->keyStringValue().startWithOrEqualTo('#') ) continue;
|
||||
if ( key2->keyStringValue().equal("!") ) continue;
|
||||
|
||||
SETTINGS_DATA::DevicesClass::SimplePropertyClass* ChildPtr = new SETTINGS_DATA::DevicesClass::SimplePropertyClass;
|
||||
SETTINGS_DATA::DevicesClass::SimplePropertyClass& Child = *ChildPtr;
|
||||
|
||||
if ( key2->keyStringValue().startWith('!') ) { // startWaith return false if XString == '#'
|
||||
Child.MenuItem.BValue = FALSE;
|
||||
Child.Key = key2->keyStringValue().subString(1, MAX_XSIZE);
|
||||
}
|
||||
else {
|
||||
(*Child)->MenuItem.BValue = FALSE;
|
||||
(*Child)->Key = S8Printf("%s", key2->keyStringValue().c_str() - 1).forgetDataWithoutFreeing();
|
||||
Child.MenuItem.BValue = devProperty->Enabled;
|
||||
Child.Key = key2->keyStringValue();
|
||||
}
|
||||
|
||||
// DBG("<key>%s\n <value> type %d\n", (*Child)->Key, Prop3->type);
|
||||
|
||||
// DBG("<key>%s\n <value> type %d\n", Child.Key, Prop3->type);
|
||||
if (value2 && (value2->isString()) && value2->getString()->stringValue().notEmpty()) {
|
||||
//first suppose it is Ascii string
|
||||
(*Child)->Value = (UINT8*)S8Printf("%s", value2->getString()->stringValue().c_str()).forgetDataWithoutFreeing();
|
||||
(*Child)->ValueLen = value2->getString()->stringValue().sizeInBytesIncludingTerminator();
|
||||
(*Child)->ValueType = kTagTypeString;
|
||||
Child.Value.ncpy(value2->getString()->stringValue().c_str(), value2->getString()->stringValue().sizeInBytesIncludingTerminator());
|
||||
Child.ValueType = kTagTypeString;
|
||||
}
|
||||
else if (value2 && (value2->isInt64())) {
|
||||
if ( value2->getInt64()->intValue() < MIN_INT32 || value2->getInt64()->intValue() > MAX_INT32 ) {
|
||||
MsgLog("Invalid int value for key %s\n", key2->keyStringValue().c_str());
|
||||
}else{
|
||||
INT32 intValue = (INT32)value2->getInt64()->intValue();
|
||||
(*Child)->Value = (__typeof__((*Child)->Value))AllocatePool(sizeof(intValue));
|
||||
*(INT32*)((*Child)->Value) = intValue;
|
||||
(*Child)->ValueLen = sizeof(intValue);
|
||||
(*Child)->ValueType = kTagTypeInteger;
|
||||
Child.Value.cpy(intValue);
|
||||
Child.ValueType = kTagTypeInteger;
|
||||
}
|
||||
}
|
||||
else if (value2 && value2->isTrue() ) {
|
||||
(*Child)->Value = (__typeof__((*Child)->Value))AllocateZeroPool(4);
|
||||
(*Child)->Value[0] = TRUE;
|
||||
(*Child)->ValueLen = 1;
|
||||
(*Child)->ValueType = kTagTypeTrue;
|
||||
uint8_t b = 1;
|
||||
Child.Value.cpy(b);
|
||||
Child.ValueType = kTagTypeTrue;
|
||||
}
|
||||
else if ( value2 && value2->isFalse() ) {
|
||||
(*Child)->Value = (__typeof__((*Child)->Value))AllocateZeroPool(4);
|
||||
//(*Child)->Value[0] = FALSE;
|
||||
(*Child)->ValueLen = 1;
|
||||
(*Child)->ValueType = kTagTypeFalse;
|
||||
uint8_t b = 0;
|
||||
Child.Value.cpy(b);
|
||||
Child.ValueType = kTagTypeFalse;
|
||||
}
|
||||
else if (value2 && (value2->isData())) {
|
||||
UINTN Size = value2->getData()->dataLenValue();
|
||||
// (*Child)->Value = GetDataSetting(value2, "Value", &Size); //TODO
|
||||
UINT8* Data = (__typeof__(Data))AllocateZeroPool(Size);
|
||||
CopyMem(Data, value2->getData()->dataValue(), Size);
|
||||
(*Child)->Value = Data;
|
||||
(*Child)->ValueLen = Size;
|
||||
(*Child)->ValueType = kTagTypeData;
|
||||
Child.Value = value2->getData()->data();
|
||||
Child.ValueType = kTagTypeData;
|
||||
}
|
||||
devProperty->propertiesArray.AddReference(ChildPtr, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4714,7 +4945,6 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
if (ArbitraryArray != NULL) {
|
||||
INTN Index;
|
||||
INTN Count = ArbitraryArray->arrayContent().size();
|
||||
DEV_PROPERTY *DevProp;
|
||||
|
||||
if (Count > 0) {
|
||||
DBG("Add %lld devices (Arbitrary):\n", Count);
|
||||
@ -4763,63 +4993,58 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
const TagDict* Dict3;
|
||||
INTN PropIndex;
|
||||
INTN PropCount = CustomPropertiesArray->arrayContent().size();
|
||||
SETTINGS_DATA::DevicesClass::ArbitraryPropertyClass* arbProp = NULL;
|
||||
|
||||
for (PropIndex = 0; PropIndex < PropCount; PropIndex++) {
|
||||
Dict3 = CustomPropertiesArray->dictElementAt(PropIndex, "CustomProperties"_XS8);
|
||||
DevProp = gSettings.Devices.ArbProperties;
|
||||
gSettings.Devices.ArbProperties = new DEV_PROPERTY;
|
||||
gSettings.Devices.ArbProperties->Next = DevProp;
|
||||
|
||||
gSettings.Devices.ArbProperties->Device = (UINT32)DeviceAddr;
|
||||
gSettings.Devices.ArbProperties->Label = (__typeof__(gSettings.Devices.ArbProperties->Label))AllocateCopyPool(Label.sizeInBytesIncludingTerminator(), Label.c_str());
|
||||
SETTINGS_DATA::DevicesClass::SimplePropertyClass* newDevProp = new SETTINGS_DATA::DevicesClass::SimplePropertyClass;
|
||||
|
||||
const TagStruct* DisabledProp = Dict3->propertyForKey("Disabled");
|
||||
gSettings.Devices.ArbProperties->MenuItem.BValue = !IsPropertyNotNullAndTrue(DisabledProp);
|
||||
newDevProp->MenuItem.BValue = !IsPropertyNotNullAndTrue(DisabledProp);
|
||||
|
||||
DisabledProp = Dict3->propertyForKey("Key");
|
||||
if (DisabledProp && (DisabledProp->isString()) && DisabledProp->getString()->stringValue().notEmpty()) {
|
||||
gSettings.Devices.ArbProperties->Key = S8Printf("%s", DisabledProp->getString()->stringValue().c_str()).forgetDataWithoutFreeing();
|
||||
newDevProp->Key = DisabledProp->getString()->stringValue();
|
||||
}
|
||||
|
||||
DisabledProp = Dict3->propertyForKey("Value");
|
||||
if (DisabledProp && (DisabledProp->isString()) && DisabledProp->getString()->stringValue().notEmpty()) {
|
||||
//first suppose it is Ascii string
|
||||
gSettings.Devices.ArbProperties->Value = (UINT8*)S8Printf("%s", DisabledProp->getString()->stringValue().c_str()).forgetDataWithoutFreeing();
|
||||
gSettings.Devices.ArbProperties->ValueLen = DisabledProp->getString()->stringValue().sizeInBytesIncludingTerminator();
|
||||
gSettings.Devices.ArbProperties->ValueType = kTagTypeString;
|
||||
newDevProp->Value.ncpy(DisabledProp->getString()->stringValue().c_str(), DisabledProp->getString()->stringValue().sizeInBytesIncludingTerminator());
|
||||
newDevProp->ValueType = kTagTypeString;
|
||||
} else if (DisabledProp && (DisabledProp->isInt64())) {
|
||||
if ( DisabledProp->getInt64()->intValue() < MIN_INT32 || DisabledProp->getInt64()->intValue() > MAX_INT32 ) {
|
||||
MsgLog("Invalid int value for key 'Value'\n");
|
||||
}else{
|
||||
INT32 intValue = (INT32)DisabledProp->getInt64()->intValue();
|
||||
gSettings.Devices.ArbProperties->Value = (__typeof__(gSettings.Devices.ArbProperties->Value))AllocatePool(sizeof(intValue));
|
||||
// CopyMem(settingsData.ArbProperties->Value, &Prop3->intValue, 4);
|
||||
*(INT32*)(gSettings.Devices.ArbProperties->Value) = intValue;
|
||||
gSettings.Devices.ArbProperties->ValueLen = sizeof(intValue);
|
||||
gSettings.Devices.ArbProperties->ValueType = kTagTypeInteger;
|
||||
newDevProp->Value.cpy(intValue);
|
||||
newDevProp->ValueType = kTagTypeInteger;
|
||||
}
|
||||
} else if ( DisabledProp && DisabledProp->isTrue() ) {
|
||||
gSettings.Devices.ArbProperties->Value = (__typeof__(gSettings.Devices.ArbProperties->Value))AllocateZeroPool(4);
|
||||
gSettings.Devices.ArbProperties->Value[0] = TRUE;
|
||||
gSettings.Devices.ArbProperties->ValueLen = 1;
|
||||
gSettings.Devices.ArbProperties->ValueType = kTagTypeTrue;
|
||||
newDevProp->Value.cpy((uint32_t)1);
|
||||
newDevProp->ValueType = kTagTypeTrue;
|
||||
} else if ( DisabledProp && DisabledProp->isFalse() ) {
|
||||
gSettings.Devices.ArbProperties->Value = (__typeof__(gSettings.Devices.ArbProperties->Value))AllocateZeroPool(4);
|
||||
//settingsData.ArbProperties->Value[0] = FALSE;
|
||||
gSettings.Devices.ArbProperties->ValueLen = 1;
|
||||
gSettings.Devices.ArbProperties->ValueType = kTagTypeFalse;
|
||||
newDevProp->Value.cpy((uint32_t)0);
|
||||
newDevProp->ValueType = kTagTypeFalse;
|
||||
} else {
|
||||
//else data
|
||||
UINTN Size = 0;
|
||||
gSettings.Devices.ArbProperties->Value = GetDataSetting (Dict3, "Value", &Size);
|
||||
gSettings.Devices.ArbProperties->ValueLen = Size;
|
||||
gSettings.Devices.ArbProperties->ValueType = kTagTypeData;
|
||||
uint8_t* Data = GetDataSetting (Dict3, "Value", &Size);
|
||||
newDevProp->Value.stealValueFrom(Data, Size);
|
||||
newDevProp->ValueType = kTagTypeData;
|
||||
}
|
||||
|
||||
//Special case. In future there must be more such cases
|
||||
if ((AsciiStrStr(gSettings.Devices.ArbProperties->Key, "-platform-id") != NULL)) {
|
||||
CopyMem((CHAR8*)&gSettings.Graphics.IgPlatform, gSettings.Devices.ArbProperties->Value, 4);
|
||||
if ( newDevProp->Key.contains("-platform-id") ) {
|
||||
CopyMem((CHAR8*)&gSettings.Graphics.IgPlatform, newDevProp->Value.data(), 4);
|
||||
}
|
||||
if ( arbProp == NULL ) {
|
||||
arbProp = new SETTINGS_DATA::DevicesClass::ArbitraryPropertyClass();
|
||||
arbProp->Device = (UINT32)DeviceAddr;
|
||||
arbProp->Label = Label;
|
||||
gSettings.Devices.ArbitraryArray.AddReference(arbProp, true);
|
||||
}
|
||||
arbProp->CustomPropertyArray.AddReference(newDevProp, true);
|
||||
} //for() device properties
|
||||
}
|
||||
} //for() devices
|
||||
@ -4835,14 +5060,14 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
//count = 0x1F1E1D1C1B1A1918
|
||||
if (Count > 0) {
|
||||
DBG("Add %lld properties:\n", Count);
|
||||
gSettings.Devices.AddProperties.setEmpty();
|
||||
gSettings.Devices.AddPropertyArray.setEmpty();
|
||||
|
||||
for (i = 0; i < Count; i++) {
|
||||
UINTN Size = 0;
|
||||
DBG(" - [%02lld]:", i);
|
||||
const TagDict* Dict2 = AddPropertiesArray->dictElementAt(i, "AddProperties"_XS8);
|
||||
const TagStruct* DeviceProp = Dict2->propertyForKey("Device");
|
||||
DEV_ADDPROPERTY *Property = new DEV_ADDPROPERTY();
|
||||
SETTINGS_DATA::DevicesClass::AddPropertyClass* Property = new SETTINGS_DATA::DevicesClass::AddPropertyClass();
|
||||
|
||||
if (DeviceProp && (DeviceProp->isString()) && DeviceProp->getString()->stringValue().notEmpty()) {
|
||||
if (DeviceProp->getString()->stringValue().equalIC("ATI")) {
|
||||
@ -4897,6 +5122,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
}else{
|
||||
INT32 intValue = (INT32)Prop2->getInt64()->intValue();
|
||||
Property->Value.cat(intValue);
|
||||
Property->ValueType = kTagTypeInteger;
|
||||
// Property->Value = (__typeof__(Property->Value))AllocatePool (sizeof(intValue));
|
||||
// // CopyMem(settingsData.AddProperties[Index].Value, &Prop2->intValue, 4);
|
||||
// *(INT32*)(Property->Value) = intValue;
|
||||
@ -4906,6 +5132,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
//else data
|
||||
uint8_t* Data = GetDataSetting (Dict2, "Value", &Size);
|
||||
Property->Value.stealValueFrom(Data, Size);
|
||||
Property->ValueType = kTagTypeData;
|
||||
}
|
||||
|
||||
DBG("Key: %s, len: %zu\n", Property->Key.c_str(), Property->Value.size());
|
||||
@ -4914,11 +5141,11 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
DBG(" property disabled at config\n");
|
||||
}
|
||||
|
||||
gSettings.Devices.AddProperties.AddReference(Property, true);
|
||||
gSettings.Devices.AddPropertyArray.AddReference(Property, true);
|
||||
++Index;
|
||||
}
|
||||
|
||||
// gSettings.Devices.AddProperties.size() = Index;
|
||||
// gSettings.Devices.AddPropertyArray.size() = Index;
|
||||
}
|
||||
}
|
||||
//end AddProperties
|
||||
@ -5056,10 +5283,22 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
|
||||
getACPISettings(CfgDict, gSettings);
|
||||
|
||||
|
||||
|
||||
|
||||
//done until here
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//*** SMBIOS ***//
|
||||
const TagDict* SMBIOSDict = CfgDict->dictPropertyForKey("SMBIOS");
|
||||
if (SMBIOSDict != NULL) {
|
||||
|
||||
ParseSMBIOSSettings(SMBIOSDict);
|
||||
|
||||
const TagStruct* Prop = SMBIOSDict->propertyForKey("Trust");
|
||||
if (Prop != NULL) {
|
||||
if (IsPropertyNotNullAndFalse(Prop)) {
|
||||
@ -6621,50 +6860,51 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
UINT16 PmCon;
|
||||
UINT32 Rcba;
|
||||
UINT32 Hptc;
|
||||
DEV_PROPERTY *Prop = NULL;
|
||||
DEV_PROPERTY *Prop2 = NULL;
|
||||
DevPropDevice *device = NULL;
|
||||
|
||||
GetEdidDiscovered ();
|
||||
|
||||
//First make string from Device->Properties
|
||||
Prop = gSettings.Devices.ArbProperties;
|
||||
device = NULL;
|
||||
if (!device_inject_string) {
|
||||
device_inject_string = devprop_create_string();
|
||||
}
|
||||
while (Prop) {
|
||||
if (Prop->Device != 0) {
|
||||
Prop = Prop->Next; //skip CustomProperties
|
||||
for ( size_t idx = 0 ; idx < gSettings.Devices.Properties.PropertyArray.size() ; ++idx ) {
|
||||
const SETTINGS_DATA::DevicesClass::PropertiesClass::PropertyClass& Prop = gSettings.Devices.Properties.PropertyArray[idx];
|
||||
// if (Prop->Device != 0) {
|
||||
// Prop = Prop->Next; //skip CustomProperties
|
||||
// continue;
|
||||
// }
|
||||
EFI_DEVICE_PATH_PROTOCOL* DevicePath = Prop.getDevicePath();
|
||||
if ( DevicePath == NULL ) {
|
||||
MsgLog("Properties with Label=%ls ignored because getDevicePath() return NULL\n", Prop.DevicePathAsString.wc_str());
|
||||
continue;
|
||||
}
|
||||
device = devprop_add_device_pci(device_inject_string, NULL, Prop->DevicePath);
|
||||
DBG("add device: %ls\n", DevicePathToXStringW(Prop->DevicePath).wc_str());
|
||||
Prop2 = Prop->Child;
|
||||
while (Prop2) {
|
||||
if (Prop2->MenuItem.BValue) {
|
||||
if (AsciiStrStr(Prop2->Key, "-platform-id") != NULL) {
|
||||
if (gSettings.Graphics.IgPlatform == 0 && Prop2->Value) {
|
||||
CopyMem((UINT8*)&gSettings.Graphics.IgPlatform, (UINT8*)Prop2->Value, Prop2->ValueLen);
|
||||
device = devprop_add_device_pci(device_inject_string, NULL, DevicePath);
|
||||
DBG("add device: %ls\n", Prop.DevicePathAsString.wc_str());
|
||||
for ( size_t jdx = 0 ; jdx < Prop.propertiesArray.size() ; ++jdx ) {
|
||||
const SETTINGS_DATA::DevicesClass::SimplePropertyClass& Prop2 = Prop.propertiesArray[jdx];
|
||||
if (Prop2.MenuItem.BValue) {
|
||||
if ( Prop2.Key.contains("-platform-id") ) {
|
||||
if ( gSettings.Graphics.IgPlatform == 0 && Prop2.Value.size() == sizeof(gSettings.Graphics.IgPlatform) ) {
|
||||
CopyMem((UINT8*)&gSettings.Graphics.IgPlatform, Prop2.Value.data(), sizeof(gSettings.Graphics.IgPlatform));
|
||||
}
|
||||
devprop_add_value(device, Prop2->Key, (UINT8*)&gSettings.Graphics.IgPlatform, 4);
|
||||
DBG(" Add key=%s valuelen=%llu\n", Prop2->Key, Prop2->ValueLen);
|
||||
} else if ((AsciiStrStr(Prop2->Key, "override-no-edid") || AsciiStrStr(Prop2->Key, "override-no-connect"))
|
||||
devprop_add_value(device, Prop2.Key.c_str(), (UINT8*)&gSettings.Graphics.IgPlatform, 4);
|
||||
DBG(" Add key=%s valuelen=%zu\n", Prop2.Key.c_str(), Prop2.Value.size());
|
||||
} else if ( (Prop2.Key.contains("override-no-edid") || Prop2.Key.contains("override-no-connect"))
|
||||
&& gSettings.Graphics.EDID.InjectEDID && gSettings.Graphics.EDID.CustomEDID.notEmpty()) {
|
||||
// special case for EDID properties
|
||||
devprop_add_value(device, Prop2->Key, gSettings.Graphics.EDID.CustomEDID.data(), 128);
|
||||
DBG(" Add key=%s from custom EDID\n", Prop2->Key);
|
||||
devprop_add_value(device, Prop2.Key.c_str(), gSettings.Graphics.EDID.CustomEDID.data(), 128);
|
||||
DBG(" Add key=%s from custom EDID\n", Prop2.Key.c_str());
|
||||
} else {
|
||||
devprop_add_value(device, Prop2->Key, (UINT8*)Prop2->Value, Prop2->ValueLen);
|
||||
DBG(" Add key=%s valuelen=%llu\n", Prop2->Key, Prop2->ValueLen);
|
||||
devprop_add_value(device, Prop2.Key, Prop2.Value);
|
||||
DBG(" Add key=%s valuelen=%zu\n", Prop2.Key.c_str(), Prop2.Value.size());
|
||||
}
|
||||
}else{
|
||||
DBG("Skip disabled properties with Path=%ls, Key=%s\n", Prop.DevicePathAsString.wc_str(), Prop2.Key.c_str());
|
||||
}
|
||||
|
||||
StringDirty = TRUE;
|
||||
Prop2 = Prop2->Next;
|
||||
|
||||
}
|
||||
Prop = Prop->Next;
|
||||
}
|
||||
|
||||
devices_number = 1; //should initialize for reentering GUI
|
||||
@ -6699,33 +6939,33 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
PCIdevice.subsys_id.subsys.device_id = Pci.Device.SubsystemID;
|
||||
PCIdevice.used = FALSE;
|
||||
|
||||
//if (gSettings.Devices.AddProperties.size() == 0xFFFE) { //yyyy it means Arbitrary // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
//if (gSettings.Devices.AddPropertyArray.size() == 0xFFFE) { //yyyy it means Arbitrary // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
//------------------
|
||||
Prop = gSettings.Devices.ArbProperties; //check for additional properties
|
||||
device = NULL;
|
||||
/* if (!string) {
|
||||
string = devprop_create_string();
|
||||
} */
|
||||
while (Prop) {
|
||||
if (Prop->Device != PCIdevice.dev.addr) {
|
||||
Prop = Prop->Next;
|
||||
for ( size_t idx = 0 ; idx < gSettings.Devices.ArbitraryArray.size() ; ++idx ) {
|
||||
const SETTINGS_DATA::DevicesClass::ArbitraryPropertyClass& Prop = gSettings.Devices.ArbitraryArray[idx];
|
||||
if (Prop.Device != PCIdevice.dev.addr) {
|
||||
continue;
|
||||
}
|
||||
if (!PCIdevice.used) {
|
||||
device = devprop_add_device_pci(device_inject_string, &PCIdevice, NULL);
|
||||
PCIdevice.used = TRUE;
|
||||
}
|
||||
for ( size_t jdx = 0 ; jdx < Prop.CustomPropertyArray.size() ; ++jdx ) {
|
||||
const SETTINGS_DATA::DevicesClass::SimplePropertyClass& Prop2 = Prop.CustomPropertyArray[jdx];
|
||||
//special corrections
|
||||
if (Prop->MenuItem.BValue) {
|
||||
if (AsciiStrStr(Prop->Key, "-platform-id") != NULL) {
|
||||
devprop_add_value(device, Prop->Key, (UINT8*)&gSettings.Graphics.IgPlatform, 4);
|
||||
} else {
|
||||
devprop_add_value(device, Prop->Key, (UINT8*)Prop->Value, Prop->ValueLen);
|
||||
if (Prop2.MenuItem.BValue) {
|
||||
if ( Prop2.Key.contains("-platform-id") ) {
|
||||
devprop_add_value(device, Prop2.Key.c_str(), (UINT8*)&gSettings.Graphics.IgPlatform, sizeof(gSettings.Graphics.IgPlatform));
|
||||
} else {
|
||||
devprop_add_value(device, Prop2.Key, Prop2.Value);
|
||||
}
|
||||
}
|
||||
StringDirty = TRUE;
|
||||
}
|
||||
|
||||
StringDirty = TRUE;
|
||||
Prop = Prop->Next;
|
||||
}
|
||||
//------------------
|
||||
if (PCIdevice.used) {
|
||||
@ -7445,14 +7685,17 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
|
||||
if (StringDirty) {
|
||||
EFI_PHYSICAL_ADDRESS BufferPtr = EFI_SYSTEM_TABLE_MAX_ADDRESS; //0xFE000000;
|
||||
if ( device_inject_string->length > MAX_UINT32/2-1 ) {
|
||||
MsgLog("device_inject_string is too big\n");
|
||||
}else{
|
||||
device_inject_stringlength = device_inject_string->length * 2;
|
||||
DBG("stringlength = %d\n", device_inject_stringlength);
|
||||
// gDeviceProperties = (__typeof__(gDeviceProperties))AllocateAlignedPages EFI_SIZE_TO_PAGES (device_inject_stringlength + 1), 64);
|
||||
|
||||
XString8 newDeviceProperties = devprop_generate_string(device_inject_string);
|
||||
|
||||
UINTN nbPages = EFI_SIZE_TO_PAGES (device_inject_stringlength + 1);
|
||||
size_t binaryPropSize = hex2bin(newDeviceProperties, NULL, 0);
|
||||
if ( binaryPropSize > MAX_UINT32 ) {
|
||||
MsgLog("devprop_generate_string(device_inject_string) is too big");
|
||||
newDeviceProperties.setEmpty();
|
||||
}else{
|
||||
DBG("stringlength = %zu\n", newDeviceProperties.length());
|
||||
|
||||
UINTN nbPages = EFI_SIZE_TO_PAGES(binaryPropSize);
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateMaxAddress,
|
||||
EfiACPIReclaimMemory,
|
||||
@ -7461,64 +7704,18 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
);
|
||||
|
||||
if (!EFI_ERROR(Status)) {
|
||||
// mProperties = (UINT8*)(UINTN)BufferPtr;
|
||||
// gDeviceProperties = devprop_generate_string (device_inject_string);
|
||||
// gDeviceProperties[device_inject_stringlength] = 0;
|
||||
// // DBG(gDeviceProperties);
|
||||
// // DBG("\n");
|
||||
// // StringDirty = FALSE;
|
||||
// //-------
|
||||
// //mPropSize = (UINT32)AsciiStrLen(gDeviceProperties) / 2;
|
||||
// // DBG("Preliminary size of mProperties=%d\n", mPropSize);
|
||||
// mPropSize = (UINT32)hex2bin (gDeviceProperties, AsciiStrLen(gDeviceProperties), mProperties, EFI_PAGES_TO_SIZE(nbPages)); // cast should be safe as device_inject_string->length <= MAX_UINT32/2-1
|
||||
// // DBG("Final size of mProperties=%d\n", mPropSize);
|
||||
// //---------
|
||||
// // Status = egSaveFile(&self.getSelfRootDir(), SWPrintf("%ls\\misc\\devprop.bin", self.getCloverDirFullPath().wc_str()).wc_str() , (UINT8*)mProperties, mPropSize);
|
||||
// //and now we can free memory?
|
||||
// if (gSettings.Devices.AddProperties) {
|
||||
// FreePool(gSettings.Devices.AddProperties);
|
||||
// }
|
||||
if (gSettings.Devices.ArbProperties) {
|
||||
DEV_PROPERTY *Props;
|
||||
DEV_PROPERTY *Next;
|
||||
Prop = gSettings.Devices.ArbProperties;
|
||||
while (Prop) {
|
||||
Props = Prop->Child;
|
||||
if (Prop->Label) {
|
||||
FreePool(Prop->Label);
|
||||
}
|
||||
if (Prop->Key) {
|
||||
FreePool(Prop->Key);
|
||||
}
|
||||
if (Prop->Value) {
|
||||
FreePool(Prop->Value);
|
||||
}
|
||||
if (Prop->DevicePath) {
|
||||
FreePool(Prop->DevicePath);
|
||||
}
|
||||
while (Props) {
|
||||
if (Props->Label) {
|
||||
FreePool(Props->Label);
|
||||
}
|
||||
if (Props->Key) {
|
||||
FreePool(Props->Key);
|
||||
}
|
||||
if (Props->Value) {
|
||||
FreePool(Props->Value);
|
||||
}
|
||||
if (Props->DevicePath) {
|
||||
FreePool(Props->DevicePath);
|
||||
}
|
||||
Next = Props->Next;
|
||||
FreePool(Props);
|
||||
//delete Props;
|
||||
Props = Next;
|
||||
}
|
||||
Next = Prop->Next;
|
||||
FreePool(Prop);
|
||||
Prop = Next;
|
||||
}
|
||||
}
|
||||
mProperties = (UINT8*)(UINTN)BufferPtr;
|
||||
// DBG(gDeviceProperties);
|
||||
// DBG("\n");
|
||||
// StringDirty = FALSE;
|
||||
//-------
|
||||
mPropSize = (UINT32)hex2bin(newDeviceProperties, mProperties, EFI_PAGES_TO_SIZE(nbPages)); // cast should be safe as hex2bin return <= MAXUINT32
|
||||
gDeviceProperties = newDeviceProperties.forgetDataWithoutFreeing(); // do this AFTER hex2bin
|
||||
// DBG("Final size of mProperties=%d\n", mPropSize);
|
||||
//---------
|
||||
// Status = egSaveFile(&self.getSelfRootDir(), SWPrintf("%ls\\misc\\devprop.bin", self.getCloverDirFullPath().wc_str()).wc_str() , (UINT8*)mProperties, mPropSize);
|
||||
}else{
|
||||
MsgLog("AllocatePages failed (%s), device_inject_string not injected\n", efiStrError(Status));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,13 @@
|
||||
|
||||
extern CONST CHAR8 *AudioOutputNames[];
|
||||
|
||||
UINT8
|
||||
*GetDataSetting (
|
||||
IN const TagDict* Dict,
|
||||
IN CONST CHAR8 *PropName,
|
||||
OUT UINTN *DataLen
|
||||
);
|
||||
|
||||
class HDA_OUTPUTS
|
||||
{
|
||||
public:
|
||||
@ -76,6 +83,9 @@ typedef struct {
|
||||
BOOLEAN ConnChanged;
|
||||
} GFX_PROPERTIES;
|
||||
|
||||
extern GFX_PROPERTIES gGraphics[4]; //no more then 4 graphics cards
|
||||
extern UINTN NGFX; // number of GFX
|
||||
|
||||
typedef struct {
|
||||
HRDW_MANUFACTERER Vendor;
|
||||
UINT16 controller_vendor_id;
|
||||
@ -369,34 +379,33 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* From config.plist,
|
||||
* /Devices/Properties will construct a XObjArray<DEV_PROPERTY>, stored in ArbProperties
|
||||
* /Devices/Arbitrary/CustomProperties will construct a XObjArray<DEV_PROPERTY>, stored in ArbProperties
|
||||
*/
|
||||
// 2021-04 Jief : this is the old structure. Kept here for be able to compare old and new code.
|
||||
class DEV_PROPERTY
|
||||
{
|
||||
public:
|
||||
UINT32 Device = 0;
|
||||
EFI_DEVICE_PATH_PROTOCOL* DevicePath = NULL;
|
||||
CHAR8* Key = 0;
|
||||
UINT8* Value = 0;
|
||||
UINTN ValueLen = 0;
|
||||
DEV_PROPERTY* Next = 0; //next device or next property
|
||||
DEV_PROPERTY* Child = 0; // property list of the device
|
||||
CHAR8* Label = 0;
|
||||
INPUT_ITEM MenuItem = INPUT_ITEM();
|
||||
TAG_TYPE ValueType = kTagTypeNone;
|
||||
UINT32 Device = 0;
|
||||
EFI_DEVICE_PATH_PROTOCOL* DevicePath = NULL;
|
||||
CHAR8 *Key = 0;
|
||||
UINT8 *Value = 0;
|
||||
UINTN ValueLen = 0;
|
||||
DEV_PROPERTY *Next = 0; //next device or next property
|
||||
DEV_PROPERTY *Child = 0; // property list of the device
|
||||
CHAR8 *Label = 0;
|
||||
INPUT_ITEM MenuItem = INPUT_ITEM();
|
||||
TAG_TYPE ValueType = kTagTypeNone;
|
||||
|
||||
DEV_PROPERTY() { }
|
||||
|
||||
DEV_PROPERTY() {};
|
||||
// Not sure if default are valid. Delete them. If needed, proper ones can be created
|
||||
DEV_PROPERTY(const DEV_PROPERTY&) { panic("nope"); };
|
||||
DEV_PROPERTY& operator=(const DEV_PROPERTY&) { panic("nope"); };
|
||||
DEV_PROPERTY(const DEV_PROPERTY&) { panic("nope"); }
|
||||
DEV_PROPERTY& operator=(const DEV_PROPERTY&) = delete;
|
||||
};
|
||||
|
||||
class DEV_ADDPROPERTY
|
||||
{
|
||||
public:
|
||||
UINT32 Device = 0;
|
||||
XString8 Key = XString8();
|
||||
XBuffer<uint8_t> Value = XBuffer<uint8_t>();
|
||||
INPUT_ITEM MenuItem = INPUT_ITEM();
|
||||
};
|
||||
|
||||
/**
|
||||
Set of Search & replace bytes for VideoBiosPatchBytes().
|
||||
@ -715,9 +724,65 @@ public:
|
||||
bool NameEH00 = bool();
|
||||
bool NameXH00 = bool();
|
||||
};
|
||||
|
||||
class AddPropertyClass
|
||||
{
|
||||
public:
|
||||
uint32_t Device = 0;
|
||||
XString8 Key = XString8();
|
||||
XBuffer<uint8_t> Value = XBuffer<uint8_t>();
|
||||
TAG_TYPE ValueType = kTagTypeNone;
|
||||
INPUT_ITEM MenuItem = INPUT_ITEM();
|
||||
XString8 DevicePathAsString = XString8();
|
||||
XString8 Label = XString8();
|
||||
};
|
||||
|
||||
// This is shared by PropertiesClass and ArbitraryClass
|
||||
class SimplePropertyClass
|
||||
{
|
||||
public:
|
||||
XString8 Key = XString8();
|
||||
XBuffer<uint8_t> Value = XBuffer<uint8_t>();
|
||||
TAG_TYPE ValueType = kTagTypeNone; // only used in CreateMenuProps()
|
||||
INPUT_ITEM MenuItem = INPUT_ITEM(); // Will get the Disabled value
|
||||
};
|
||||
|
||||
// Property don't have Device. Before it was always Device = 0 to differentiate from Arbitrary properties.
|
||||
class PropertiesClass {
|
||||
public:
|
||||
XString8 cDeviceProperties = XString8();
|
||||
|
||||
class PropertyClass
|
||||
{
|
||||
public:
|
||||
|
||||
bool Enabled = true;
|
||||
XStringW DevicePathAsString = XStringW();
|
||||
// XString8 Label = XString8(); // Label is the same as DevicePathAsString, so it's not needed.
|
||||
XObjArray<SimplePropertyClass> propertiesArray = XObjArray<SimplePropertyClass>();
|
||||
|
||||
EFI_DEVICE_PATH_PROTOCOL* getDevicePath() const
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL* DevicePath;
|
||||
if ( DevicePathAsString.equalIC("PrimaryGPU") ) {
|
||||
DevicePath = DevicePathFromHandle(gGraphics[0].Handle); // first gpu
|
||||
} else if ( DevicePathAsString.equalIC("SecondaryGPU") && NGFX > 1) {
|
||||
DevicePath = DevicePathFromHandle(gGraphics[1].Handle); // second gpu
|
||||
} else {
|
||||
DevicePath = ConvertTextToDevicePath(DevicePathAsString.wc_str()); //TODO
|
||||
}
|
||||
return DevicePath;
|
||||
}
|
||||
};
|
||||
|
||||
XString8 propertiesAsString = XString8();
|
||||
XObjArray<PropertyClass> PropertyArray = XObjArray<PropertyClass>();
|
||||
};
|
||||
|
||||
class ArbitraryPropertyClass {
|
||||
public:
|
||||
uint32_t Device = 0;
|
||||
XString8 Label = XString8();
|
||||
XObjArray<SimplePropertyClass> CustomPropertyArray = XObjArray<SimplePropertyClass> ();
|
||||
};
|
||||
|
||||
class FakeIDClass {
|
||||
@ -746,14 +811,178 @@ public:
|
||||
XString8 AirportBridgeDeviceName = XString8();
|
||||
AudioClass Audio = AudioClass();
|
||||
USBClass USB = USBClass();
|
||||
PropertiesClass Properties = PropertiesClass();
|
||||
FakeIDClass FakeID = FakeIDClass();
|
||||
|
||||
// UINTN NrAddProperties;
|
||||
// DEV_PROPERTY *AddProperties;
|
||||
XObjArray<DEV_ADDPROPERTY> AddProperties = XObjArray<DEV_ADDPROPERTY>();
|
||||
DEV_PROPERTY *ArbProperties = 0;
|
||||
XObjArray<AddPropertyClass> AddPropertyArray = XObjArray<AddPropertyClass>();
|
||||
PropertiesClass Properties = PropertiesClass();
|
||||
XObjArray<ArbitraryPropertyClass> ArbitraryArray = XObjArray<ArbitraryPropertyClass>();
|
||||
|
||||
|
||||
// 2021-04 : Following is temporary to compare with old way of storing properties.
|
||||
// Let's keep it few months until I am sure the refactoring isomorphic
|
||||
private:
|
||||
DEV_PROPERTY *ArbProperties = 0; // the old version.
|
||||
public:
|
||||
void FillDevicePropertiesOld(SETTINGS_DATA& gSettings, const TagDict* DevicesDict);
|
||||
|
||||
bool compareDevProperty(const XString8& label, const DEV_PROPERTY& devProp, const DEV_PROPERTY& newDev) const
|
||||
{
|
||||
if ( newDev.Device != devProp.Device )
|
||||
{
|
||||
printf("%s.Device\n", label.c_str());
|
||||
return false;
|
||||
}
|
||||
if ( newDev.Key || devProp.Key ) {
|
||||
if ( !newDev.Key || !devProp.Key ) {
|
||||
printf("%s.Key\n", label.c_str());
|
||||
return false;
|
||||
}
|
||||
#ifdef JIEF_DEBUG
|
||||
if ( strcmp(devProp.Key, "10") == 0 ) {
|
||||
printf("%s", "");
|
||||
}
|
||||
#endif
|
||||
if ( strcmp(newDev.Key, devProp.Key) != 0 )
|
||||
{
|
||||
printf("%s.Key\n", label.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ( newDev.ValueLen != devProp.ValueLen )
|
||||
{
|
||||
printf("%s.Value.ValueLen\n", label.c_str());
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
if ( newDev.ValueLen > 0 ) {
|
||||
if ( memcmp(newDev.Value, devProp.Value, devProp.ValueLen) != 0 )
|
||||
{
|
||||
printf("%s.Value\n", label.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( newDev.ValueType != devProp.ValueType )
|
||||
{
|
||||
printf("%s.ValueType\n", label.c_str());
|
||||
return false;
|
||||
}
|
||||
if ( newDev.Label || devProp.Label ) {
|
||||
if ( !newDev.Label || !devProp.Label ) {
|
||||
printf("%s.Label\n", label.c_str());
|
||||
return false;
|
||||
}
|
||||
if ( strcmp(newDev.Label, devProp.Label) != 0 )
|
||||
{
|
||||
printf("%s.Label : old:%s new:%s\n", label.c_str(), devProp.Label, newDev.Label);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ( newDev.MenuItem.BValue != devProp.MenuItem.BValue )
|
||||
{
|
||||
printf("%s.MenuItem.BValue\n", label.c_str());
|
||||
return false;
|
||||
}
|
||||
DEV_PROPERTY *oldChild = devProp.Child;
|
||||
DEV_PROPERTY *newChild = newDev.Child;
|
||||
size_t jdx = 0;
|
||||
while ( oldChild && newChild )
|
||||
{
|
||||
compareDevProperty(S8Printf("%s.child[%zu]", label.c_str(), jdx), *oldChild, *newChild);
|
||||
oldChild = oldChild->Next;
|
||||
newChild = newChild->Next;
|
||||
jdx++;
|
||||
}
|
||||
if ( oldChild != newChild )
|
||||
{
|
||||
printf("%s.Child count\n", label.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool compareOldAndCompatibleArb()
|
||||
{
|
||||
{
|
||||
size_t oldArbIdx = 0;
|
||||
const DEV_PROPERTY* arb = ArbProperties;
|
||||
while ( arb ) {
|
||||
printf("ArbProperties[%zu].Key = %s\n", oldArbIdx++, arb->Key);
|
||||
arb = arb->Next;
|
||||
}
|
||||
}
|
||||
const XObjArray<DEV_PROPERTY> compatibleArbProperties = getCompatibleArbProperty();
|
||||
size_t oldArbIdx = 0;
|
||||
for ( size_t idx = 0 ; idx < compatibleArbProperties.size() ; ++idx )
|
||||
{
|
||||
if ( ArbProperties == NULL ) {
|
||||
printf("ArbProperties.size < compatibleArbProperties.size()");
|
||||
return false;
|
||||
}
|
||||
if ( !compareDevProperty(S8Printf("ArbProperties[%zu]", idx), *ArbProperties, compatibleArbProperties[idx]) ) {
|
||||
return false;
|
||||
}
|
||||
++oldArbIdx;
|
||||
ArbProperties = ArbProperties->Next;
|
||||
}
|
||||
if ( ArbProperties != NULL ) {
|
||||
printf("ArbProperties.size > compatibleArbProperties.size()");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
XObjArray<DEV_PROPERTY> getCompatibleArbProperty() const
|
||||
{
|
||||
XObjArray<DEV_PROPERTY> arb;
|
||||
for ( size_t idx = ArbitraryArray.size() ; idx-- > 0 ; ) {
|
||||
const ArbitraryPropertyClass& newArb = ArbitraryArray[idx];
|
||||
for ( size_t jdx = newArb.CustomPropertyArray.size() ; jdx-- > 0 ; ) {
|
||||
const SimplePropertyClass& newArbProp = newArb.CustomPropertyArray[jdx];
|
||||
DEV_PROPERTY* newProp = new DEV_PROPERTY();
|
||||
newProp->Device = newArb.Device;
|
||||
newProp->Key = const_cast<char*>(newArbProp.Key.c_str()); // const_cast !!! So ugly. It is just because it's temporary. If ArbProperties is modified after this, a lot a memory problem will happen. I could have done some strdup, but that way I don't use memory and don't have to free it.
|
||||
newProp->Value = const_cast<unsigned char*>(newArbProp.Value.data());
|
||||
newProp->ValueLen = newArbProp.Value.size();
|
||||
newProp->ValueType = newArbProp.ValueType;
|
||||
newProp->MenuItem.BValue = newArbProp.MenuItem.BValue ;
|
||||
newProp->Label = const_cast<char*>(newArb.Label.c_str());
|
||||
arb.AddReference(newProp, true);
|
||||
// printf("Add prop key=%s label=%s at index %zu\n", newProp->Key.c_str(), newProp->Label.c_str(), arb.size()-1);
|
||||
}
|
||||
}
|
||||
// Non arb : device = 0
|
||||
for ( size_t idx = Properties.PropertyArray.size() ; idx-- > 0 ; ) {
|
||||
const PropertiesClass::PropertyClass& Prop = Properties.PropertyArray[idx];
|
||||
DEV_PROPERTY* newProp = new DEV_PROPERTY();
|
||||
newProp->Device = 0;
|
||||
newProp->Key = 0;
|
||||
if ( Prop.Enabled ) newProp->Label = XString8(Prop.DevicePathAsString).forgetDataWithoutFreeing();
|
||||
else newProp->Label = S8Printf("!%ls", Prop.DevicePathAsString.wc_str()).forgetDataWithoutFreeing();
|
||||
newProp->Child = NULL;
|
||||
for ( size_t jdx = Properties.PropertyArray[idx].propertiesArray.size() ; jdx-- > 0 ; ) {
|
||||
const SimplePropertyClass& SubProp = Prop.propertiesArray[jdx];
|
||||
DEV_PROPERTY* newSubProp = new DEV_PROPERTY();
|
||||
newSubProp->Device = 0;
|
||||
newSubProp->Key = const_cast<char*>(SubProp.Key.c_str());
|
||||
newSubProp->Value = const_cast<unsigned char*>(SubProp.Value.data());
|
||||
newSubProp->ValueLen = SubProp.Value.size();
|
||||
newSubProp->ValueType = SubProp.ValueType;
|
||||
newSubProp->MenuItem.BValue = SubProp.MenuItem.BValue;
|
||||
if ( newProp->Child ) {
|
||||
DEV_PROPERTY* childs;
|
||||
for ( childs = newProp->Child ; childs->Next ; childs = childs->Next );
|
||||
childs->Next = newSubProp;
|
||||
}else{
|
||||
newProp->Child = newSubProp;
|
||||
}
|
||||
}
|
||||
arb.AddReference(newProp, true);
|
||||
// printf("Add prop %s at index %zu\n", newProp->Key.c_str(), arb.size()-1);
|
||||
}
|
||||
return arb;
|
||||
};
|
||||
};
|
||||
|
||||
class QuirksClass {
|
||||
|
@ -16,6 +16,7 @@
|
||||
#ifndef _UTILS_H_
|
||||
#define _UTILS_H_
|
||||
|
||||
#include "BootLog.h"
|
||||
|
||||
//Unicode
|
||||
#define IS_COMMA(a) ((a) == L',')
|
||||
@ -53,9 +54,15 @@ size_t hex2bin(const T hex, size_t hexlen, uint8_t *out, size_t outlen)
|
||||
size_t outidx = 0;
|
||||
char buf[3] = {0,0,0};
|
||||
|
||||
if ( hex == NULL || out == NULL || hexlen <= 0 || outlen <= 0 ) {
|
||||
// DBG("[ERROR] bin2hex input error\n"); //this is not error, this is empty value
|
||||
return FALSE;
|
||||
if ( hex == NULL || hexlen <= 0 ) {
|
||||
//DBG("[ERROR] bin2hex input error\n"); //this is not error, this is empty value
|
||||
return 0;
|
||||
}
|
||||
if ( out == NULL && outlen > 0 ) {
|
||||
DebugLog(1, "[WARN] bin2hex outlen is ignored when out==NULL\n");
|
||||
}
|
||||
if ( out != NULL && outlen == 0 ) {
|
||||
DebugLog(1, "[WARN] bin2hex out is ignored when outlen==0\n");
|
||||
}
|
||||
|
||||
for (size_t hexidx = 0; hexidx < hexlen ; )
|
||||
@ -67,21 +74,24 @@ size_t hex2bin(const T hex, size_t hexlen, uint8_t *out, size_t outlen)
|
||||
hexidx++; //skip spaces and commas
|
||||
}
|
||||
if ( hexidx == hexlen-1 ) {
|
||||
printf("[ERROR] bin2hex '%.*s' uneven char nuber\n", (int)hexlen, XString8().takeValueFrom(hex).c_str());
|
||||
DebugLog(1, "[ERROR] bin2hex '%.*s' uneven char nuber\n", (int)hexlen, XString8().takeValueFrom(hex).c_str());
|
||||
return 0;
|
||||
}
|
||||
if (!IsHexDigit(hex[hexidx]) || !IsHexDigit(hex[hexidx+1])) {
|
||||
if ( hexlen > 200 ) hexlen = 200; // Do not print more than 200 chars.
|
||||
printf("[ERROR] bin2hex '%.*s' syntax error\n", (int)hexlen, XString8().takeValueFrom(hex).c_str());
|
||||
DebugLog(1, "[ERROR] bin2hex '%.*s' syntax error\n", (int)hexlen, XString8().takeValueFrom(hex).c_str());
|
||||
return 0;
|
||||
}
|
||||
buf[0] = hex[hexidx++];
|
||||
buf[1] = hex[hexidx++];
|
||||
if ( outidx == outlen ) {
|
||||
printf("[ERROR] bin2hex '%.*s' outbuffer not big enough\n", (int)hexlen, XString8().takeValueFrom(hex).c_str());
|
||||
return 0;
|
||||
if ( out != NULL ) {
|
||||
if ( outidx == outlen ) {
|
||||
DebugLog(1, "[ERROR] bin2hex '%.*s' outbuffer not big enough\n", (int)hexlen, XString8().takeValueFrom(hex).c_str());
|
||||
return 0;
|
||||
}
|
||||
out[outidx] = hexstrtouint8(buf);
|
||||
}
|
||||
out[outidx++] = hexstrtouint8(buf);
|
||||
++outidx;
|
||||
}
|
||||
//bin[outlen] = 0;
|
||||
return outidx;
|
||||
|
@ -2139,17 +2139,17 @@ BOOLEAN setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev)
|
||||
}
|
||||
|
||||
|
||||
if (gSettings.Devices.AddProperties.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
for (i = 0; i < gSettings.Devices.AddProperties.size(); i++) {
|
||||
if (gSettings.Devices.AddProperties[i].Device != DEV_ATI) {
|
||||
if (gSettings.Devices.AddPropertyArray.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
for (i = 0; i < gSettings.Devices.AddPropertyArray.size(); i++) {
|
||||
if (gSettings.Devices.AddPropertyArray[i].Device != DEV_ATI) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!gSettings.Devices.AddProperties[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
} else {
|
||||
devprop_add_value(card->device, gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].Value);
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
devprop_add_value(card->device, gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].Value);
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -281,56 +281,45 @@ bool devprop_add_value(DevPropDevice *device, const XString8& nm, const XBuffer<
|
||||
return devprop_add_value(device, nm.data(), vl.data(), vl.size());
|
||||
}
|
||||
|
||||
CHAR8 *devprop_generate_string(DevPropString *StringBuf)
|
||||
XString8 devprop_generate_string(DevPropString *StringBuf)
|
||||
{
|
||||
UINTN len = StringBuf->length * 2;
|
||||
INT32 i = 0;
|
||||
UINT32 x = 0;
|
||||
CHAR8 *buffer = (CHAR8*)AllocatePool(len + 1);
|
||||
CHAR8 *ptr = buffer;
|
||||
XString8 buffer;
|
||||
|
||||
// DBG("devprop_generate_string\n");
|
||||
if(!buffer)
|
||||
return NULL;
|
||||
|
||||
snprintf(buffer, len, "%08X%08X%04hX%04hX", SwapBytes32(StringBuf->length), StringBuf->WHAT2,
|
||||
SwapBytes16(StringBuf->numentries), StringBuf->WHAT3);
|
||||
buffer += 24;
|
||||
buffer.S8Catf("%08X%08X%04hX%04hX", SwapBytes32(StringBuf->length), StringBuf->WHAT2, SwapBytes16(StringBuf->numentries), StringBuf->WHAT3);
|
||||
|
||||
while(i < StringBuf->numentries) {
|
||||
UINT8 *dataptr = StringBuf->entries[i]->data;
|
||||
snprintf(buffer, len, "%08X%04hX%04hX", SwapBytes32(StringBuf->entries[i]->length),
|
||||
buffer.S8Catf("%08X%04hX%04hX", SwapBytes32(StringBuf->entries[i]->length),
|
||||
SwapBytes16(StringBuf->entries[i]->numentries), StringBuf->entries[i]->WHAT2); //FIXME: wrong buffer sizes!
|
||||
|
||||
buffer += 16;
|
||||
snprintf(buffer, len, "%02hhX%02hhX%04hX%08X%08X", StringBuf->entries[i]->acpi_dev_path.type,
|
||||
buffer.S8Catf("%02hhX%02hhX%04hX%08X%08X", StringBuf->entries[i]->acpi_dev_path.type,
|
||||
StringBuf->entries[i]->acpi_dev_path.subtype,
|
||||
SwapBytes16(StringBuf->entries[i]->acpi_dev_path.length),
|
||||
SwapBytes32(StringBuf->entries[i]->acpi_dev_path._HID),
|
||||
SwapBytes32(StringBuf->entries[i]->acpi_dev_path._UID));
|
||||
|
||||
buffer += 24;
|
||||
for(x = 0; x < StringBuf->entries[i]->num_pci_devpaths; x++) {
|
||||
snprintf(buffer, len, "%02hhX%02hhX%04hX%02hhX%02hhX", StringBuf->entries[i]->pci_dev_path[x].type,
|
||||
buffer.S8Catf("%02hhX%02hhX%04hX%02hhX%02hhX", StringBuf->entries[i]->pci_dev_path[x].type,
|
||||
StringBuf->entries[i]->pci_dev_path[x].subtype,
|
||||
SwapBytes16(StringBuf->entries[i]->pci_dev_path[x].length),
|
||||
StringBuf->entries[i]->pci_dev_path[x].function,
|
||||
StringBuf->entries[i]->pci_dev_path[x].device);
|
||||
buffer += 12;
|
||||
}
|
||||
|
||||
snprintf(buffer, len, "%02hhX%02hhX%04hX", StringBuf->entries[i]->path_end.type,
|
||||
buffer.S8Catf("%02hhX%02hhX%04hX", StringBuf->entries[i]->path_end.type,
|
||||
StringBuf->entries[i]->path_end.subtype,
|
||||
SwapBytes16(StringBuf->entries[i]->path_end.length));
|
||||
|
||||
buffer += 8;
|
||||
for(x = 0; x < (StringBuf->entries[i]->length) - (24 + (6 * StringBuf->entries[i]->num_pci_devpaths)); x++) {
|
||||
snprintf(buffer, len, "%02hhX", *dataptr++);
|
||||
buffer += 2;
|
||||
buffer.S8Catf("%02hhX", *dataptr++);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return ptr;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void devprop_free_string(DevPropString *StringBuf)
|
||||
@ -388,18 +377,18 @@ BOOLEAN set_eth_props(pci_dt_t *eth_dev)
|
||||
builtin = 0x01;
|
||||
}
|
||||
|
||||
if (gSettings.Devices.AddProperties.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
for (i = 0; i < gSettings.Devices.AddProperties.size(); i++) {
|
||||
if (gSettings.Devices.AddProperties[i].Device != DEV_LAN) {
|
||||
if (gSettings.Devices.AddPropertyArray.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
for (i = 0; i < gSettings.Devices.AddPropertyArray.size(); i++) {
|
||||
if (gSettings.Devices.AddPropertyArray[i].Device != DEV_LAN) {
|
||||
continue;
|
||||
}
|
||||
Injected = TRUE;
|
||||
|
||||
if (!gSettings.Devices.AddProperties[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
} else {
|
||||
devprop_add_value(device, gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].Value);
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
devprop_add_value(device, gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].Value);
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -467,18 +456,18 @@ BOOLEAN set_usb_props(pci_dt_t *usb_dev)
|
||||
// DBG("USB Controller [%04X:%04X] :: %s\n", usb_dev->vendor_id, usb_dev->device_id, devicepath);
|
||||
// DBG("Setting dev.prop built-in=0x%X\n", builtin);
|
||||
|
||||
if (gSettings.Devices.AddProperties.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
for (i = 0; i < gSettings.Devices.AddProperties.size(); i++) {
|
||||
if (gSettings.Devices.AddProperties[i].Device != DEV_USB) {
|
||||
if (gSettings.Devices.AddPropertyArray.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
for (i = 0; i < gSettings.Devices.AddPropertyArray.size(); i++) {
|
||||
if (gSettings.Devices.AddPropertyArray[i].Device != DEV_USB) {
|
||||
continue;
|
||||
}
|
||||
Injected = TRUE;
|
||||
|
||||
if (!gSettings.Devices.AddProperties[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
} else {
|
||||
devprop_add_value(device, gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].Value);
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
devprop_add_value(device, gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].Value);
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -122,8 +122,8 @@ DevPropString *devprop_create_string(void);
|
||||
DevPropDevice *devprop_add_device_pci(DevPropString *string, pci_dt_t *PciDt, EFI_DEVICE_PATH_PROTOCOL *DevicePath);
|
||||
BOOLEAN devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, const UINT8 *vl, UINTN len); // to be removed
|
||||
bool devprop_add_value(DevPropDevice *device, const XString8& nm, const XBuffer<uint8_t>& vl);
|
||||
CHAR8 *devprop_generate_string(DevPropString *string);
|
||||
void devprop_free_string(DevPropString *string);
|
||||
XString8 devprop_generate_string(DevPropString *string);
|
||||
void devprop_free_string(DevPropString *string);
|
||||
|
||||
BOOLEAN set_eth_props(pci_dt_t *eth_dev);
|
||||
BOOLEAN set_usb_props(pci_dt_t *usb_dev);
|
||||
|
@ -1336,18 +1336,18 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gSettings.Devices.AddProperties.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
for (i = 0; i < gSettings.Devices.AddProperties.size(); i++) {
|
||||
if (gSettings.Devices.AddProperties[i].Device != DEV_INTEL) {
|
||||
if (gSettings.Devices.AddPropertyArray.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
for (i = 0; i < gSettings.Devices.AddPropertyArray.size(); i++) {
|
||||
if (gSettings.Devices.AddPropertyArray[i].Device != DEV_INTEL) {
|
||||
continue;
|
||||
}
|
||||
Injected = TRUE;
|
||||
|
||||
if (!gSettings.Devices.AddProperties[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
} else {
|
||||
devprop_add_value(device, gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].Value);
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
devprop_add_value(device, gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].Value);
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -175,18 +175,18 @@ BOOLEAN setup_hda_devprop(EFI_PCI_IO_PROTOCOL *PciIo, pci_dt_t *hda_dev, const M
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gSettings.Devices.AddProperties.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
for (i = 0; i < gSettings.Devices.AddProperties.size(); i++) {
|
||||
if (gSettings.Devices.AddProperties[i].Device != DEV_HDMI) {
|
||||
if (gSettings.Devices.AddPropertyArray.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
for (i = 0; i < gSettings.Devices.AddPropertyArray.size(); i++) {
|
||||
if (gSettings.Devices.AddPropertyArray[i].Device != DEV_HDMI) {
|
||||
continue;
|
||||
}
|
||||
Injected = TRUE;
|
||||
|
||||
if (!gSettings.Devices.AddProperties[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
} else {
|
||||
devprop_add_value(device, gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].Value);
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
devprop_add_value(device, gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].Value);
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -221,18 +221,18 @@ BOOLEAN setup_hda_devprop(EFI_PCI_IO_PROTOCOL *PciIo, pci_dt_t *hda_dev, const M
|
||||
} else {
|
||||
layoutId = 12;
|
||||
}
|
||||
if (gSettings.Devices.AddProperties.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
for (i = 0; i < gSettings.Devices.AddProperties.size(); i++) {
|
||||
if (gSettings.Devices.AddProperties[i].Device != DEV_HDA) {
|
||||
if (gSettings.Devices.AddPropertyArray.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
for (i = 0; i < gSettings.Devices.AddPropertyArray.size(); i++) {
|
||||
if (gSettings.Devices.AddPropertyArray[i].Device != DEV_HDA) {
|
||||
continue;
|
||||
}
|
||||
Injected = TRUE;
|
||||
|
||||
if (!gSettings.Devices.AddProperties[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
} else {
|
||||
devprop_add_value(device, gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].Value);
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
devprop_add_value(device, gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].Value);
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2427,18 +2427,18 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (gSettings.Devices.AddProperties.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
for (i = 0; i < gSettings.Devices.AddProperties.size(); i++) {
|
||||
if (gSettings.Devices.AddProperties[i].Device != DEV_NVIDIA) {
|
||||
if (gSettings.Devices.AddPropertyArray.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
|
||||
for (i = 0; i < gSettings.Devices.AddPropertyArray.size(); i++) {
|
||||
if (gSettings.Devices.AddPropertyArray[i].Device != DEV_NVIDIA) {
|
||||
continue;
|
||||
}
|
||||
Injected = TRUE;
|
||||
|
||||
if (!gSettings.Devices.AddProperties[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) {
|
||||
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
} else {
|
||||
devprop_add_value(device, gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].Value);
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddProperties[i].Key, gSettings.Devices.AddProperties[i].ValueLen);
|
||||
devprop_add_value(device, gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].Value);
|
||||
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
|
||||
}
|
||||
}
|
||||
if (Injected) {
|
||||
|
@ -12,6 +12,20 @@
|
||||
/* Machine Default Data */
|
||||
|
||||
|
||||
#ifndef DEBUG_PLATFORMDATA
|
||||
#ifndef DEBUG_ALL
|
||||
#define DEBUG_PLATFORMDATA 1
|
||||
#else
|
||||
#define DEBUG_PLATFORMDATA DEBUG_ALL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if DEBUG_PLATFORMDATA==0
|
||||
#define DBG(...)
|
||||
#else
|
||||
#define DBG(...) DebugLog(DEBUG_PLATFORMDATA, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
UINT32 gFwFeatures;
|
||||
UINT32 gFwFeaturesMask;
|
||||
UINT64 gPlatformFeature;
|
||||
|
@ -24,20 +24,7 @@
|
||||
#define kXMLTagIDREF "IDREF="
|
||||
#define kXMLTagFloat "real"
|
||||
|
||||
|
||||
typedef enum {
|
||||
kTagTypeNone,
|
||||
kTagTypeDict, // 1
|
||||
kTagTypeKey, // 2
|
||||
kTagTypeString, // 3
|
||||
kTagTypeInteger,// 4
|
||||
kTagTypeData, // 5
|
||||
kTagTypeDate, // 6
|
||||
kTagTypeFalse, // 7
|
||||
kTagTypeTrue, // 8
|
||||
kTagTypeArray, // 9
|
||||
kTagTypeFloat // 10
|
||||
} TAG_TYPE;
|
||||
#include "../../include/TagTypes.h"
|
||||
|
||||
class TagDict;
|
||||
class TagKey;
|
||||
|
@ -1119,8 +1119,11 @@ void PatchTableType11()
|
||||
// AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.BoardNumber, iStrLen(gSettings.BoardNumber, 64));
|
||||
// snprintf(TempRev, MAX_OEM_STRING, "\n⌘ Powered by %s\n", gRevisionStr);
|
||||
// AsciiStrCatS(OEMString, MAX_OEM_STRING, TempRev);
|
||||
#ifdef JIEF_DEBUG
|
||||
XString8 OEMString = S8Printf("⌘ Powered by %s\n", gBuildId.c_str());
|
||||
#else
|
||||
XString8 OEMString = S8Printf("Apple ROM Version.\nBoard-ID : %s\n⌘ Powered by %s\n", gSettings.BoardNumber.c_str(), gRevisionStr);
|
||||
|
||||
#endif
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type11->StringCount, OEMString);
|
||||
|
||||
LogSmbiosTable(newSmbiosTable);
|
||||
|
@ -190,11 +190,24 @@ public:
|
||||
}
|
||||
|
||||
void ncpy(const void *buf, size_t len);
|
||||
void cpy(bool b) { ncpy(&b, sizeof(b)); };
|
||||
void cpy(char c) { ncpy(&c, sizeof(c)); };
|
||||
void cpy(unsigned char c) { ncpy(&c, sizeof(c)); };
|
||||
void cpy(signed char c) { ncpy(&c, sizeof(c)); };
|
||||
void cpy(signed short s) { ncpy(&s, sizeof(s)); };
|
||||
void cpy(unsigned short us) { ncpy(&us, sizeof(us)); };
|
||||
void cpy(signed int i) { ncpy(&i, sizeof(i)); };
|
||||
void cpy(unsigned int ui) { ncpy(&ui, sizeof(ui)); };
|
||||
void cpy(signed long l) { ncpy(&l, sizeof(l)); };
|
||||
void cpy(unsigned long ul) { ncpy(&ul, sizeof(ul)); };
|
||||
void cpy(signed long long ull) { ncpy(&ull, sizeof(ull)); };
|
||||
void cpy(unsigned long long ull) { ncpy(&ull, sizeof(ull)); };
|
||||
void cpy(float f) { ncpy(&f, sizeof(f)); };
|
||||
void cpy(double d) { ncpy(&d, sizeof(d)); };
|
||||
void cpy(void* p) { ncpy(&p, sizeof(p)); };
|
||||
// Cat
|
||||
void ncat(const void *buf, size_t len);
|
||||
|
||||
void cat(bool b) { ncat(&b, sizeof(b)); };
|
||||
|
||||
void cat(char c) { ncat(&c, sizeof(c)); };
|
||||
void cat(unsigned char c) { ncat(&c, sizeof(c)); };
|
||||
void cat(signed char c) { ncat(&c, sizeof(c)); };
|
||||
@ -206,10 +219,8 @@ public:
|
||||
void cat(unsigned long ul) { ncat(&ul, sizeof(ul)); };
|
||||
void cat(signed long long ull) { ncat(&ull, sizeof(ull)); };
|
||||
void cat(unsigned long long ull) { ncat(&ull, sizeof(ull)); };
|
||||
|
||||
void cat(float f) { ncat(&f, sizeof(f)); };
|
||||
void cat(double d) { ncat(&d, sizeof(d)); };
|
||||
|
||||
void cat(void* p) { ncat(&p, sizeof(p)); };
|
||||
|
||||
// void cat(const XString8 &aXString8);
|
||||
|
@ -40,6 +40,8 @@ class XObjArrayNC
|
||||
size_t m_allocatedSize;
|
||||
|
||||
public:
|
||||
typedef TYPE type;
|
||||
|
||||
void Init();
|
||||
XObjArrayNC() : _Data(0), _Len(0), m_allocatedSize(0) { Init(); }
|
||||
virtual ~XObjArrayNC();
|
||||
|
@ -952,6 +952,17 @@ public:
|
||||
setEmpty();
|
||||
}
|
||||
}
|
||||
template<typename O>
|
||||
void strsicpy(const O* other, size_t other_size)
|
||||
{
|
||||
if ( other && *other && other_size > 0 ) {
|
||||
CheckSize(other_size, 0);
|
||||
utf_string_from_utf_string_len(m_data, m_allocatedSize, other, other_size);
|
||||
m_data[other_size] = 0;
|
||||
}else{
|
||||
setEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
/* strcat char */
|
||||
template<typename O, enable_if(is_char(O))>
|
||||
|
30
rEFIt_UEFI/include/TagTypes.h
Normal file
30
rEFIt_UEFI/include/TagTypes.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* TagTypes.h
|
||||
*
|
||||
* Created on: Mar 30, 2021
|
||||
* Author: jief
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_TAGTYPES_H_
|
||||
#define INCLUDE_TAGTYPES_H_
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
kTagTypeNone,
|
||||
kTagTypeDict, // 1
|
||||
kTagTypeKey, // 2
|
||||
kTagTypeString, // 3
|
||||
kTagTypeInteger,// 4
|
||||
kTagTypeData, // 5
|
||||
kTagTypeDate, // 6
|
||||
kTagTypeFalse, // 7
|
||||
kTagTypeTrue, // 8
|
||||
kTagTypeArray, // 9
|
||||
kTagTypeFloat // 10
|
||||
} TAG_TYPE;
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* INCLUDE_TAGTYPES_H_ */
|
@ -116,7 +116,7 @@ class INPUT_ITEM {
|
||||
public:
|
||||
ITEM_TYPE ItemType; //string, value, boolean
|
||||
BOOLEAN Valid;
|
||||
BOOLEAN BValue;
|
||||
UINT8 BValue; // was BOOLEAN, but value 2 is sometimes assigned.
|
||||
UINT8 Pad8;
|
||||
UINT32 IValue;
|
||||
// UINT64 UValue;
|
||||
|
@ -51,6 +51,7 @@
|
||||
include/BootTypes.h
|
||||
include/OSTypes.h
|
||||
include/OSFlags.h
|
||||
include/TagTypes.h
|
||||
include/VolumeTypes.h
|
||||
refit/main.cpp
|
||||
refit/icns.cpp
|
||||
|
@ -2740,6 +2740,31 @@ void afterGetUserSettings(const SETTINGS_DATA& gSettings)
|
||||
}else{
|
||||
GlobalConfig.Turbo = gCPUStructure.Turbo;
|
||||
}
|
||||
|
||||
// Jief : Shouldn't this injection made at StartLoader only ? And only for macOS ?
|
||||
if ( gSettings.Devices.Properties.propertiesAsString.notEmpty() )
|
||||
{
|
||||
size_t binaryPropSize = hex2bin(gSettings.Devices.Properties.propertiesAsString, NULL, 0); // check of correct length is supposed to have been done when reading settings.
|
||||
UINTN nbPages = EFI_SIZE_TO_PAGES(binaryPropSize);
|
||||
EFI_PHYSICAL_ADDRESS BufferPtr = EFI_SYSTEM_TABLE_MAX_ADDRESS; //0xFE000000;
|
||||
EFI_STATUS Status = gBS->AllocatePages (
|
||||
AllocateMaxAddress,
|
||||
EfiACPIReclaimMemory,
|
||||
nbPages,
|
||||
&BufferPtr
|
||||
);
|
||||
|
||||
if (!EFI_ERROR(Status)) {
|
||||
cProperties = (UINT8*)(UINTN)BufferPtr;
|
||||
cPropSize = (UINT32)hex2bin(gSettings.Devices.Properties.propertiesAsString, cProperties, EFI_PAGES_TO_SIZE(nbPages)); // cast should be safe hex2bin return < MAX_UINT32
|
||||
|
||||
DBG("Injected EFIString of length %d\n", cPropSize);
|
||||
}else{
|
||||
MsgLog("AllocatePages failed (%s), Properties not injected", efiStrError(Status));
|
||||
}
|
||||
}
|
||||
//---------
|
||||
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
|
@ -2174,12 +2174,12 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuAudioPort()
|
||||
return Entry;
|
||||
}
|
||||
|
||||
void CreateMenuProps(REFIT_MENU_SCREEN *SubScreen, DEV_PROPERTY *Prop)
|
||||
void CreateMenuProps(REFIT_MENU_SCREEN* SubScreen, SETTINGS_DATA::DevicesClass::SimplePropertyClass* Prop)
|
||||
{
|
||||
REFIT_INPUT_DIALOG *InputBootArgs;
|
||||
|
||||
InputBootArgs = new REFIT_INPUT_DIALOG;
|
||||
InputBootArgs->Title.SWPrintf(" key: %s", Prop->Key);
|
||||
InputBootArgs = new REFIT_INPUT_DIALOG;
|
||||
InputBootArgs->Title.SWPrintf(" key: %s", Prop->Key.c_str());
|
||||
InputBootArgs->Row = 0xFFFF; //cursor
|
||||
InputBootArgs->Item = &Prop->MenuItem;
|
||||
InputBootArgs->AtClick = ActionEnter;
|
||||
@ -2187,10 +2187,10 @@ void CreateMenuProps(REFIT_MENU_SCREEN *SubScreen, DEV_PROPERTY *Prop)
|
||||
SubScreen->AddMenuEntry(InputBootArgs, true);
|
||||
switch (Prop->ValueType) {
|
||||
case kTagTypeInteger:
|
||||
SubScreen->AddMenuInfo_f(" value: 0x%08llx", *(UINT64*)Prop->Value);
|
||||
SubScreen->AddMenuInfo_f(" value: 0x%08llx", *(UINT64*)Prop->Value.data());
|
||||
break;
|
||||
case kTagTypeString:
|
||||
SubScreen->AddMenuInfo_f(" value: %90s", Prop->Value);
|
||||
SubScreen->AddMenuInfo_f(" value: %90s", Prop->Value.data());
|
||||
break;
|
||||
case kTagTypeFalse:
|
||||
SubScreen->AddMenuInfo_f((" value: false"));
|
||||
@ -2199,56 +2199,142 @@ void CreateMenuProps(REFIT_MENU_SCREEN *SubScreen, DEV_PROPERTY *Prop)
|
||||
SubScreen->AddMenuInfo_f((" value: true"));
|
||||
break;
|
||||
case kTagTypeFloat:
|
||||
SubScreen->AddMenuInfo_f(" value: %f", *(float*)Prop->Value);
|
||||
SubScreen->AddMenuInfo_f(" value: %f", *(float*)Prop->Value.data());
|
||||
break;
|
||||
default: //type data, print first 24 bytes
|
||||
//CHAR8* Bytes2HexStr(UINT8 *data, UINTN len)
|
||||
SubScreen->AddMenuInfo_f(" value[%llu]: %24s", Prop->ValueLen, Bytes2HexStr((UINT8*)Prop->Value, MIN(24, Prop->ValueLen)).c_str());
|
||||
SubScreen->AddMenuInfo_f(" value[%zu]: %24s", Prop->Value.size(), Bytes2HexStr((UINT8*)Prop->Value.data(), MIN(24, Prop->Value.size())).c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
REFIT_ABSTRACT_MENU_ENTRY* SubMenuCustomDevices()
|
||||
void CreateMenuAddProp(REFIT_MENU_SCREEN* SubScreen, SETTINGS_DATA::DevicesClass::AddPropertyClass* Prop)
|
||||
{
|
||||
REFIT_INPUT_DIALOG *InputBootArgs;
|
||||
|
||||
InputBootArgs = new REFIT_INPUT_DIALOG;
|
||||
InputBootArgs->Title.SWPrintf(" key: %s", Prop->Key.c_str());
|
||||
InputBootArgs->Row = 0xFFFF; //cursor
|
||||
InputBootArgs->Item = &Prop->MenuItem;
|
||||
InputBootArgs->AtClick = ActionEnter;
|
||||
InputBootArgs->AtRightClick = ActionDetails;
|
||||
SubScreen->AddMenuEntry(InputBootArgs, true);
|
||||
switch (Prop->ValueType) {
|
||||
case kTagTypeInteger:
|
||||
SubScreen->AddMenuInfo_f(" value: 0x%08llx", *(UINT64*)Prop->Value.data());
|
||||
break;
|
||||
case kTagTypeString:
|
||||
SubScreen->AddMenuInfo_f(" value: %90s", Prop->Value.data());
|
||||
break;
|
||||
case kTagTypeFalse:
|
||||
SubScreen->AddMenuInfo_f((" value: false"));
|
||||
break;
|
||||
case kTagTypeTrue:
|
||||
SubScreen->AddMenuInfo_f((" value: true"));
|
||||
break;
|
||||
case kTagTypeFloat:
|
||||
SubScreen->AddMenuInfo_f(" value: %f", *(float*)Prop->Value.data());
|
||||
break;
|
||||
default: //type data, print first 24 bytes
|
||||
//CHAR8* Bytes2HexStr(UINT8 *data, UINTN len)
|
||||
SubScreen->AddMenuInfo_f(" value[%zu]: %24s", Prop->Value.size(), Bytes2HexStr((UINT8*)Prop->Value.data(), MIN(24, Prop->Value.size())).c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
//REFIT_ABSTRACT_MENU_ENTRY* SubMenuCustomDevices()
|
||||
//{
|
||||
// REFIT_MENU_ITEM_OPTIONS *Entry;
|
||||
// REFIT_MENU_SCREEN *SubScreen;
|
||||
//
|
||||
// Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DEVICES, "Old Custom properties->"_XS8);
|
||||
//
|
||||
// for ( size_t idx = 0 ; idx < gSettings.Devices.newProperties.array.size(); ++idx)
|
||||
// {
|
||||
// SETTINGS_DATA::DevicesClass::PropertiesClass::PropertyDict& Prop = gSettings.Devices.newProperties.array[idx];
|
||||
//
|
||||
// SubScreen->AddMenuInfo_f("------------");
|
||||
// SubScreen->AddMenuInfo_f("%ls", Prop.DevicePathAsString.wc_str());
|
||||
// for ( size_t idxChild = 0 ; idxChild < Prop.propertiesArray.size(); ++idxChild) {
|
||||
// SETTINGS_DATA::DevicesClass::SimplePropertyClass& Props = Prop.propertiesArray[idxChild];
|
||||
// CreateMenuProps(SubScreen, &Props);
|
||||
// }
|
||||
// }
|
||||
// for ( size_t idx = 0 ; idx < gSettings.Devices.newArbitrary.size() ; ++idx) {
|
||||
// SETTINGS_DATA::DevicesClass::ArbitraryProperty& Prop = gSettings.Devices.newArbitrary[idx];
|
||||
// SubScreen->AddMenuInfo_f("------------");
|
||||
// for ( size_t idxChild = 0 ; idxChild < Prop.CustomPropertyArray.size(); ++idxChild) {
|
||||
// SETTINGS_DATA::DevicesClass::SimplePropertyClass& Props = Prop.CustomPropertyArray[idxChild];
|
||||
// SubScreen->AddMenuInfo_f("%s", Prop.Label.c_str());
|
||||
// CreateMenuProps(SubScreen, &Props);
|
||||
// }
|
||||
// }
|
||||
// SubScreen->AddMenuEntry(&MenuEntryReturn, false);
|
||||
// Entry->SubScreen = SubScreen;
|
||||
// return Entry;
|
||||
//}
|
||||
|
||||
REFIT_ABSTRACT_MENU_ENTRY* SubMenuProperties()
|
||||
{
|
||||
REFIT_MENU_ITEM_OPTIONS *Entry;
|
||||
REFIT_MENU_SCREEN *SubScreen;
|
||||
|
||||
UINT32 DevAddr, OldDevAddr = 0;
|
||||
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DEVICES, "Properties->"_XS8);
|
||||
|
||||
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DEVICES, "Custom properties->"_XS8);
|
||||
for ( size_t idx = 0 ; idx < gSettings.Devices.Properties.PropertyArray.size(); ++idx)
|
||||
{
|
||||
SETTINGS_DATA::DevicesClass::PropertiesClass::PropertyClass& Prop = gSettings.Devices.Properties.PropertyArray[idx];
|
||||
|
||||
if (gSettings.Devices.ArbProperties) {
|
||||
DEV_PROPERTY *Prop = gSettings.Devices.ArbProperties;
|
||||
if (Prop && (Prop->Device == 0))
|
||||
{
|
||||
DEV_PROPERTY *Props = NULL;
|
||||
while (Prop) {
|
||||
SubScreen->AddMenuInfo_f("------------");
|
||||
SubScreen->AddMenuInfo_f("%s", Prop->Label);
|
||||
Props = Prop->Child;
|
||||
while (Props) {
|
||||
CreateMenuProps(SubScreen, Props);
|
||||
Props = Props->Next;
|
||||
}
|
||||
Prop = Prop->Next;
|
||||
}
|
||||
if ( idx > 0 ) SubScreen->AddMenuInfo_f("------------");
|
||||
SubScreen->AddMenuInfo_f("%ls", Prop.DevicePathAsString.wc_str());
|
||||
for ( size_t idxChild = 0 ; idxChild < Prop.propertiesArray.size(); ++idxChild) {
|
||||
SETTINGS_DATA::DevicesClass::SimplePropertyClass& Props = Prop.propertiesArray[idxChild];
|
||||
CreateMenuProps(SubScreen, &Props);
|
||||
}
|
||||
while (Prop) {
|
||||
DevAddr = Prop->Device;
|
||||
if (DevAddr != 0 && DevAddr != OldDevAddr) {
|
||||
OldDevAddr = DevAddr;
|
||||
SubScreen->AddMenuInfo_f("------------");
|
||||
SubScreen->AddMenuInfo_f("%s", Prop->Label);
|
||||
CreateMenuProps(SubScreen, Prop);
|
||||
}
|
||||
Prop = Prop->Next;
|
||||
}
|
||||
}
|
||||
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
|
||||
Entry->SubScreen = SubScreen;
|
||||
return Entry;
|
||||
}
|
||||
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
|
||||
Entry->SubScreen = SubScreen;
|
||||
return Entry;
|
||||
}
|
||||
|
||||
REFIT_ABSTRACT_MENU_ENTRY* SubMenuArbProperties()
|
||||
{
|
||||
REFIT_MENU_ITEM_OPTIONS *Entry;
|
||||
REFIT_MENU_SCREEN *SubScreen;
|
||||
|
||||
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DEVICES, "Arbitrary properties->"_XS8);
|
||||
|
||||
for ( size_t idx = 0 ; idx < gSettings.Devices.ArbitraryArray.size() ; ++idx) {
|
||||
SETTINGS_DATA::DevicesClass::ArbitraryPropertyClass& Prop = gSettings.Devices.ArbitraryArray[idx];
|
||||
if ( idx > 0 ) SubScreen->AddMenuInfo_f("------------");
|
||||
for ( size_t idxChild = 0 ; idxChild < Prop.CustomPropertyArray.size(); ++idxChild) {
|
||||
SETTINGS_DATA::DevicesClass::SimplePropertyClass& Props = Prop.CustomPropertyArray[idxChild];
|
||||
SubScreen->AddMenuInfo_f("%s", Prop.Label.c_str());
|
||||
CreateMenuProps(SubScreen, &Props);
|
||||
}
|
||||
}
|
||||
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
|
||||
Entry->SubScreen = SubScreen;
|
||||
return Entry;
|
||||
}
|
||||
|
||||
REFIT_ABSTRACT_MENU_ENTRY* SubMenuAddProperties()
|
||||
{
|
||||
REFIT_MENU_ITEM_OPTIONS *Entry;
|
||||
REFIT_MENU_SCREEN *SubScreen;
|
||||
|
||||
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DEVICES, "Add properties->"_XS8);
|
||||
|
||||
for ( size_t idx = 0 ; idx < gSettings.Devices.AddPropertyArray.size() ; ++idx) {
|
||||
SETTINGS_DATA::DevicesClass::AddPropertyClass& Prop = gSettings.Devices.AddPropertyArray[idx];
|
||||
SubScreen->AddMenuInfo_f("%s", Prop.Label.c_str());
|
||||
CreateMenuAddProp(SubScreen, &Prop);
|
||||
}
|
||||
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
|
||||
Entry->SubScreen = SubScreen;
|
||||
return Entry;
|
||||
}
|
||||
|
||||
|
||||
|
||||
REFIT_ABSTRACT_MENU_ENTRY* SubMenuPCI()
|
||||
@ -2268,7 +2354,10 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuPCI()
|
||||
SubScreen->AddMenuItemInput(99, "FakeID SATA:", TRUE);
|
||||
SubScreen->AddMenuItemInput(100, "FakeID XHCI:", TRUE);
|
||||
SubScreen->AddMenuItemInput(103, "FakeID IMEI:", TRUE);
|
||||
SubScreen->AddMenuEntry(SubMenuCustomDevices(), true);
|
||||
// SubScreen->AddMenuEntry(SubMenuCustomDevices(), true);
|
||||
SubScreen->AddMenuEntry(SubMenuProperties(), true);
|
||||
SubScreen->AddMenuEntry(SubMenuArbProperties(), true);
|
||||
SubScreen->AddMenuEntry(SubMenuAddProperties(), true);
|
||||
|
||||
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
|
||||
Entry->SubScreen = SubScreen;
|
||||
|
Loading…
Reference in New Issue
Block a user