#include // Only use angled for Platform, else, xcode project won't compile #include "../cpp_foundation/XString.h" #include "../cpp_foundation/XStringArray.h" #include "../cpp_foundation/unicode_conversions.h" #include "../Platform/plist/plist.h" #include "../cpp_lib/XmlLiteSimpleTypes.h" #include "../cpp_lib/XmlLiteParser.h" #include "../Settings/ConfigPlist/ConfigPlistClass.h" static const char* config_all = "\n\n\n\n\n\n\n\n\n\n\n" "\r\n\ \r\n\ \r\n\ \r\n\ ACPI\r\n\ \r\n\ AutoMerge\r\n\ \r\n\ #AutoMerge1\r\n\ \r\n\ ##AutoMerge2\r\n\ \r\n\ DSDT\r\n\ \r\n\ Debug\r\n\ \r\n\ Fixes\r\n\ \r\n\ FixDarwin\r\n\ \r\n\ FixDisplay\r\n\ \r\n\ FixS3D\r\n\ \r\n\ \r\n\ Name\r\n\ aa\r\n\ Patches\r\n\ \r\n\ \r\n\ Comment\r\n\ ACPI1\r\n\ Disabled\r\n\ \r\n\ Find\r\n\ \r\n\ AA==\r\n\ \r\n\ Replace\r\n\ \r\n\ AQ==\r\n\ \r\n\ \r\n\ \r\n\ Comment\r\n\ ACPI2\r\n\ Disabled\r\n\ \r\n\ Find\r\n\ \r\n\ Ag==\r\n\ \r\n\ Replace\r\n\ \r\n\ Aw==\r\n\ \r\n\ \r\n\ \r\n\ Comment\r\n\ change EHC1 to EH01\r\n\ Disabled\r\n\ \r\n\ Find\r\n\ \r\n\ RUhDMQ==\r\n\ \r\n\ Replace\r\n\ \r\n\ RUgwMQ==\r\n\ \r\n\ \r\n\ \r\n\ ReuseFFFF\r\n\ \r\n\ Rtc8Allowed\r\n\ \r\n\ SuspendOverride\r\n\ \r\n\ \r\n\ DisableASPM\r\n\ \r\n\ DisabledAML\r\n\ \r\n\ aa\r\n\ bb\r\n\ \r\n\ DropTables\r\n\ \r\n\ \r\n\ Signature\r\n\ SSDT\r\n\ TableId\r\n\ CpuPm\r\n\ \r\n\ \r\n\ HaltEnabler\r\n\ \r\n\ PatchAPIC\r\n\ \r\n\ ResetAddress\r\n\ 01\r\n\ ResetValue\r\n\ 02\r\n\ SortedOrder\r\n\ \r\n\ dd\r\n\ cc\r\n\ \r\n\ smartUPS\r\n\ \r\n\ \r\n\ Boot\r\n\ \r\n\ Arguments\r\n\ -v arch=i386 slide=0 dart=0 -xcpm darkwake=1 npci=0x2000 cpus=1 debug=0x100 aa\r\n\ BlackList\r\n\ \r\n\ hh\r\n\ \r\n\ CustomLogo\r\n\ Apple\r\n\ Debug\r\n\ \r\n\ DefaultLoader\r\n\ ii\r\n\ DefaultVolume\r\n\ LastBootedVolume\r\n\ DisableCloverHotkeys\r\n\ \r\n\ HibernationFixup\r\n\ \r\n\ Legacy\r\n\ LegacyBiosDefault\r\n\ LegacyBiosDefaultEntry\r\n\ 12\r\n\ NeverDoRecovery\r\n\ \r\n\ NeverHibernate\r\n\ \r\n\ NoEarlyProgress\r\n\ \r\n\ Policy\r\n\ Allow\r\n\ Secure\r\n\ \r\n\ SignatureFixup\r\n\ \r\n\ SkipHibernateTimeout\r\n\ \r\n\ StrictHibernate\r\n\ \r\n\ Timeout\r\n\ 2\r\n\ WhiteList\r\n\ \r\n\ ff\r\n\ gg\r\n\ \r\n\ XMPDetection\r\n\ 1\r\n\ \r\n\ BootGraphics\r\n\ \r\n\ DefaultBackgroundColor\r\n\ 0xF1F1F1\r\n\ EFILoginHiDPI\r\n\ 2\r\n\ UIScale\r\n\ 4\r\n\ flagstate\r\n\ 3\r\n\ \r\n\ CPU\r\n\ \r\n\ BusSpeedkHz\r\n\ 800\r\n\ C2\r\n\ \r\n\ C4\r\n\ \r\n\ C6\r\n\ \r\n\ FrequencyMHz\r\n\ 2000\r\n\ HWPEnable\r\n\ \r\n\ HWPValue\r\n\ 0x7\r\n\ Latency\r\n\ 0x3\r\n\ QEMU\r\n\ \r\n\ QPI\r\n\ 4\r\n\ TDP\r\n\ 6\r\n\ TurboDisable\r\n\ \r\n\ Type\r\n\ 0x5\r\n\ UseARTFrequency\r\n\ \r\n\ \r\n\ Devices\r\n\ \r\n\ AddProperties\r\n\ \r\n\ \r\n\ Device\r\n\ SATA\r\n\ Disabled\r\n\ \r\n\ Key\r\n\ 10\r\n\ Value\r\n\ 11\r\n\ \r\n\ \r\n\ Device\r\n\ LPC\r\n\ Disabled\r\n\ \r\n\ Key\r\n\ 12\r\n\ Value\r\n\ 13\r\n\ \r\n\ \r\n\ Device\r\n\ SmBUS\r\n\ Disabled\r\n\ \r\n\ Key\r\n\ kk\r\n\ Value\r\n\ ll\r\n\ \r\n\ \r\n\ Device\r\n\ Firewire\r\n\ Disabled\r\n\ \r\n\ Key\r\n\ 14\r\n\ Value\r\n\ \r\n\ FQ==\r\n\ \r\n\ \r\n\ \r\n\ AirportBridgeDeviceName\r\n\ airportbridge\r\n\ Arbitrary\r\n\ \r\n\ \r\n\ Comment\r\n\ C1\r\n\ CustomProperties\r\n\ \r\n\ \r\n\ Disabled\r\n\ \r\n\ Key\r\n\ ll\r\n\ Value\r\n\ mm\r\n\ \r\n\ \r\n\ Disabled\r\n\ \r\n\ Key\r\n\ nn\r\n\ Value\r\n\ 1\r\n\ \r\n\ \r\n\ Disabled\r\n\ \r\n\ Key\r\n\ oo\r\n\ Value\r\n\ \r\n\ Ag==\r\n\ \r\n\ \r\n\ \r\n\ PciAddr\r\n\ 00:00.01\r\n\ \r\n\ \r\n\ Audio\r\n\ \r\n\ AFGLowPowerState\r\n\ \r\n\ Inject\r\n\ Detect\r\n\ ResetHDA\r\n\ \r\n\ \r\n\ DisableFunctions\r\n\ 2\r\n\ FakeID\r\n\ \r\n\ ATI\r\n\ 0x22221002\r\n\ IMEI\r\n\ 0x22221002\r\n\ IntelGFX\r\n\ 0x22221002\r\n\ LAN\r\n\ 0x22221002\r\n\ NVidia\r\n\ 0x22221002\r\n\ SATA\r\n\ 0x22221002\r\n\ WIFI\r\n\ 0x22221002\r\n\ XHCI\r\n\ 0x22221002\r\n\ \r\n\ ForceHPET\r\n\ \r\n\ Inject\r\n\ \r\n\ IntelMaxValue\r\n\ 1\r\n\ NoDefaultProperties\r\n\ \r\n\ Properties\r\n\ jj\r\n\ kk\r\n\ SetIntelBacklight\r\n\ \r\n\ SetIntelMaxBacklight\r\n\ \r\n\ USB\r\n\ \r\n\ AddClockID\r\n\ \r\n\ FixOwnership\r\n\ \r\n\ HighCurrent\r\n\ \r\n\ Inject\r\n\ \r\n\ \r\n\ UseIntelHDMI\r\n\ \r\n\ \r\n\ DisableDrivers\r\n\ \r\n\ OsxAptioFixDrv\r\n\ Ps2KeyboardDxe\r\n\ Ps2MouseDxe\r\n\ \r\n\ GUI\r\n\ \r\n\ ConsoleMode\r\n\ Max\r\n\ Custom\r\n\ \r\n\ Entries\r\n\ \r\n\ \r\n\ AddArguments\r\n\ addarg\r\n\ Arguments\r\n\ arg\r\n\ BootBgColor\r\n\ bootbgcolor\r\n\ CustomLogo\r\n\ Apple\r\n\ Disabled\r\n\ \r\n\ DriveImage\r\n\ driveimage\r\n\ Title\r\n\ title\r\n\ FullTitle\r\n\ title\r\n\ Hidden\r\n\ \r\n\ Hotkey\r\n\ H\r\n\ Image\r\n\ image\r\n\ Path\r\n\ path\r\n\ Settings\r\n\ settings\r\n\ SubEntries\r\n\ \r\n\ \r\n\ AddArguments\r\n\ arg2\r\n\ FullTitle\r\n\ title1\r\n\ \r\n\ \r\n\ AddArguments\r\n\ arg3\r\n\ Title\r\n\ title2\r\n\ \r\n\ \r\n\ AddArguments\r\n\ arg4\r\n\ FullTitle\r\n\ title3\r\n\ \r\n\ \r\n\ AddArguments\r\n\ arg5\r\n\ Title\r\n\ title4\r\n\ \r\n\ \r\n\ Type\r\n\ Oldest\r\n\ Volume\r\n\ v1\r\n\ VolumeType\r\n\ Internal\r\n\ \r\n\ \r\n\ Legacy\r\n\ \r\n\ \r\n\ Disabled\r\n\ \r\n\ FullTitle\r\n\ title\r\n\ Hidden\r\n\ \r\n\ Hotkey\r\n\ a\r\n\ Type\r\n\ Windows\r\n\ Volume\r\n\ v2\r\n\ \r\n\ \r\n\ Tool\r\n\ \r\n\ \r\n\ Arguments\r\n\ b\r\n\ Disabled\r\n\ \r\n\ Hidden\r\n\ \r\n\ Hotkey\r\n\ b\r\n\ Path\r\n\ path\r\n\ Title\r\n\ title\r\n\ Volume\r\n\ tool1\r\n\ \r\n\ \r\n\ \r\n\ CustomIcons\r\n\ \r\n\ Hide\r\n\ \r\n\ sdfsdfdf\r\n\ sdfsfdf\r\n\ \r\n\ Language\r\n\ es:0\r\n\ Mouse\r\n\ \r\n\ Enabled\r\n\ \r\n\ Mirror\r\n\ \r\n\ Speed\r\n\ 5\r\n\ \r\n\ Scan\r\n\ \r\n\ Entries\r\n\ \r\n\ Kernel\r\n\ First\r\n\ Legacy\r\n\ First\r\n\ Linux\r\n\ \r\n\ Tool\r\n\ \r\n\ \r\n\ ScreenResolution\r\n\ 1366x768\r\n\ ShowOptimus\r\n\ \r\n\ TextOnly\r\n\ \r\n\ Theme\r\n\ th\r\n\ \r\n\ Graphics\r\n\ \r\n\ ATI\r\n\ \r\n\ \r\n\ IOPCIPrimaryMatch\r\n\ 0x1002888\r\n\ IOPCISubDevId\r\n\ 0x106B\r\n\ LoadVBios\r\n\ \r\n\ Model\r\n\ cc\r\n\ VRAM\r\n\ 2000\r\n\ VideoPorts\r\n\ 3\r\n\ \r\n\ \r\n\ BootDisplay\r\n\ 12\r\n\ DualLink\r\n\ 1\r\n\ EDID\r\n\ \r\n\ Custom\r\n\ \r\n\ AQID\r\n\ \r\n\ Inject\r\n\ \r\n\ ProductID\r\n\ 0x9777\r\n\ VendorID\r\n\ 0x1007\r\n\ \r\n\ FBName\r\n\ Exmoor\r\n\ Inject\r\n\ \r\n\ ATI\r\n\ \r\n\ Intel\r\n\ \r\n\ NVidia\r\n\ \r\n\ \r\n\ LoadVBios\r\n\ \r\n\ NVCAP\r\n\ 0304\r\n\ NVIDIA\r\n\ \r\n\ \r\n\ IOPCIPrimaryMatch\r\n\ 0x10DE999\r\n\ IOPCISubDevId\r\n\ 0x106B\r\n\ LoadVBios\r\n\ \r\n\ Model\r\n\ aa\r\n\ VRAM\r\n\ 1000\r\n\ VideoPorts\r\n\ 1\r\n\ \r\n\ \r\n\ IOPCIPrimaryMatch\r\n\ 0x10DE999\r\n\ IOPCISubDevId\r\n\ 0x106B\r\n\ LoadVBios\r\n\ \r\n\ Model\r\n\ bb\r\n\ VRAM\r\n\ 1000\r\n\ VideoPorts\r\n\ 2\r\n\ \r\n\ \r\n\ NvidiaGeneric\r\n\ \r\n\ NvidiaNoEFI\r\n\ \r\n\ NvidiaSingle\r\n\ \r\n\ PatchVBios\r\n\ \r\n\ PatchVBiosBytes\r\n\ \r\n\ \r\n\ Find\r\n\ \r\n\ AwQF\r\n\ \r\n\ Replace\r\n\ \r\n\ BgcI\r\n\ \r\n\ \r\n\ \r\n\ VRAM\r\n\ 1500\r\n\ VideoPorts\r\n\ 2\r\n\ display-cfg\r\n\ 04\r\n\ ig-platform-id\r\n\ 0x59230000\r\n\ \r\n\ KernelAndKextPatches\r\n\ \r\n\ ATIConnectorsController\r\n\ ATICtl\r\n\ ATIConnectorsData\r\n\ 111213\r\n\ ATIConnectorsPatch\r\n\ 141516\r\n\ AppleIntelCPUPM\r\n\ \r\n\ AppleRTC\r\n\ \r\n\ BootPatches\r\n\ \r\n\ \r\n\ Comment\r\n\ c3\r\n\ Disabled\r\n\ \r\n\ Find\r\n\ \r\n\ MTI=\r\n\ \r\n\ MatchBuild\r\n\ 10.12.6\r\n\ MatchOS\r\n\ 10.12\r\n\ Replace\r\n\ \r\n\ MzQ=\r\n\ \r\n\ \r\n\ \r\n\ Debug\r\n\ \r\n\ DellSMBIOSPatch\r\n\ \r\n\ FakeCPUID\r\n\ 0x0306D0\r\n\ ForceKextsToLoad\r\n\ \r\n\ ForceKext\r\n\ \r\n\ KernelLapic\r\n\ \r\n\ KernelPm\r\n\ \r\n\ KernelToPatch\r\n\ \r\n\ \r\n\ Comment\r\n\ c2\r\n\ Disabled\r\n\ \r\n\ Find\r\n\ \r\n\ ISI=\r\n\ \r\n\ MatchBuild\r\n\ 10.13.6\r\n\ MatchOS\r\n\ 10.13\r\n\ Replace\r\n\ \r\n\ IyQ=\r\n\ \r\n\ \r\n\ \r\n\ KernelXCPM\r\n\ \r\n\ KextsToPatch\r\n\ \r\n\ \r\n\ Comment\r\n\ c1\r\n\ Disabled\r\n\ \r\n\ Find\r\n\ \r\n\ AQ==\r\n\ \r\n\ InfoPlistPatch\r\n\ \r\n\ MatchBuild\r\n\ 10.14.6\r\n\ MatchOS\r\n\ 10.14\r\n\ Name\r\n\ k1\r\n\ Replace\r\n\ \r\n\ Ag==\r\n\ \r\n\ \r\n\ \r\n\ Comment\r\n\ IONVMeFamily IONameMatch\r\n\ Disabled\r\n\ \r\n\ Find\r\n\ \r\n\ PHN0cmluZz5wY2kxNDRkLGE4MDQ8L3N0cmluZz4=\r\n\ \r\n\ InfoPlistPatch\r\n\ \r\n\ Name\r\n\ IONVMeFamily\r\n\ Replace\r\n\ \r\n\ PHN0cmluZz5wY2kxNDRkLGE4MDI8L3N0cmluZz4=\r\n\ \r\n\ \r\n\ \r\n\ \r\n\ RtVariables\r\n\ \r\n\ BooterConfig\r\n\ 0x1\r\n\ CsrActiveConfig\r\n\ 0x2\r\n\ MLB\r\n\ 12345678901234567\r\n\ ROM\r\n\ \r\n\ MBRwYnHo\r\n\ \r\n\ \r\n\ SMBIOS\r\n\ \r\n\ BiosReleaseDate\r\n\ 08/08/17\r\n\ BiosVendor\r\n\ Apple Inc.\r\n\ BiosVersion\r\n\ MBP81.88Z.004D.B00.1708080655\r\n\ Board-ID\r\n\ Mac-94245B3640C91C81\r\n\ BoardManufacturer\r\n\ Apple Inc.\r\n\ BoardSerialNumber\r\n\ W89135306OPDM6CAD\r\n\ BoardType\r\n\ 10\r\n\ BoardVersion\r\n\ 1.0\r\n\ ChassisAssetTag\r\n\ MacBook-Aluminum\r\n\ ChassisManufacturer\r\n\ Apple Inc.\r\n\ ChassisType\r\n\ 0x0A\r\n\ Family\r\n\ MacBook Pro\r\n\ FirmwareFeatures\r\n\ 0xC00DE137\r\n\ FirmwareFeaturesMask\r\n\ 0xFF1FFF3F\r\n\ LocationInChassis\r\n\ Part Component\r\n\ Manufacturer\r\n\ Apple Inc.\r\n\ Memory\r\n\ \r\n\ Channels\r\n\ 2\r\n\ Modules\r\n\ \r\n\ \r\n\ Frequency\r\n\ 333\r\n\ Part\r\n\ Part1\r\n\ Serial\r\n\ Ser1\r\n\ Size\r\n\ 2048\r\n\ Slot\r\n\ 1\r\n\ Type\r\n\ DDR\r\n\ Vendor\r\n\ v1\r\n\ \r\n\ \r\n\ Frequency\r\n\ 366\r\n\ Part\r\n\ Part2\r\n\ Serial\r\n\ Ser2\r\n\ Size\r\n\ 4096\r\n\ Slot\r\n\ 2\r\n\ Type\r\n\ DDR2\r\n\ Vendor\r\n\ v2\r\n\ \r\n\ \r\n\ SlotCount\r\n\ 4\r\n\ \r\n\ Mobile\r\n\ \r\n\ PlatformFeature\r\n\ 0xFFFF\r\n\ ProductName\r\n\ MacBookPro8,1\r\n\ SerialNumber\r\n\ W89G91VFDH2G\r\n\ Slots\r\n\ \r\n\ \r\n\ Device\r\n\ NVidia\r\n\ ID\r\n\ 1\r\n\ Name\r\n\ APPL,sdfsdf\r\n\ Type\r\n\ 1\r\n\ \r\n\ \r\n\ SmUUID\r\n\ F1AB23C0-C35A-473E-BDB7-455C3A6271E8\r\n\ Version\r\n\ 1.0\r\n\ \r\n\ SystemParameters\r\n\ \r\n\ BacklightLevel\r\n\ 2\r\n\ CustomUUID\r\n\ 2926A57C-FF0E-4A64-980F-23483BD41969\r\n\ InjectKexts\r\n\ Yes\r\n\ InjectSystemID\r\n\ \r\n\ NoCaches\r\n\ \r\n\ NvidiaWeb\r\n\ \r\n\ \r\n\ \r\n\ "; static const char* config_test = "\r\n\ \r\n\ \r\n\ \r\n\ ACPIx\r\n\ \r\n\ AutoMerge\r\n\ 0\r\n\ \r\n\ \r\n\ "; #define RETURN_IF_FALSE(Expression) do { bool b = Expression; if ( !b ) return false; } while (0); static int breakpoint(int i) { return i; } int config_plist_tests() { (void)config_all; // int ret; // // const char* tag; // size_t length; // bool isOpeningTag, isClosingTag; bool b; ConfigPlistClass configPlistTest; XmlLiteParser xmlLiteParser; // xmlLiteParser.init(config_all, strlen(config_all)); xmlLiteParser.init(config_test, strlen(config_test)); b = configPlistTest.parse(&xmlLiteParser, LString8("main")); for ( size_t idx = 0 ; idx < xmlLiteParser.getErrorsAndWarnings().size() ; idx++ ) { if ( !xmlLiteParser.getErrorsAndWarnings()[idx].isError) printf("Warning: %s\n", xmlLiteParser.getErrorsAndWarnings()[idx].msg.c_str()); if ( xmlLiteParser.getErrorsAndWarnings()[idx].isError) printf("Error: %s\n", xmlLiteParser.getErrorsAndWarnings()[idx].msg.c_str()); } if ( !b ) { return breakpoint(102); } // if ( !configPlistTest.validate(xmlLiteParser, subXmlPath, pos, generateErrors) ) { return 0; }