Created ABSTRACT_PATCH.

Renamed ForceKexts to ForceKextsToLoad.
Create a copy KPKernelPm, KPAppleIntelCPUPM as they can be modified by
NeedPMfix.
Delete gRemapSmBiosIsRequire, duplicate of Patches->KPDELLSMBIOS
Slight refactor of hex2bin and XMLDecode.
Memory leak in XBuffer.stealValueFrom().
Create XString.strsicat() and stealValueFrom with a size parameter.
This commit is contained in:
jief666 2021-03-25 17:32:56 +03:00
parent 4b0ddf4dee
commit 65f8cc122d
25 changed files with 1096 additions and 389 deletions

View File

@ -5438,13 +5438,13 @@
9A358B3625CF117A00A3850D /* cpp_lib */ = { 9A358B3625CF117A00A3850D /* cpp_lib */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9A4147662604F82900440186 /* undefinable.h */,
9A358B3925CF117A00A3850D /* XmlLiteCompositeTypes.cpp */,
9A358B3C25CF117A00A3850D /* XmlLiteCompositeTypes.h */,
9A358B3A25CF117A00A3850D /* XmlLiteParser.cpp */,
9A358B3725CF117A00A3850D /* XmlLiteParser.h */,
9AD0EB22260A497500093F23 /* XmlLiteSimpleTypes.cpp */, 9AD0EB22260A497500093F23 /* XmlLiteSimpleTypes.cpp */,
9AD0EB23260A497500093F23 /* XmlLiteSimpleTypes.h */, 9AD0EB23260A497500093F23 /* XmlLiteSimpleTypes.h */,
9A4147662604F82900440186 /* undefinable.h */,
9A358B3725CF117A00A3850D /* XmlLiteParser.h */,
9A358B3925CF117A00A3850D /* XmlLiteCompositeTypes.cpp */,
9A358B3A25CF117A00A3850D /* XmlLiteParser.cpp */,
9A358B3C25CF117A00A3850D /* XmlLiteCompositeTypes.h */,
); );
path = cpp_lib; path = cpp_lib;
sourceTree = "<group>"; sourceTree = "<group>";
@ -15793,8 +15793,6 @@
9AFDD05825CE730F00EEAF06 /* cpp_unit_test */ = { 9AFDD05825CE730F00EEAF06 /* cpp_unit_test */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9A0D113625FF583F0040555F /* strcasecmp_test.cpp */,
9A0D113725FF58400040555F /* strcasecmp_test.h */,
9AFDD07125CE730F00EEAF06 /* all_tests.cpp */, 9AFDD07125CE730F00EEAF06 /* all_tests.cpp */,
9AFDD07A25CE730F00EEAF06 /* all_tests.h */, 9AFDD07A25CE730F00EEAF06 /* all_tests.h */,
9A9037E425CFE7D000F14179 /* config-test.cpp */, 9A9037E425CFE7D000F14179 /* config-test.cpp */,
@ -15815,6 +15813,8 @@
9AFDD07625CE730F00EEAF06 /* printf_lite-test.h */, 9AFDD07625CE730F00EEAF06 /* printf_lite-test.h */,
9AFDD06B25CE730F00EEAF06 /* printlib-test.cpp */, 9AFDD06B25CE730F00EEAF06 /* printlib-test.cpp */,
9AFDD07225CE730F00EEAF06 /* printlib-test.h */, 9AFDD07225CE730F00EEAF06 /* printlib-test.h */,
9A0D113625FF583F0040555F /* strcasecmp_test.cpp */,
9A0D113725FF58400040555F /* strcasecmp_test.h */,
9AFDD06A25CE730F00EEAF06 /* strcmp_test.cpp */, 9AFDD06A25CE730F00EEAF06 /* strcmp_test.cpp */,
9AFDD05F25CE730F00EEAF06 /* strcmp_test.h */, 9AFDD05F25CE730F00EEAF06 /* strcmp_test.h */,
9AFDD07B25CE730F00EEAF06 /* strlen_test.cpp */, 9AFDD07B25CE730F00EEAF06 /* strlen_test.cpp */,
@ -15826,6 +15826,7 @@
9AFDD06025CE730F00EEAF06 /* XBuffer_tests.cpp */, 9AFDD06025CE730F00EEAF06 /* XBuffer_tests.cpp */,
9AFDD05E25CE730F00EEAF06 /* XBuffer_tests.h */, 9AFDD05E25CE730F00EEAF06 /* XBuffer_tests.h */,
9A9037E325CFE7CD00F14179 /* xml_lite-test.cpp */, 9A9037E325CFE7CD00F14179 /* xml_lite-test.cpp */,
9A9037E525CFE7D000F14179 /* xml_lite-test.h */,
9AFDD07325CE730F00EEAF06 /* XObjArray_tests.cpp */, 9AFDD07325CE730F00EEAF06 /* XObjArray_tests.cpp */,
9AFDD06D25CE730F00EEAF06 /* XObjArray_tests.h */, 9AFDD06D25CE730F00EEAF06 /* XObjArray_tests.h */,
9AFDD07725CE730F00EEAF06 /* XString_test.cpp */, 9AFDD07725CE730F00EEAF06 /* XString_test.cpp */,
@ -15833,7 +15834,6 @@
9AFDD06C25CE730F00EEAF06 /* XStringArray_test.cpp */, 9AFDD06C25CE730F00EEAF06 /* XStringArray_test.cpp */,
9AFDD06725CE730F00EEAF06 /* XStringArray_test.h */, 9AFDD06725CE730F00EEAF06 /* XStringArray_test.h */,
9AFDD07925CE730F00EEAF06 /* XToolsCommon_test.cpp */, 9AFDD07925CE730F00EEAF06 /* XToolsCommon_test.cpp */,
9A9037E525CFE7D000F14179 /* xml_lite-test.h */,
9AFDD05925CE730F00EEAF06 /* XToolsCommon_test.h */, 9AFDD05925CE730F00EEAF06 /* XToolsCommon_test.h */,
); );
path = cpp_unit_test; path = cpp_unit_test;

View File

@ -812,21 +812,105 @@
<key>KernelToPatch</key> <key>KernelToPatch</key>
<array> <array>
<dict> <dict>
<key>Comment</key> <key>#Comment</key>
<string>c2</string> <string>Disable panic kext logging on 10.14 Release kernel</string>
<key>Disabled</key> <key>Disabled</key>
<true/> <true/>
<key>Find</key> <key>Find</key>
<data> <data>
ISI= igKEwHRC
</data>
<key>MaskFind</key>
<data>
////////
</data>
<key>MaskReplace</key>
<data>
AAAAAP8A
</data>
<key>MatchOS</key>
<string>10.14</string>
<key>Replace</key>
<data>
igKEwOtC
</data>
</dict>
<dict>
<key>Comment</key>
<string>Disable panic kext logging on 10.13 Release kernel</string>
<key>Disabled</key>
<true/>
<key>Find</key>
<data>
igKEwHRE
</data> </data>
<key>MatchBuild</key>
<string>10.13.6</string>
<key>MatchOS</key> <key>MatchOS</key>
<string>10.13</string> <string>10.13</string>
<key>Replace</key> <key>Replace</key>
<data> <data>
IyQ= igKEwOtE
</data>
</dict>
<dict>
<key>Comment</key>
<string>Lapic panic patch example</string>
<key>Disabled</key>
<true/>
<key>Find</key>
<data>
6AAA//+DAAAAAAAA
</data>
<key>MaskFind</key>
<data>
/wAA////AAAAAP//
</data>
<key>MaskReplace</key>
<data>
/wAA////////////
</data>
<key>MaskStart</key>
<data>
/////wA=
</data>
<key>MatchOS</key>
<string>All</string>
<key>RangeFind</key>
<integer>200</integer>
<key>Replace</key>
<data>
6AAA//8xwJCQkJCQ
</data>
<key>StartPattern</key>
<data>
ACnHeAAx241H+oM=
</data>
</dict>
<dict>
<key>Comment</key>
<string>Symbolic patch example got lapic panic</string>
<key>Disabled</key>
<true/>
<key>Find</key>
<data>
6AAA//+DAAAAAAAA
</data>
<key>MaskFind</key>
<data>
/wAA////AAAAAP//
</data>
<key>MaskReplace</key>
<data>
/wAA////////////
</data>
<key>MatchOS</key>
<string>All</string>
<key>Procedure</key>
<string>_lapic_interrupt</string>
<key>RangeFind</key>
<integer>200</integer>
<key>Replace</key>
<data>
6AAA//8xwJCQkJCQ
</data> </data>
</dict> </dict>
</array> </array>
@ -836,24 +920,134 @@
<array> <array>
<dict> <dict>
<key>Comment</key> <key>Comment</key>
<string>c1</string> <string>Enable TRIM for SSD</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
AEFQUExFIFNTRAA=
</data>
<key>InfoPlistPatch</key>
<false/>
<key>Name</key>
<string>com.apple.iokit.IOAHCIBlockStorage</string>
<key>Replace</key>
<data>
AAAAAAAAAAAAAAA=
</data>
</dict>
<dict>
<key>Comment</key>
<string>External icons patch</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
RXh0ZXJuYWw=
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.11.x,10.12.x,10.13.x,10.14.x,10.15.x</string>
<key>Name</key>
<string>com.apple.driver.AppleAHCIPort</string>
<key>Replace</key>
<data>
SW50ZXJuYWw=
</data>
</dict>
<dict>
<key>Comment</key>
<string>framebuffer4K</string>
<key>Disabled</key> <key>Disabled</key>
<true/> <true/>
<key>Find</key> <key>Find</key>
<data> <data>
AQ== AwAiDQADAwMAAAACAAAwAQ==
</data> </data>
<key>InfoPlistPatch</key> <key>InfoPlistPatch</key>
<true/> <false/>
<key>MatchBuild</key>
<string>10.14.6</string>
<key>MatchOS</key>
<string>10.14</string>
<key>Name</key> <key>Name</key>
<string>k1</string> <string>AppleIntelFramebufferAzul</string>
<key>Replace</key> <key>Replace</key>
<data> <data>
Ag== AwAiDQADAwMAAAAEAAAAAw==
</data>
</dict>
<dict>
<key>Comment</key>
<string>Disable NVDARequiredOS</string>
<key>Disabled</key>
<true/>
<key>Find</key>
<data>
TlZEQVJlcXVpcmVkT1MA
</data>
<key>InfoPlistPatch</key>
<false/>
<key>Name</key>
<string>NVDAStartupWeb</string>
<key>Replace</key>
<data>
AAAAAAAAAAAAAAAAAAAA
</data>
</dict>
<dict>
<key>Comment</key>
<string>Disable board-id check to prevent no signal</string>
<key>Disabled</key>
<true/>
<key>Find</key>
<data>
SI01qjQ=
</data>
<key>InfoPlistPatch</key>
<false/>
<key>Name</key>
<string>com.apple.driver.AppleGraphicsDevicePolicy</string>
<key>Replace</key>
<data>
Dx+AAAA=
</data>
</dict>
<dict>
<key>Comment</key>
<string>Prevent AGDP from loading</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
ugUAAAA=
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.15.x</string>
<key>Name</key>
<string>com.apple.driver.AppleGraphicsDevicePolicy</string>
<key>Replace</key>
<data>
ugAAAAA=
</data>
</dict>
<dict>
<key>Comment</key>
<string>Atheros Locale Fix</string>
<key>Disabled</key>
<true/>
<key>Find</key>
<data>
g/g3
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>AirPortAtheros40</string>
<key>Replace</key>
<data>
g/gh
</data> </data>
</dict> </dict>
<dict> <dict>
@ -867,6 +1061,8 @@
</data> </data>
<key>InfoPlistPatch</key> <key>InfoPlistPatch</key>
<true/> <true/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key> <key>Name</key>
<string>IONVMeFamily</string> <string>IONVMeFamily</string>
<key>Replace</key> <key>Replace</key>
@ -874,6 +1070,408 @@
PHN0cmluZz5wY2kxNDRkLGE4MDI8L3N0cmluZz4= PHN0cmluZz5wY2kxNDRkLGE4MDI8L3N0cmluZz4=
</data> </data>
</dict> </dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#1 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
ibPoAgAAweAMBQAQAACJgw==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
ibPoAgAAweAJBQAQAACJgw==
</data>
</dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#2 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
D7aMiIIAAACD+QwPhTIBAA==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
D7aMiIIAAACD+QkPhTIBAA==
</data>
</dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#3 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
AMeDpAAAAAAQAABIi0gISA==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
AMeDpAAAAAACAABIi0gISA==
</data>
</dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#4 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
SYnGTYX2dGFBwecMSWP/vg==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
SYnGTYX2dGFBwecJSWP/vg==
</data>
</dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#5 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
hv8PAABIwegMD7cPgeH/Dw==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
hv8PAABIwegJD7cPgeH/Dw==
</data>
</dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#6_7 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
icGB4f8PAABIAdFIgfn/DwAAdzs=
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
icGB4f8BAABIAdFIgfn/AQAAdzs=
</data>
</dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#8 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
SYHF/w8AAEnB7QxJiwQkSA==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
SYHF/w8AAEnB7QlJiwQkSA==
</data>
</dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#9_10 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
BgIAAEyNuAAQAABMiflIgeEA8P//SYmGGgEAAEmJjiIB
AABBvAAQAABJKfQ=
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
BgIAAEyNuAACAABMiflIgeEA8P//SYmGGgEAAEmJjiIB
AABBvAACAABJKfQ=
</data>
</dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#11 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
AABJiY4iAQAAugAQAABIKQ==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
AABJiY4iAQAAugACAABIKQ==
</data>
</dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#12 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
yAAAAEkp17gAEAAATYskJA==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
yAAAAEkp17gAAgAATYskJA==
</data>
</dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#13 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
4b+AQBUGTYnWugAQAABFMQ==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
4b+AQBUGTYnWugACAABFMQ==
</data>
</dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#14 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
iWTY+EmBxAAQAABJgccA8A==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
iWTY+EmBxAACAABJgccA8A==
</data>
</dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#15 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
Bf8PAABIwegMZvfB/w8PlQ==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
Bf8PAABIwegJZvfB/w8PlQ==
</data>
</dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#16 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
weIIQQ+2wcHgDEQJ0EQJwA==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
weIIQQ+2wcHgCUQJ0EQJwA==
</data>
</dict>
<dict>
<key>Comment</key>
<string>IONVMeFamily Pike R. Alpha Patch#17 (Sierra)</string>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>
RYTJD5XAD7bAweAMRAnYRA==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>IONVMeFamily</string>
<key>Replace</key>
<data>
RYTJD5XAD7bAweAJRAnYRA==
</data>
</dict>
<dict>
<key>Comment</key>
<string>change 15 port limit to 26 in XHCI kext (100-series)</string>
<key>Disabled</key>
<true/>
<key>Find</key>
<data>
g32MEA==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>AppleUSBXHCIPCI</string>
<key>Replace</key>
<data>
g32MGw==
</data>
</dict>
<dict>
<key>Comment</key>
<string>change 15 port limit to 26 in XHCI kext (100-series)</string>
<key>Disabled</key>
<true/>
<key>Find</key>
<data>
g710////EA==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.x</string>
<key>Name</key>
<string>AppleUSBXHCISPT</string>
<key>Replace</key>
<data>
g710////Gw==
</data>
</dict>
<dict>
<key>Comment</key>
<string>15 to 20 port limit (9-series)</string>
<key>Disabled</key>
<true/>
<key>Find</key>
<data>
g710////EA==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.6</string>
<key>Name</key>
<string>AppleUSBXHCIPCI</string>
<key>Replace</key>
<data>
g710////FQ==
</data>
</dict>
<dict>
<key>Comment</key>
<string>15 to 26 port limit (100-series)</string>
<key>Disabled</key>
<true/>
<key>Find</key>
<data>
g710////EA==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.12.6</string>
<key>Name</key>
<string>AppleUSBXHCIPCI</string>
<key>Replace</key>
<data>
g710////Gw==
</data>
</dict>
<dict>
<key>Comment</key>
<string>USB 10.13.6 by PMHeart</string>
<key>Disabled</key>
<true/>
<key>Find</key>
<data>
g32IDw+DpwQAAA==
</data>
<key>InfoPlistPatch</key>
<false/>
<key>MatchOS</key>
<string>10.13.6</string>
<key>Name</key>
<string>com.apple.driver.usb.AppleUSBXHCI</string>
<key>Replace</key>
<data>
g32ID5CQkJCQkA==
</data>
</dict>
</array> </array>
</dict> </dict>
<key>RtVariables</key> <key>RtVariables</key>

View File

@ -112,6 +112,12 @@ extern "C" int main(int argc, const char * argv[])
(void)argv; (void)argv;
setlocale(LC_ALL, "en_US"); // to allow printf unicode char setlocale(LC_ALL, "en_US"); // to allow printf unicode char
char buf[] = { 'a', '\xef', '\xbb', '\xbf', 'b', 0};
XString8 s5 = S8Printf("01234567890123456789");
s5.S8Printf("%s", buf);
//const char* buf2 = s5.c_str();
xcode_utf_fixed_tests(); xcode_utf_fixed_tests();

View File

@ -333,10 +333,10 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
// Download-Fritz: Do not mess with BacklightLevel; it's OS X's business // Download-Fritz: Do not mess with BacklightLevel; it's OS X's business
if (gMobile) { if (gMobile) {
if (gSettings.BacklightLevelConfig) { if (gSettings.SystemParameters.BacklightLevelConfig) {
SetNvramVariable(L"backlight-level", &gEfiAppleBootGuid, Attributes, sizeof(gSettings.BacklightLevel), &gSettings.BacklightLevel); SetNvramVariable(L"backlight-level", &gEfiAppleBootGuid, Attributes, sizeof(gSettings.SystemParameters.BacklightLevel), &gSettings.SystemParameters.BacklightLevel);
} else { } else {
AddNvramVariable(L"backlight-level", &gEfiAppleBootGuid, Attributes, sizeof(gSettings.BacklightLevel), &gSettings.BacklightLevel); AddNvramVariable(L"backlight-level", &gEfiAppleBootGuid, Attributes, sizeof(gSettings.SystemParameters.BacklightLevel), &gSettings.SystemParameters.BacklightLevel);
} }
} }
@ -388,7 +388,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
} else { } else {
DeleteNvramVariable(L"bootercfg", &gEfiAppleBootGuid); DeleteNvramVariable(L"bootercfg", &gEfiAppleBootGuid);
} }
if (gSettings.NvidiaWeb) { if (gSettings.SystemParameters.NvidiaWeb) {
NvidiaWebValue = "1"; NvidiaWebValue = "1";
SetNvramVariable(L"nvda_drv", &gEfiAppleBootGuid, Attributes, 2, (void*)NvidiaWebValue); SetNvramVariable(L"nvda_drv", &gEfiAppleBootGuid, Attributes, 2, (void*)NvidiaWebValue);
} else { } else {

View File

@ -8,7 +8,7 @@
#include "KERNEL_AND_KEXT_PATCHES.h" #include "KERNEL_AND_KEXT_PATCHES.h"
#include "MacOsVersion.h" #include "MacOsVersion.h"
bool KEXT_PATCH::IsPatchEnabledByBuildNumber(const XString8& Build) bool ABSTRACT_PATCH::IsPatchEnabledByBuildNumber(const XString8& Build)
{ {
BOOLEAN ret = FALSE; BOOLEAN ret = FALSE;
@ -35,7 +35,7 @@ bool KEXT_PATCH::IsPatchEnabledByBuildNumber(const XString8& Build)
} }
bool KEXT_PATCH::IsPatchEnabled(const MacOsVersion& CurrOS) bool ABSTRACT_PATCH::IsPatchEnabled(const MacOsVersion& CurrOS)
{ {
BOOLEAN ret = FALSE; BOOLEAN ret = FALSE;

View File

@ -17,32 +17,26 @@ extern "C" {
} }
class KEXT_PATCH class ABSTRACT_PATCH
{ {
public: public:
XString8 Name; bool Disabled = bool();
XString8 Label; // XString8 Comment = XString8();
BOOLEAN IsPlistPatch; XBuffer<UINT8> Data = XBuffer<UINT8> ();
XBuffer<UINT8> Data; XBuffer<UINT8> Patch = XBuffer<UINT8> ();
XBuffer<UINT8> Patch; XBuffer<UINT8> MaskFind = XBuffer<UINT8> ();
XBuffer<UINT8> MaskFind; XBuffer<UINT8> MaskReplace = XBuffer<UINT8> ();
XBuffer<UINT8> MaskReplace; XBuffer<UINT8> StartPattern = XBuffer<UINT8> ();
XBuffer<UINT8> StartPattern; XBuffer<UINT8> StartMask = XBuffer<UINT8> ();
XBuffer<UINT8> StartMask; INTN SearchLen = INTN();
INTN SearchLen; INTN Count = INTN();
XString8 ProcedureName; //procedure len will be StartPatternLen INTN Skip = INTN();
INTN Count; XString8 MatchOS = XString8();
INTN Skip; XString8 MatchBuild = XString8();
XString8 MatchOS;
XString8 MatchBuild;
INPUT_ITEM MenuItem = INPUT_ITEM();
KEXT_PATCH() : Name(), Label(), IsPlistPatch(0), Data(), Patch(), MaskFind(), MaskReplace(), // Computed
StartPattern(), StartMask(), SearchLen(0), ProcedureName(), Count(-1), Skip(0), MatchOS(), MatchBuild() XString8 Name = XString8();
{ } XString8 Label = XString8(); // TODO : it's a calculated value from comment field.
KEXT_PATCH(const KEXT_PATCH& other) = default; // default is fine if there is only native type and objects that have copy ctor
KEXT_PATCH& operator = ( const KEXT_PATCH & ) = default; // default is fine if there is only native type and objects that have copy ctor
~KEXT_PATCH() {}
/** Returns a boolean and then enable disable the patch if MachOSEntry have a match for the booted OS. */ /** Returns a boolean and then enable disable the patch if MachOSEntry have a match for the booted OS. */
bool IsPatchEnabledByBuildNumber(const XString8& Build); bool IsPatchEnabledByBuildNumber(const XString8& Build);
@ -50,74 +44,55 @@ public:
}; };
class ABSTRACT_KEXT_OR_KERNEL_PATCH : public ABSTRACT_PATCH
{
public:
bool IsPlistPatch = BOOLEAN();
XString8 ProcedureName = XString8(); //procedure len will be StartPatternLen
INPUT_ITEM MenuItem = INPUT_ITEM();
};
class KEXT_PATCH : public ABSTRACT_KEXT_OR_KERNEL_PATCH
{
public:
bool IsPlistPatch = BOOLEAN();
INPUT_ITEM MenuItem = INPUT_ITEM();
};
class KERNEL_PATCH : public ABSTRACT_KEXT_OR_KERNEL_PATCH
{
public:
INPUT_ITEM MenuItem = INPUT_ITEM();
};
class BOOT_PATCH : public ABSTRACT_PATCH
{
public:
INPUT_ITEM MenuItem = INPUT_ITEM();
};
class KERNEL_AND_KEXT_PATCHES class KERNEL_AND_KEXT_PATCHES
{ {
public: public:
BOOLEAN FuzzyMatch; bool KPDebug = bool();
XString8 OcKernelCache; bool KPKernelLapic = bool();
OC_KERNEL_QUIRKS OcKernelQuirks; bool KPKernelXCPM = bool();
BOOLEAN KPDebug; bool _KPKernelPm = bool();
// BOOLEAN KPKernelCpu; bool KPPanicNoKextDump = bool();
BOOLEAN KPKernelLapic; bool _KPAppleIntelCPUPM = bool();
BOOLEAN KPKernelXCPM; bool KPAppleRTC = bool();
BOOLEAN KPKernelPm; bool EightApple = bool();
BOOLEAN KPAppleIntelCPUPM; bool KPDELLSMBIOS = bool(); // Dell SMBIOS patch
BOOLEAN KPAppleRTC; UINT32 FakeCPUID = UINT32();
BOOLEAN KPDELLSMBIOS; // Dell SMBIOS patch XString8 KPATIConnectorsController = XString8();
BOOLEAN KPPanicNoKextDump; XBuffer<UINT8> KPATIConnectorsData = XBuffer<UINT8>();
BOOLEAN EightApple; XBuffer<UINT8> KPATIConnectorsPatch = XBuffer<UINT8>();
UINT8 pad[7]; XStringWArray ForceKextsToLoad = XStringWArray();
UINT32 FakeCPUID; XObjArray<KEXT_PATCH> KextPatches = XObjArray<KEXT_PATCH>();
// UINT32 align0; XObjArray<KERNEL_PATCH> KernelPatches = XObjArray<KERNEL_PATCH>();
XString8 KPATIConnectorsController; XObjArray<BOOT_PATCH> BootPatches = XObjArray<BOOT_PATCH>();
#if defined(MDE_CPU_IA32)
UINT32 align1;
#endif
XBuffer<UINT8> KPATIConnectorsData;
#if defined(MDE_CPU_IA32)
UINT32 align2;
#endif
#if defined(MDE_CPU_IA32)
UINT32 align3;
#endif
XBuffer<UINT8> KPATIConnectorsPatch;
#if defined(MDE_CPU_IA32)
UINT32 align4;
#endif
// INT32 NrKexts;
UINT32 align40;
XObjArray<KEXT_PATCH> KextPatches;
#if defined(MDE_CPU_IA32)
UINT32 align5;
#endif
// INT32 NrForceKexts;
UINT32 align50;
// CHAR16 **ForceKexts;
XStringWArray ForceKexts;
#if defined(MDE_CPU_IA32)
UINT32 align6;
#endif
// INT32 NrKernels;
XObjArray<KEXT_PATCH> KernelPatches;
// INT32 NrBoots;
XObjArray<KEXT_PATCH> BootPatches;
KERNEL_AND_KEXT_PATCHES() : FuzzyMatch(0), OcKernelCache(), OcKernelQuirks{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, KPDebug(0), KPKernelLapic(0), KPKernelXCPM(0), KPKernelPm(0), KPAppleIntelCPUPM(0), KPAppleRTC(0), KPDELLSMBIOS(0), KPPanicNoKextDump(0),
EightApple(0), pad{0}, FakeCPUID(0), KPATIConnectorsController(0), KPATIConnectorsData(),
KPATIConnectorsPatch(), align40(0), KextPatches(), align50(0), ForceKexts(),
KernelPatches(), BootPatches()
{ }
KERNEL_AND_KEXT_PATCHES(const KERNEL_AND_KEXT_PATCHES& other) = default; // Can be defined if needed
KERNEL_AND_KEXT_PATCHES& operator = ( const KERNEL_AND_KEXT_PATCHES & ) = default; // Can be defined if needed
~KERNEL_AND_KEXT_PATCHES() {}
// /** Returns a boolean and then enable disable the patch if MachOSEntry have a match for the booted OS. */
// bool IsPatchEnabledByBuildNumber(const XString8& Build);
} ; } ;

View File

@ -103,7 +103,7 @@ UINT16 gBacklightLevel;
BOOLEAN GetLegacyLanAddress; BOOLEAN GetLegacyLanAddress;
BOOLEAN ResumeFromCoreStorage; BOOLEAN ResumeFromCoreStorage;
BOOLEAN gRemapSmBiosIsRequire; //BOOLEAN gRemapSmBiosIsRequire;
// QPI // QPI
//BOOLEAN SetTable132 = FALSE; //BOOLEAN SetTable132 = FALSE;
@ -586,7 +586,7 @@ static UINT8
// assume data in hex encoded string property // assume data in hex encoded string property
UINT32 Len = (UINT32)Prop->getString()->stringValue().length() >> 1; // number of hex digits UINT32 Len = (UINT32)Prop->getString()->stringValue().length() >> 1; // number of hex digits
Data = (__typeof__(Data))AllocateZeroPool(Len); // 2 chars per byte, one more byte for odd number Data = (__typeof__(Data))AllocateZeroPool(Len); // 2 chars per byte, one more byte for odd number
Len = hex2bin(Prop->getString()->stringValue().c_str(), Data, Len); Len = hex2bin(Prop->getString()->stringValue(), Data, Len);
if (DataLen != NULL) *DataLen = Len; if (DataLen != NULL) *DataLen = Len;
/* /*
@ -879,7 +879,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
Prop = DictPointer->propertyForKey("KernelPm"); Prop = DictPointer->propertyForKey("KernelPm");
if (Prop != NULL || GlobalConfig.gBootChanged) { if (Prop != NULL || GlobalConfig.gBootChanged) {
Patches->KPKernelPm = IsPropertyNotNullAndTrue(Prop); Patches->_KPKernelPm = IsPropertyNotNullAndTrue(Prop);
} }
Prop = DictPointer->propertyForKey("PanicNoKextDump"); Prop = DictPointer->propertyForKey("PanicNoKextDump");
@ -889,13 +889,13 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
Prop = DictPointer->propertyForKey("AppleIntelCPUPM"); Prop = DictPointer->propertyForKey("AppleIntelCPUPM");
if (Prop != NULL || GlobalConfig.gBootChanged) { if (Prop != NULL || GlobalConfig.gBootChanged) {
Patches->KPAppleIntelCPUPM = IsPropertyNotNullAndTrue(Prop); Patches->_KPAppleIntelCPUPM = IsPropertyNotNullAndTrue(Prop);
}
//anyway
if (GlobalConfig.NeedPMfix) {
Patches->KPKernelPm = TRUE;
Patches->KPAppleIntelCPUPM = TRUE;
} }
// //anyway
// if (GlobalConfig.NeedPMfix) {
// Patches->KPKernelPm = TRUE;
// Patches->KPAppleIntelCPUPM = TRUE;
// }
Prop = DictPointer->propertyForKey("AppleRTC"); Prop = DictPointer->propertyForKey("AppleRTC");
if (Prop != NULL || GlobalConfig.gBootChanged) { if (Prop != NULL || GlobalConfig.gBootChanged) {
@ -915,7 +915,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
// but the major target is to make code clean // but the major target is to make code clean
Prop = DictPointer->propertyForKey("DellSMBIOSPatch"); Prop = DictPointer->propertyForKey("DellSMBIOSPatch");
Patches->KPDELLSMBIOS = IsPropertyNotNullAndTrue(Prop); // default == FALSE Patches->KPDELLSMBIOS = IsPropertyNotNullAndTrue(Prop); // default == FALSE
gRemapSmBiosIsRequire = Patches->KPDELLSMBIOS; // gRemapSmBiosIsRequire = Patches->KPDELLSMBIOS;
Prop = DictPointer->propertyForKey("FakeCPUID"); Prop = DictPointer->propertyForKey("FakeCPUID");
if (Prop != NULL || GlobalConfig.gBootChanged) { if (Prop != NULL || GlobalConfig.gBootChanged) {
@ -937,15 +937,13 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
if (Patches->KPATIConnectorsData.isEmpty() if (Patches->KPATIConnectorsData.isEmpty()
|| Patches->KPATIConnectorsPatch.isEmpty() || Patches->KPATIConnectorsPatch.isEmpty()
|| Patches->KPATIConnectorsData.size() == 0 || Patches->KPATIConnectorsData.size() != Patches->KPATIConnectorsPatch.size()) {
|| Patches->KPATIConnectorsData.size() != i) {
// invalid params - no patching // invalid params - no patching
DBG("ATIConnectors patch: invalid parameters!\n"); DBG("ATIConnectors patch: invalid parameters!\n");
Patches->KPATIConnectorsController.setEmpty(); Patches->KPATIConnectorsController.setEmpty();
Patches->KPATIConnectorsData.setEmpty(); Patches->KPATIConnectorsData.setEmpty();
Patches->KPATIConnectorsPatch.setEmpty(); Patches->KPATIConnectorsPatch.setEmpty();
Patches->KPATIConnectorsController.setEmpty();
} }
} }
@ -975,8 +973,8 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
} }
if (strlen(p) > 1) { if (strlen(p) > 1) {
Patches->ForceKexts.Add(p); Patches->ForceKextsToLoad.Add(p);
DBG(" - [%zu]: %ls\n", Patches->ForceKexts.size(), Patches->ForceKexts[Patches->ForceKexts.size()-1].wc_str()); DBG(" - [%zu]: %ls\n", Patches->ForceKextsToLoad.size(), Patches->ForceKextsToLoad[Patches->ForceKextsToLoad.size()-1].wc_str());
} }
} }
} }
@ -1013,26 +1011,27 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
continue; continue;
} }
KEXT_PATCH* newPatchPtr = new KEXT_PATCH(); KEXT_PATCH* newKextPatchPtr = new KEXT_PATCH();
KEXT_PATCH& newPatch = *newPatchPtr; KEXT_PATCH& newKextPatch = *newKextPatchPtr;
newPatch.Name = Dict->getString()->stringValue(); newKextPatch.Name = Dict->getString()->stringValue();
newPatch.Label.takeValueFrom(newPatch.Name); newKextPatch.Label.takeValueFrom(newKextPatch.Name);
Dict = Prop2->propertyForKey("Comment"); Dict = Prop2->propertyForKey("Comment");
if (Dict != NULL) { if (Dict != NULL) {
newPatch.Label += " ("; newKextPatch.Label += " (";
newPatch.Label += Dict->getString()->stringValue(); newKextPatch.Label += Dict->getString()->stringValue();
newPatch.Label += ")"; newKextPatch.Label += ")";
} else { } else {
newPatch.Label += " (NoLabel)"; newKextPatch.Label += " (NoLabel)";
} }
DBG(" %s", newPatch.Label.c_str()); DBG(" %s", newKextPatch.Label.c_str());
// newPatch.MenuItem.BValue = TRUE; // newPatch.MenuItem.BValue = TRUE;
Dict = Prop2->propertyForKey("Disabled"); Dict = Prop2->propertyForKey("Disabled");
newPatch.MenuItem.BValue = !IsPropertyNotNullAndTrue(Dict); //if absent then false, BValue = !Disabled newKextPatch.Disabled = IsPropertyNotNullAndTrue(Dict); //if absent then false, BValue = !Disabled
newKextPatch.MenuItem.BValue = !IsPropertyNotNullAndTrue(Dict); //if absent then false, BValue = !Disabled
// if ((Dict != NULL) && IsPropertyNotNullAndTrue(Dict)) { // if ((Dict != NULL) && IsPropertyNotNullAndTrue(Dict)) {
// newPatch.MenuItem.BValue = FALSE; // newPatch.MenuItem.BValue = FALSE;
@ -1040,22 +1039,22 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
Dict = Prop2->propertyForKey("RangeFind"); Dict = Prop2->propertyForKey("RangeFind");
newPatch.SearchLen = GetPropertyAsInteger(Dict, 0); //default 0 will be calculated later newKextPatch.SearchLen = GetPropertyAsInteger(Dict, 0); //default 0 will be calculated later
Dict = Prop2->propertyForKey("Skip"); Dict = Prop2->propertyForKey("Skip");
newPatch.Skip = GetPropertyAsInteger(Dict, 0); //default 0 will be calculated later newKextPatch.Skip = GetPropertyAsInteger(Dict, 0); //default 0 will be calculated later
UINT8* TmpData = GetDataSetting(Prop2, "StartPattern", &FindLen); UINT8* TmpData = GetDataSetting(Prop2, "StartPattern", &FindLen);
if (TmpData != NULL) { if (TmpData != NULL) {
newPatch.StartPattern.stealValueFrom(TmpData, FindLen); newKextPatch.StartPattern.stealValueFrom(TmpData, FindLen);
} }
TmpData = GetDataSetting (Prop2, "MaskStart", &ReplaceLen); TmpData = GetDataSetting (Prop2, "MaskStart", &ReplaceLen);
ReplaceLen = MIN(ReplaceLen, FindLen); ReplaceLen = MIN(ReplaceLen, FindLen);
if (FindLen != 0) { if (FindLen != 0) {
newPatch.StartMask.memset(0xFF, FindLen); newKextPatch.StartMask.memset(0xFF, FindLen);
if (TmpData != NULL) { if (TmpData != NULL) {
newPatch.StartMask.ncpy(TmpData, ReplaceLen); newKextPatch.StartMask.ncpy(TmpData, ReplaceLen);
} }
} }
if (TmpData != NULL) { if (TmpData != NULL) {
@ -1073,28 +1072,28 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
Dict = Prop2->propertyForKey("Procedure"); Dict = Prop2->propertyForKey("Procedure");
if ( Dict != NULL ) { if ( Dict != NULL ) {
if ( Dict->isString() ) { if ( Dict->isString() ) {
newPatch.ProcedureName = Dict->getString()->stringValue(); newKextPatch.ProcedureName = Dict->getString()->stringValue();
}else{ }else{
MsgLog("ATTENTION : Procedure property not string in KextsToPatch\n"); MsgLog("ATTENTION : Procedure property not string in KextsToPatch\n");
} }
} }
newPatch.Data.stealValueFrom(TmpData, FindLen); newKextPatch.Data.stealValueFrom(TmpData, FindLen);
TmpData = GetDataSetting (Prop2, "MaskFind", &MaskLen); TmpData = GetDataSetting (Prop2, "MaskFind", &MaskLen);
MaskLen = (MaskLen > FindLen)? FindLen : MaskLen; MaskLen = (MaskLen > FindLen)? FindLen : MaskLen;
if (TmpData == NULL || MaskLen == 0) { if (TmpData == NULL || MaskLen == 0) {
} else { } else {
newPatch.MaskFind.memset(0xFF, FindLen); newKextPatch.MaskFind.memset(0xFF, FindLen);
newPatch.MaskFind.ncpy(TmpData, MaskLen); newKextPatch.MaskFind.ncpy(TmpData, MaskLen);
} }
FreePool(TmpData); FreePool(TmpData);
// take into account a possibility to set ReplaceLen < FindLen. In this case assumes MaskReplace = 0 for the rest of bytes // take into account a possibility to set ReplaceLen < FindLen. In this case assumes MaskReplace = 0 for the rest of bytes
newPatch.Patch.memset(0, FindLen); newKextPatch.Patch.memset(0, FindLen);
ReplaceLen = MIN(ReplaceLen, FindLen); ReplaceLen = MIN(ReplaceLen, FindLen);
newPatch.Patch.ncpy(TmpPatch, ReplaceLen); newKextPatch.Patch.ncpy(TmpPatch, ReplaceLen);
FreePool(TmpPatch); FreePool(TmpPatch);
MaskLen = 0; MaskLen = 0;
@ -1102,45 +1101,45 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
MaskLen = MIN(ReplaceLen, MaskLen); MaskLen = MIN(ReplaceLen, MaskLen);
if (TmpData == NULL || MaskLen == 0) { if (TmpData == NULL || MaskLen == 0) {
} else { } else {
newPatch.MaskReplace.memset(0, FindLen); newKextPatch.MaskReplace.memset(0, FindLen);
newPatch.MaskReplace.ncpy(TmpData, MaskLen); //other bytes are zeros, means no replace newKextPatch.MaskReplace.ncpy(TmpData, MaskLen); //other bytes are zeros, means no replace
} }
FreePool(TmpData); FreePool(TmpData);
newPatch.Count = 1; newKextPatch.Count = 1;
Dict = Prop2->propertyForKey("Count"); Dict = Prop2->propertyForKey("Count");
if (Dict != NULL) { if (Dict != NULL) {
newPatch.Count = GetPropertyAsInteger(Dict, 1); newKextPatch.Count = GetPropertyAsInteger(Dict, 1);
} }
// check enable/disabled patch (OS based) by Micky1979 // check enable/disabled patch (OS based) by Micky1979
Dict = Prop2->propertyForKey("MatchOS"); Dict = Prop2->propertyForKey("MatchOS");
if ((Dict != NULL) && (Dict->isString())) { if ((Dict != NULL) && (Dict->isString())) {
newPatch.MatchOS = Dict->getString()->stringValue(); newKextPatch.MatchOS = Dict->getString()->stringValue();
DBG(" :: MatchOS: %s", newPatch.MatchOS.c_str()); DBG(" :: MatchOS: %s", newKextPatch.MatchOS.c_str());
} }
Dict = Prop2->propertyForKey("MatchBuild"); Dict = Prop2->propertyForKey("MatchBuild");
if ((Dict != NULL) && (Dict->isString())) { if ((Dict != NULL) && (Dict->isString())) {
newPatch.MatchBuild = Dict->getString()->stringValue(); newKextPatch.MatchBuild = Dict->getString()->stringValue();
DBG(" :: MatchBuild: %s", newPatch.MatchBuild.c_str()); DBG(" :: MatchBuild: %s", newKextPatch.MatchBuild.c_str());
} }
// check if this is Info.plist patch or kext binary patch // check if this is Info.plist patch or kext binary patch
Dict = Prop2->propertyForKey("InfoPlistPatch"); Dict = Prop2->propertyForKey("InfoPlistPatch");
newPatch.IsPlistPatch = IsPropertyNotNullAndTrue(Dict); newKextPatch.IsPlistPatch = IsPropertyNotNullAndTrue(Dict);
if (newPatch.IsPlistPatch) { if (newKextPatch.IsPlistPatch) {
DBG(" :: PlistPatch"); DBG(" :: PlistPatch");
} else { } else {
DBG(" :: BinPatch"); DBG(" :: BinPatch");
} }
DBG(" :: data len: %zu\n", newPatch.Data.size()); DBG(" :: data len: %zu\n", newKextPatch.Data.size());
if (!newPatch.MenuItem.BValue) { if (!newKextPatch.MenuItem.BValue) {
DBG(" - patch disabled at config\n"); DBG(" patch disabled at config\n");
} }
Patches->KextPatches.AddReference(newPatchPtr, true); Patches->KextPatches.AddReference(newKextPatchPtr, true);
} }
} }
@ -1171,8 +1170,8 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
DBG(" - [%02lld]:", i); DBG(" - [%02lld]:", i);
KEXT_PATCH* newKernelPatchPtr = new KEXT_PATCH; KERNEL_PATCH* newKernelPatchPtr = new KERNEL_PATCH;
KEXT_PATCH& newKernelPatch = *newKernelPatchPtr; KERNEL_PATCH& newKernelPatch = *newKernelPatchPtr;
newKernelPatch.Label = "NoLabel"_XS8; newKernelPatch.Label = "NoLabel"_XS8;
prop3 = Prop2->propertyForKey("Comment"); prop3 = Prop2->propertyForKey("Comment");
@ -1188,6 +1187,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
newKernelPatch.Name = "kernel"_XS8; newKernelPatch.Name = "kernel"_XS8;
prop3 = Prop2->propertyForKey("Disabled"); prop3 = Prop2->propertyForKey("Disabled");
newKernelPatch.Disabled = IsPropertyNotNullAndTrue(prop3);
newKernelPatch.MenuItem.BValue = !IsPropertyNotNullAndTrue(prop3); newKernelPatch.MenuItem.BValue = !IsPropertyNotNullAndTrue(prop3);
prop3 = Prop2->propertyForKey("RangeFind"); prop3 = Prop2->propertyForKey("RangeFind");
@ -1303,8 +1303,8 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
DBG(" - [%02lld]:", i); DBG(" - [%02lld]:", i);
KEXT_PATCH* newBootPatchPtr = new KEXT_PATCH; BOOT_PATCH* newBootPatchPtr = new BOOT_PATCH;
KEXT_PATCH& newBootPatch = *newBootPatchPtr; BOOT_PATCH& newBootPatch = *newBootPatchPtr;
newBootPatch.Label = "NoLabel"_XS8; newBootPatch.Label = "NoLabel"_XS8;
prop3 = Prop2->propertyForKey("Comment"); prop3 = Prop2->propertyForKey("Comment");
@ -1320,6 +1320,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
newBootPatch.Name = "boot.efi"_XS8; newBootPatch.Name = "boot.efi"_XS8;
prop3 = Prop2->propertyForKey("Disabled"); prop3 = Prop2->propertyForKey("Disabled");
newBootPatch.Disabled = IsPropertyNotNullAndTrue(prop3);
newBootPatch.MenuItem.BValue = !IsPropertyNotNullAndTrue(prop3); newBootPatch.MenuItem.BValue = !IsPropertyNotNullAndTrue(prop3);
newBootPatch.MenuItem.ItemType = BoolValue; newBootPatch.MenuItem.ItemType = BoolValue;
@ -1763,7 +1764,7 @@ FillinCustomSubEntry (
Entry->m_NoCaches = true; Entry->m_NoCaches = true;
} else { } else {
// Use global settings // Use global settings
if (gSettings.NoCaches) { if (gSettings.SystemParameters.NoCaches) {
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NOCACHES); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NOCACHES);
Entry->m_NoCaches = false; Entry->m_NoCaches = false;
} }
@ -2094,10 +2095,10 @@ FillinCustomEntry (
} else { } else {
Entry->InjectKexts = -1; Entry->InjectKexts = -1;
// Use global settings // Use global settings
if (gSettings.WithKexts) { if (gSettings.SystemParameters.WithKexts) {
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS);
} }
if (gSettings.WithKextsIfNoFakeSMC) { if (gSettings.SystemParameters.WithKextsIfNoFakeSMC) {
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_CHECKFAKESMC); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_CHECKFAKESMC);
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS);
} }
@ -2113,7 +2114,7 @@ FillinCustomEntry (
Entry->NoCaches = true; Entry->NoCaches = true;
} else { } else {
// Use global settings // Use global settings
if (gSettings.NoCaches) { if (gSettings.SystemParameters.NoCaches) {
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NOCACHES); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NOCACHES);
} }
} }
@ -2759,25 +2760,25 @@ EFI_STATUS GetEarlyUserSettings (
} }
//*** SYSTEM *** //*** SYSTEM ***
gSettings.WithKexts = TRUE; //default gSettings.SystemParameters.WithKexts = TRUE; //default
const TagDict* SystemParametersDict = CfgDict->dictPropertyForKey("SystemParameters"); const TagDict* SystemParametersDict = CfgDict->dictPropertyForKey("SystemParameters");
if (SystemParametersDict != NULL) { if (SystemParametersDict != NULL) {
// Inject kexts // Inject kexts
const TagStruct* Prop = SystemParametersDict->propertyForKey("InjectKexts"); const TagStruct* Prop = SystemParametersDict->propertyForKey("InjectKexts");
if (Prop != NULL) { if (Prop != NULL) {
if (IsPropertyNotNullAndTrue(Prop)) { if (IsPropertyNotNullAndTrue(Prop)) {
gSettings.WithKexts = TRUE; gSettings.SystemParameters.WithKexts = TRUE;
} else if ((Prop->isString()) && } else if ((Prop->isString()) &&
(Prop->getString()->stringValue().equalIC("Detect"))) { (Prop->getString()->stringValue().equalIC("Detect"))) {
// settingsData.WithKexts = TRUE; // settingsData.WithKexts = TRUE;
gSettings.WithKextsIfNoFakeSMC = TRUE; gSettings.SystemParameters.WithKextsIfNoFakeSMC = TRUE;
} }
} }
// No caches - obsolete // No caches - obsolete
Prop = SystemParametersDict->propertyForKey("NoCaches"); Prop = SystemParametersDict->propertyForKey("NoCaches");
if (IsPropertyNotNullAndTrue(Prop)) { if (IsPropertyNotNullAndTrue(Prop)) {
gSettings.NoCaches = TRUE; gSettings.SystemParameters.NoCaches = TRUE;
} }
//test float - success //test float - success
// Prop = SystemParametersDict->propertyForKey("BlueValue"); // Prop = SystemParametersDict->propertyForKey("BlueValue");
@ -3088,6 +3089,14 @@ EFI_STATUS GetEarlyUserSettings (
} }
} }
} }
//done until here
const TagDict* GraphicsDict = CfgDict->dictPropertyForKey("Graphics"); const TagDict* GraphicsDict = CfgDict->dictPropertyForKey("Graphics");
if (GraphicsDict != NULL) { if (GraphicsDict != NULL) {
@ -3299,20 +3308,20 @@ EFI_STATUS GetEarlyUserSettings (
Prop = OcQuirksDict->propertyForKey("FuzzyMatch"); Prop = OcQuirksDict->propertyForKey("FuzzyMatch");
if (Prop != NULL || GlobalConfig.gBootChanged) { if (Prop != NULL || GlobalConfig.gBootChanged) {
gSettings.KernelAndKextPatches.FuzzyMatch = !IsPropertyNotNullAndFalse(Prop); gSettings.Quirks.FuzzyMatch = !IsPropertyNotNullAndFalse(Prop);
} }
Prop = OcQuirksDict->propertyForKey("KernelCache"); Prop = OcQuirksDict->propertyForKey("KernelCache");
if (Prop != NULL || GlobalConfig.gBootChanged) { if (Prop != NULL || GlobalConfig.gBootChanged) {
if ( Prop->isString() ) { if ( Prop->isString() ) {
if ( Prop->getString()->stringValue().notEmpty() ) { if ( Prop->getString()->stringValue().notEmpty() ) {
gSettings.KernelAndKextPatches.OcKernelCache = Prop->getString()->stringValue(); gSettings.Quirks.OcKernelCache = Prop->getString()->stringValue();
}else{ }else{
gSettings.KernelAndKextPatches.OcKernelCache = "Auto"_XS8; gSettings.Quirks.OcKernelCache = "Auto"_XS8;
} }
}else{ }else{
MsgLog("MALFORMED PLIST : Quirks/KernelCache must be a string"); MsgLog("MALFORMED PLIST : Quirks/KernelCache must be a string");
gSettings.KernelAndKextPatches.OcKernelCache = "Auto"_XS8; gSettings.Quirks.OcKernelCache = "Auto"_XS8;
} }
} }
@ -3320,17 +3329,17 @@ EFI_STATUS GetEarlyUserSettings (
// Booter Quirks // Booter Quirks
// Prop = OcQuirksDict->propertyForKey("AppleCpuPmCfgLock"); // Prop = OcQuirksDict->propertyForKey("AppleCpuPmCfgLock");
// settingsData.KernelAndKextPatches.OcKernelQuirks.AppleCpuPmCfgLock = IsPropertyNotNullAndTrue(Prop); // settingsData.KernelAndKextPatches.OcKernelQuirks.AppleCpuPmCfgLock = IsPropertyNotNullAndTrue(Prop);
gSettings.KernelAndKextPatches.OcKernelQuirks.AppleCpuPmCfgLock = gSettings.KernelAndKextPatches.KPAppleIntelCPUPM; // gSettings.Quirks.OcKernelQuirks.AppleCpuPmCfgLock = gSettings.KernelAndKextPatches.KPAppleIntelCPUPM || GlobalConfig.NeedPMfix;
// Prop = OcQuirksDict->propertyForKey("AppleXcpmCfgLock"); // // Prop = OcQuirksDict->propertyForKey("AppleXcpmCfgLock"); //
// settingsData.KernelAndKextPatches.OcKernelQuirks.AppleXcpmCfgLock = IsPropertyNotNullAndTrue(Prop); // settingsData.KernelAndKextPatches.OcKernelQuirks.AppleXcpmCfgLock = IsPropertyNotNullAndTrue(Prop);
gSettings.KernelAndKextPatches.OcKernelQuirks.AppleXcpmCfgLock = gSettings.KernelAndKextPatches.KPKernelPm; // gSettings.Quirks.OcKernelQuirks.AppleXcpmCfgLock = GlobalConfig.KPKernelPm || GlobalConfig.NeedPMfix;
Prop = OcQuirksDict->propertyForKey("AppleXcpmExtraMsrs"); Prop = OcQuirksDict->propertyForKey("AppleXcpmExtraMsrs");
gSettings.KernelAndKextPatches.OcKernelQuirks.AppleXcpmExtraMsrs = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcKernelQuirks.AppleXcpmExtraMsrs = IsPropertyNotNullAndTrue(Prop);
Prop = OcQuirksDict->propertyForKey("AppleXcpmForceBoost"); Prop = OcQuirksDict->propertyForKey("AppleXcpmForceBoost");
gSettings.KernelAndKextPatches.OcKernelQuirks.AppleXcpmForceBoost = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcKernelQuirks.AppleXcpmForceBoost = IsPropertyNotNullAndTrue(Prop);
// We can't use that Quirks because we don't delegate SMBios to OC. // We can't use that Quirks because we don't delegate SMBios to OC.
// Prop = OcQuirksDict->propertyForKey("CustomSMBIOSGuid"); // Prop = OcQuirksDict->propertyForKey("CustomSMBIOSGuid");
@ -3338,40 +3347,40 @@ EFI_STATUS GetEarlyUserSettings (
Prop = OcQuirksDict->propertyForKey("DisableIoMapper"); Prop = OcQuirksDict->propertyForKey("DisableIoMapper");
//if ( !Prop ) panic("Cannot find DisableIoMapper in config.plist/Quirks. You forgot to merge your quirks into one section. Update your config.plist"); //if ( !Prop ) panic("Cannot find DisableIoMapper in config.plist/Quirks. You forgot to merge your quirks into one section. Update your config.plist");
gSettings.KernelAndKextPatches.OcKernelQuirks.DisableIoMapper = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcKernelQuirks.DisableIoMapper = IsPropertyNotNullAndTrue(Prop);
Prop = OcQuirksDict->propertyForKey("DisableLinkeditJettison"); Prop = OcQuirksDict->propertyForKey("DisableLinkeditJettison");
gSettings.KernelAndKextPatches.OcKernelQuirks.DisableLinkeditJettison = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcKernelQuirks.DisableLinkeditJettison = IsPropertyNotNullAndTrue(Prop);
// Prop = OcQuirksDict->propertyForKey("DisableRtcChecksum"); // Prop = OcQuirksDict->propertyForKey("DisableRtcChecksum");
// settingsData.KernelAndKextPatches.OcKernelQuirks.DisableRtcChecksum = IsPropertyNotNullAndTrue(Prop); // settingsData.KernelAndKextPatches.OcKernelQuirks.DisableRtcChecksum = IsPropertyNotNullAndTrue(Prop);
gSettings.KernelAndKextPatches.OcKernelQuirks.DisableRtcChecksum = gSettings.KernelAndKextPatches.KPAppleRTC; gSettings.Quirks.OcKernelQuirks.DisableRtcChecksum = gSettings.KernelAndKextPatches.KPAppleRTC;
Prop = OcQuirksDict->propertyForKey("DummyPowerManagement"); Prop = OcQuirksDict->propertyForKey("DummyPowerManagement");
gSettings.KernelAndKextPatches.OcKernelQuirks.DummyPowerManagement = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcKernelQuirks.DummyPowerManagement = IsPropertyNotNullAndTrue(Prop);
Prop = OcQuirksDict->propertyForKey("ExternalDiskIcons"); Prop = OcQuirksDict->propertyForKey("ExternalDiskIcons");
gSettings.KernelAndKextPatches.OcKernelQuirks.ExternalDiskIcons = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcKernelQuirks.ExternalDiskIcons = IsPropertyNotNullAndTrue(Prop);
Prop = OcQuirksDict->propertyForKey("IncreasePciBarSize"); Prop = OcQuirksDict->propertyForKey("IncreasePciBarSize");
gSettings.KernelAndKextPatches.OcKernelQuirks.IncreasePciBarSize = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcKernelQuirks.IncreasePciBarSize = IsPropertyNotNullAndTrue(Prop);
// Prop = OcQuirksDict->propertyForKey("LapicKernelPanic"); // Prop = OcQuirksDict->propertyForKey("LapicKernelPanic");
// settingsData.KernelAndKextPatches.OcKernelQuirks.LapicKernelPanic = IsPropertyNotNullAndTrue(Prop); // settingsData.KernelAndKextPatches.OcKernelQuirks.LapicKernelPanic = IsPropertyNotNullAndTrue(Prop);
gSettings.KernelAndKextPatches.OcKernelQuirks.LapicKernelPanic = gSettings.KernelAndKextPatches.KPKernelLapic; gSettings.Quirks.OcKernelQuirks.LapicKernelPanic = gSettings.KernelAndKextPatches.KPKernelLapic;
// Prop = OcQuirksDict->propertyForKey("PanicNoKextDump"); // Prop = OcQuirksDict->propertyForKey("PanicNoKextDump");
// settingsData.KernelAndKextPatches.OcKernelQuirks.PanicNoKextDump = IsPropertyNotNullAndTrue(Prop); //KPPanicNoKextDump // settingsData.KernelAndKextPatches.OcKernelQuirks.PanicNoKextDump = IsPropertyNotNullAndTrue(Prop); //KPPanicNoKextDump
gSettings.KernelAndKextPatches.OcKernelQuirks.PanicNoKextDump = gSettings.KernelAndKextPatches.KPPanicNoKextDump; gSettings.Quirks.OcKernelQuirks.PanicNoKextDump = gSettings.KernelAndKextPatches.KPPanicNoKextDump;
Prop = OcQuirksDict->propertyForKey("PowerTimeoutKernelPanic"); Prop = OcQuirksDict->propertyForKey("PowerTimeoutKernelPanic");
gSettings.KernelAndKextPatches.OcKernelQuirks.PowerTimeoutKernelPanic = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcKernelQuirks.PowerTimeoutKernelPanic = IsPropertyNotNullAndTrue(Prop);
Prop = OcQuirksDict->propertyForKey("ThirdPartyDrives"); Prop = OcQuirksDict->propertyForKey("ThirdPartyDrives");
gSettings.KernelAndKextPatches.OcKernelQuirks.ThirdPartyDrives = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcKernelQuirks.ThirdPartyDrives = IsPropertyNotNullAndTrue(Prop);
Prop = OcQuirksDict->propertyForKey("XhciPortLimit"); Prop = OcQuirksDict->propertyForKey("XhciPortLimit");
gSettings.KernelAndKextPatches.OcKernelQuirks.XhciPortLimit = IsPropertyNotNullAndTrue(Prop); gSettings.Quirks.OcKernelQuirks.XhciPortLimit = IsPropertyNotNullAndTrue(Prop);
} }
} }
@ -4476,7 +4485,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
if ( !Prop->isString() ) { if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in NVCAP\n"); MsgLog("ATTENTION : property not string in NVCAP\n");
}else{ }else{
hex2bin (Prop->getString()->stringValue().c_str(), (UINT8*)&gSettings.NVCAP[0], 20); hex2bin (Prop->getString()->stringValue(), (UINT8*)&gSettings.NVCAP[0], sizeof(gSettings.NVCAP));
DBG("Read NVCAP:"); DBG("Read NVCAP:");
for (i = 0; i<20; i++) { for (i = 0; i<20; i++) {
@ -4493,7 +4502,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
if ( !Prop->isString() ) { if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in display-cfg\n"); MsgLog("ATTENTION : property not string in display-cfg\n");
}else{ }else{
hex2bin (Prop->getString()->stringValue().c_str(), (UINT8*)&gSettings.Dcfg[0], 8); hex2bin (Prop->getString()->stringValue(), (UINT8*)&gSettings.Dcfg[0], sizeof(gSettings.Dcfg));
} }
} }
@ -4558,7 +4567,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
if (!EFI_ERROR(Status)) { if (!EFI_ERROR(Status)) {
cProperties = (UINT8*)(UINTN)BufferPtr; cProperties = (UINT8*)(UINTN)BufferPtr;
cPropSize = (UINT32)(cDeviceProperties.length() >> 1); cPropSize = (UINT32)(cDeviceProperties.length() >> 1);
cPropSize = hex2bin(cDeviceProperties.c_str(), cProperties, cPropSize); cPropSize = hex2bin(cDeviceProperties, cProperties, EFI_PAGES_TO_SIZE(EFI_SIZE_TO_PAGES (cDeviceProperties.sizeInBytes()) + 1));
DBG("Injected EFIString of length %d\n", cPropSize); DBG("Injected EFIString of length %d\n", cPropSize);
} }
//--------- //---------
@ -5395,8 +5404,8 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
RT_VARIABLES* RtVariablePtr = new RT_VARIABLES(); RT_VARIABLES* RtVariablePtr = new RT_VARIABLES();
RT_VARIABLES& RtVariable = *RtVariablePtr; RT_VARIABLES& RtVariable = *RtVariablePtr;
for (i = 0; i < Count; i++) { for (i = 0; i < Count; i++) {
CfgDict = BlockArray->dictElementAt(i, "Block"_XS8); const TagDict* BlockDict = BlockArray->dictElementAt(i, "Block"_XS8);
const TagStruct* Prop2 = CfgDict->propertyForKey("Comment"); const TagStruct* Prop2 = BlockDict->propertyForKey("Comment");
if ( Prop2 != NULL ) { if ( Prop2 != NULL ) {
if ( !Prop2->isString() ) { if ( !Prop2->isString() ) {
MsgLog("ATTENTION : property not string in Block/Comment\n"); MsgLog("ATTENTION : property not string in Block/Comment\n");
@ -5406,11 +5415,11 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
} }
} }
} }
Prop2 = CfgDict->propertyForKey("Disabled"); Prop2 = BlockDict->propertyForKey("Disabled");
if (IsPropertyNotNullAndFalse(Prop2)) { if (IsPropertyNotNullAndFalse(Prop2)) {
continue; continue;
} }
Prop2 = CfgDict->propertyForKey("Guid"); Prop2 = BlockDict->propertyForKey("Guid");
if ( Prop2 != NULL ) { if ( Prop2 != NULL ) {
if ( !Prop2->isString() ) { if ( !Prop2->isString() ) {
MsgLog("ATTENTION : property not string in Block/Guid\n"); MsgLog("ATTENTION : property not string in Block/Guid\n");
@ -5425,7 +5434,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
} }
} }
Prop2 = CfgDict->propertyForKey("Name"); Prop2 = BlockDict->propertyForKey("Name");
RtVariable.Name.setEmpty(); RtVariable.Name.setEmpty();
if ( Prop2 != NULL ) { if ( Prop2 != NULL ) {
if ( !Prop2->isString() ) { if ( !Prop2->isString() ) {
@ -5462,8 +5471,8 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
//BacklightLevel //BacklightLevel
const TagStruct* Prop = SystemParametersDict->propertyForKey("BacklightLevel"); const TagStruct* Prop = SystemParametersDict->propertyForKey("BacklightLevel");
if (Prop != NULL) { if (Prop != NULL) {
gSettings.BacklightLevel = (UINT16)GetPropertyAsInteger(Prop, gSettings.BacklightLevel); gSettings.SystemParameters.BacklightLevel = (UINT16)GetPropertyAsInteger(Prop, gSettings.SystemParameters.BacklightLevel);
gSettings.BacklightLevelConfig = TRUE; gSettings.SystemParameters.BacklightLevelConfig = TRUE;
} }
Prop = SystemParametersDict->propertyForKey("CustomUUID"); Prop = SystemParametersDict->propertyForKey("CustomUUID");
@ -5472,31 +5481,31 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
MsgLog("ATTENTION : property not string in SystemParameters/CustomUUID\n"); MsgLog("ATTENTION : property not string in SystemParameters/CustomUUID\n");
}else{ }else{
if (IsValidGuidString(Prop->getString()->stringValue())) { if (IsValidGuidString(Prop->getString()->stringValue())) {
gSettings.CustomUuid = Prop->getString()->stringValue(); gSettings.SystemParameters.CustomUuid = Prop->getString()->stringValue();
// if CustomUUID specified, then default for InjectSystemID=FALSE // if CustomUUID specified, then default for InjectSystemID=FALSE
// to stay compatibile with previous Clover behaviour // to stay compatibile with previous Clover behaviour
DBG("The UUID is valid\n"); DBG("The UUID is valid\n");
}else{ }else{
DBG("Error: invalid CustomUUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n", Prop->getString()->stringValue().c_str()); DBG("Error: invalid CustomUUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n", Prop->getString()->stringValue().c_str());
gSettings.CustomUuid = {0}; gSettings.SystemParameters.CustomUuid = {0};
} }
} }
} }
//else gUuid value from SMBIOS //else gUuid value from SMBIOS
// DBG("Finally use %s\n", strguid(&gUuid)); // DBG("Finally use %s\n", strguid(&gUuid));
gSettings.InjectSystemID_ = 2; gSettings.SystemParameters.InjectSystemID = 2;
Prop = SystemParametersDict->propertyForKey("InjectSystemID"); Prop = SystemParametersDict->propertyForKey("InjectSystemID");
if ( Prop ) { if ( Prop ) {
if ( Prop->isBool() ) gSettings.InjectSystemID_ = Prop->getBool()->boolValue(); if ( Prop->isBool() ) gSettings.SystemParameters.InjectSystemID = Prop->getBool()->boolValue();
else if ( Prop->isString() ) { else if ( Prop->isString() ) {
// TODO a function that takes a string and return if it's true or false // TODO a function that takes a string and return if it's true or false
if ( Prop->getString()->stringValue().equalIC("true") ) gSettings.InjectSystemID_ = 1; if ( Prop->getString()->stringValue().equalIC("true") ) gSettings.SystemParameters.InjectSystemID = 1;
else if ( Prop->getString()->stringValue()[0] == 'y' ) gSettings.InjectSystemID_ = 1; else if ( Prop->getString()->stringValue()[0] == 'y' ) gSettings.SystemParameters.InjectSystemID = 1;
else if ( Prop->getString()->stringValue()[0] == 'Y' ) gSettings.InjectSystemID_ = 1; else if ( Prop->getString()->stringValue()[0] == 'Y' ) gSettings.SystemParameters.InjectSystemID = 1;
else if ( Prop->getString()->stringValue().equalIC("false") ) gSettings.InjectSystemID_ = 0; else if ( Prop->getString()->stringValue().equalIC("false") ) gSettings.SystemParameters.InjectSystemID = 0;
else if ( Prop->getString()->stringValue().equalIC("n") ) gSettings.InjectSystemID_ = 0; else if ( Prop->getString()->stringValue().equalIC("n") ) gSettings.SystemParameters.InjectSystemID = 0;
else if ( Prop->getString()->stringValue().equalIC("N") ) gSettings.InjectSystemID_ = 0; else if ( Prop->getString()->stringValue().equalIC("N") ) gSettings.SystemParameters.InjectSystemID = 0;
else { else {
DBG("MALFORMED PLIST : SMBIOS/InjectSystemID must be true, yes, false, no, or non existant"); DBG("MALFORMED PLIST : SMBIOS/InjectSystemID must be true, yes, false, no, or non existant");
} }
@ -5506,7 +5515,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
} }
Prop = SystemParametersDict->propertyForKey("NvidiaWeb"); Prop = SystemParametersDict->propertyForKey("NvidiaWeb");
gSettings.NvidiaWeb = IsPropertyNotNullAndTrue(Prop); gSettings.SystemParameters.NvidiaWeb = IsPropertyNotNullAndTrue(Prop);
} }
@ -7423,10 +7432,11 @@ SetDevices (LOADER_ENTRY *Entry)
DBG("stringlength = %d\n", device_inject_stringlength); DBG("stringlength = %d\n", device_inject_stringlength);
// gDeviceProperties = (__typeof__(gDeviceProperties))AllocateAlignedPages EFI_SIZE_TO_PAGES (device_inject_stringlength + 1), 64); // gDeviceProperties = (__typeof__(gDeviceProperties))AllocateAlignedPages EFI_SIZE_TO_PAGES (device_inject_stringlength + 1), 64);
UINTN nbPages = EFI_SIZE_TO_PAGES (device_inject_stringlength + 1);
Status = gBS->AllocatePages ( Status = gBS->AllocatePages (
AllocateMaxAddress, AllocateMaxAddress,
EfiACPIReclaimMemory, EfiACPIReclaimMemory,
EFI_SIZE_TO_PAGES ((UINTN)device_inject_stringlength + 1), nbPages,
&BufferPtr &BufferPtr
); );
@ -7440,7 +7450,7 @@ SetDevices (LOADER_ENTRY *Entry)
//------- //-------
mPropSize = (UINT32)AsciiStrLen(gDeviceProperties) / 2; mPropSize = (UINT32)AsciiStrLen(gDeviceProperties) / 2;
// DBG("Preliminary size of mProperties=%d\n", mPropSize); // DBG("Preliminary size of mProperties=%d\n", mPropSize);
mPropSize = hex2bin (gDeviceProperties, mProperties, mPropSize); mPropSize = hex2bin (gDeviceProperties, AsciiStrLen(gDeviceProperties), mProperties, EFI_PAGES_TO_SIZE(nbPages));
// DBG("Final size of mProperties=%d\n", mPropSize); // 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); // Status = egSaveFile(&self.getSelfRootDir(), SWPrintf("%ls\\misc\\devprop.bin", self.getCloverDirFullPath().wc_str()).wc_str() , (UINT8*)mProperties, mPropSize);
@ -7761,23 +7771,24 @@ EFI_GUID nullUUID = {0,0,0,{0}};
const XString8& SETTINGS_DATA::getUUID() const XString8& SETTINGS_DATA::getUUID()
{ {
if ( CustomUuid.notEmpty() ) return CustomUuid; if ( SystemParameters.CustomUuid.notEmpty() ) return SystemParameters.CustomUuid;
return SmUUID; return SmUUID;
} }
const XString8& SETTINGS_DATA::getUUID(EFI_GUID *uuid) const XString8& SETTINGS_DATA::getUUID(EFI_GUID *uuid)
{ {
if ( CustomUuid.notEmpty() ) { if ( SystemParameters.CustomUuid.notEmpty() ) {
EFI_STATUS Status = StrToGuidLE(CustomUuid, uuid); EFI_STATUS Status = StrToGuidLE(SystemParameters.CustomUuid, uuid);
#ifdef DEBUG #ifdef DEBUG
if ( EFI_ERROR(Status) ) panic("CustomUuid(%s) is not valid", CustomUuid.c_str()); // we panic, because it's a bug. Validity is checked when imported from settings if ( EFI_ERROR(Status) ) panic("CustomUuid(%s) is not valid", SystemParameters.CustomUuid.c_str()); // we panic, because it's a bug. Validity is checked when imported from settings
#else #else
if ( EFI_ERROR(Status) ) { if ( EFI_ERROR(Status) ) {
DBG("CustomUuid(%s) is not valid\n", CustomUuid.c_str()); DBG("CustomUuid(%s) is not valid\n", CustomUuid.c_str());
memset(uuid, 0, sizeof(uuid));
return nullUUID; return nullUUID;
} }
#endif #endif
return CustomUuid; return SystemParameters.CustomUuid;
} }
EFI_STATUS Status = StrToGuidLE(SmUUID, uuid); EFI_STATUS Status = StrToGuidLE(SmUUID, uuid);
#ifdef DEBUG #ifdef DEBUG
@ -7785,6 +7796,7 @@ const XString8& SETTINGS_DATA::getUUID(EFI_GUID *uuid)
#else #else
if ( EFI_ERROR(Status) ) { if ( EFI_ERROR(Status) ) {
DBG("SmUUID(%s) is not valid\n", SmUUID.c_str()); DBG("SmUUID(%s) is not valid\n", SmUUID.c_str());
memset(uuid, 0, sizeof(uuid));
return nullUUID; return nullUUID;
} }
#endif #endif

View File

@ -442,6 +442,12 @@ public :
MMIOWhiteList& operator=(const MMIOWhiteList&) = delete; MMIOWhiteList& operator=(const MMIOWhiteList&) = delete;
}; };
class SETTINGS_DATA;
class ConfigPlist;
class TagDict;
bool CompareEarlyUserSettingsWithConfigPlist(const SETTINGS_DATA& olDSettings, const ConfigPlist& configPlist);
EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings);
class SETTINGS_DATA { class SETTINGS_DATA {
public: public:
@ -609,6 +615,32 @@ public:
undefinable_uint16 _C3Latency = undefinable_uint16(); undefinable_uint16 _C3Latency = undefinable_uint16();
} CPU = CPUClass(); } CPU = CPUClass();
class SystemParametersClass {
public:
bool WithKexts = true;
bool WithKextsIfNoFakeSMC = 0;
bool NoCaches = 0;
uint16_t BacklightLevel = 0xFFFF;
bool BacklightLevelConfig = false;
XString8 CustomUuid = XString8();
protected:
UINT8 InjectSystemID = 2; // 0=false, 1=true, other value = default.
public:
bool NvidiaWeb = 0;
friend class ::SETTINGS_DATA;
friend bool ::CompareEarlyUserSettingsWithConfigPlist(const SETTINGS_DATA& olDSettings, const ConfigPlist& configPlist);
friend unsigned long long ::GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings);
} SystemParameters = SystemParametersClass();
class QuirksClass {
public:
bool FuzzyMatch = bool();
XString8 OcKernelCache = XString8();
OC_KERNEL_QUIRKS OcKernelQuirks = OC_KERNEL_QUIRKS();
} Quirks = QuirksClass();
bool getEnableC6() const { bool getEnableC6() const {
if ( CPU._EnableC6.isDefined() ) return CPU._EnableC6; if ( CPU._EnableC6.isDefined() ) return CPU._EnableC6;
return ACPI.SSDT._EnableC6; return ACPI.SSDT._EnableC6;
@ -683,7 +715,6 @@ public:
INT8 pad181[7]; INT8 pad181[7];
XString8 Language; XString8 Language;
INT8 pad19[2]; INT8 pad19[2];
XString8 CustomUuid;
INT8 pad20[6]; INT8 pad20[6];
@ -692,15 +723,10 @@ public:
UINT8 pad21[1]; UINT8 pad21[1];
UINT16 VendorEDID; UINT16 VendorEDID;
UINT16 ProductEDID; UINT16 ProductEDID;
UINT16 BacklightLevel;
BOOLEAN BacklightLevelConfig;
BOOLEAN IntelBacklight; BOOLEAN IntelBacklight;
//Boot options //Boot options
BOOLEAN MemoryFix; BOOLEAN MemoryFix;
BOOLEAN WithKexts;
BOOLEAN WithKextsIfNoFakeSMC;
BOOLEAN FakeSMCFound; BOOLEAN FakeSMCFound;
BOOLEAN NoCaches;
// GUI parameters // GUI parameters
BOOLEAN Debug; BOOLEAN Debug;
@ -715,7 +741,6 @@ public:
//Injections //Injections
BOOLEAN StringInjector; BOOLEAN StringInjector;
UINT8 InjectSystemID_; // 0=false, 1=true, other value = default.
BOOLEAN NoDefaultProperties; BOOLEAN NoDefaultProperties;
@ -761,7 +786,6 @@ public:
UINT8 Dcfg[8]; UINT8 Dcfg[8];
UINT8 NVCAP[20]; UINT8 NVCAP[20];
INT8 BootDisplay; INT8 BootDisplay;
BOOLEAN NvidiaWeb;
UINT8 pad41[2]; UINT8 pad41[2];
UINT32 DualLink; UINT32 DualLink;
UINT32 IgPlatform; UINT32 IgPlatform;
@ -902,13 +926,13 @@ public:
BoardVersion(), OEMBoard(), BoardType(0), pad1(0), Mobile(0), ChassisType(0), ChassisManufacturer(), ChassisAssetTag(), BoardVersion(), OEMBoard(), BoardType(0), pad1(0), Mobile(0), ChassisType(0), ChassisManufacturer(), ChassisAssetTag(),
EnabledCores(0), SmbiosVersion(0), Attribute(0), pad17{0}, MemoryManufacturer(), EnabledCores(0), SmbiosVersion(0), Attribute(0), pad17{0}, MemoryManufacturer(),
MemorySerialNumber(), MemoryPartNumber(), MemorySpeed(), InjectMemoryTables(0), MemorySerialNumber(), MemoryPartNumber(), MemorySpeed(), InjectMemoryTables(0),
PlatformFeature(0), NoRomInfo(0), Language(), CustomUuid(), PlatformFeature(0), NoRomInfo(0), Language(),
IntelMaxBacklight(0), VendorEDID(0), ProductEDID(0), BacklightLevel(0), BacklightLevelConfig(0), IntelBacklight(0), MemoryFix(0), WithKexts(0), IntelMaxBacklight(0), VendorEDID(0), ProductEDID(0), IntelBacklight(0), MemoryFix(0),
WithKextsIfNoFakeSMC(0), FakeSMCFound(0), NoCaches(0), Debug(0), pad22{0}, DefaultBackgroundColor(0), StringInjector(0), InjectSystemID_(0), NoDefaultProperties(0), FakeSMCFound(0), Debug(0), pad22{0}, DefaultBackgroundColor(0), StringInjector(0), NoDefaultProperties(0),
FakeATI(0), FakeNVidia(0), FakeIntel(0), FakeLAN(0), FakeWIFI(0), FakeSATA(0), FakeXHCI(0), FakeIMEI(0), GraphicsInjector(0), FakeATI(0), FakeNVidia(0), FakeIntel(0), FakeLAN(0), FakeWIFI(0), FakeSATA(0), FakeXHCI(0), FakeIMEI(0), GraphicsInjector(0),
InjectIntel(0), InjectATI(0), InjectNVidia(0), DeInit(0), LoadVBios(0), PatchVBios(0), PatchVBiosBytes(0), PatchVBiosBytesCount(0), InjectEDID(0), InjectIntel(0), InjectATI(0), InjectNVidia(0), DeInit(0), LoadVBios(0), PatchVBios(0), PatchVBiosBytes(0), PatchVBiosBytesCount(0), InjectEDID(0),
LpcTune(0), DropOEM_DSM(0), CustomEDID(0), CustomEDIDsize(0), EdidFixHorizontalSyncPulseWidth(0), EdidFixVideoInputSignal(0), FBName(), VideoPorts(0), NvidiaGeneric(0), LpcTune(0), DropOEM_DSM(0), CustomEDID(0), CustomEDIDsize(0), EdidFixHorizontalSyncPulseWidth(0), EdidFixVideoInputSignal(0), FBName(), VideoPorts(0), NvidiaGeneric(0),
NvidiaNoEFI(0), NvidiaSingle(0), VRAM(0), Dcfg{0}, NVCAP{0}, BootDisplay(0), NvidiaWeb(0), pad41{0}, DualLink(0), NvidiaNoEFI(0), NvidiaSingle(0), VRAM(0), Dcfg{0}, NVCAP{0}, BootDisplay(0), pad41{0}, DualLink(0),
IgPlatform(0), HDAInjection(0), IgPlatform(0), HDAInjection(0),
HDALayoutId(0), USBInjection(0), USBFixOwnership(0), InjectClockID(0), HighCurrent(0), NameEH00(0), NameXH00(0), LANInjection(0), HDMIInjection(0), HDALayoutId(0), USBInjection(0), USBFixOwnership(0), InjectClockID(0), HighCurrent(0), NameEH00(0), NameXH00(0), LANInjection(0), HDMIInjection(0),
KernelAndKextPatches(), KextPatchesAllowed(0), KernelAndKextPatches(), KextPatchesAllowed(0),
@ -931,13 +955,13 @@ public:
// If CustomUuid is defined, return false by default // If CustomUuid is defined, return false by default
// If SmUUID is defined, return true by default. // If SmUUID is defined, return true by default.
bool ShouldInjectSystemID() { bool ShouldInjectSystemID() {
if ( CustomUuid.notEmpty() && CustomUuid != nullGuid ) { if ( SystemParameters.CustomUuid.notEmpty() && SystemParameters.CustomUuid != nullGuid ) {
if ( InjectSystemID_ == 2 ) return false; if ( SystemParameters.InjectSystemID == 2 ) return false;
else return InjectSystemID_; else return SystemParameters.InjectSystemID;
} }
if ( SmUUID.isEmpty() || SmUUID == nullGuid ) return false; if ( SmUUID.isEmpty() || SmUUID == nullGuid ) return false;
if ( InjectSystemID_ == 2 ) return true; if ( SystemParameters.InjectSystemID == 2 ) return true;
return InjectSystemID_; return SystemParameters.InjectSystemID;
} }
}; };
@ -1075,7 +1099,7 @@ extern const LString8 gBuildIdGrepTag;
extern BOOLEAN ResumeFromCoreStorage; extern BOOLEAN ResumeFromCoreStorage;
extern BOOLEAN gRemapSmBiosIsRequire; // syscl: pass argument for Dell SMBIOS here //extern BOOLEAN gRemapSmBiosIsRequire; // syscl: pass argument for Dell SMBIOS here
extern EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl; extern EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl;
@ -1119,6 +1143,9 @@ public:
INTN Codepage = 0xC0; INTN Codepage = 0xC0;
INTN CodepageSize = 0xC0; INTN CodepageSize = 0xC0;
bool KPKernelPm = bool();
bool KPAppleIntelCPUPM = bool();
REFIT_CONFIG() {}; REFIT_CONFIG() {};
REFIT_CONFIG(const REFIT_CONFIG& other) = delete; // Can be defined if needed REFIT_CONFIG(const REFIT_CONFIG& other) = delete; // Can be defined if needed

View File

@ -59,41 +59,56 @@ BOOLEAN IsHexDigit (CHAR8 c) {
//out value is a number of byte. out = len //out value is a number of byte. out = len
UINT32 hex2bin(IN const CHAR8 *hex, OUT UINT8 *bin, UINT32 len) //assume len = number of UINT8 values // get rid of this one
//UINT32 hex2bin(IN const CHAR8 *hex, OUT UINT8 *bin, UINT32 len) //assume len = number of UINT8 values
//{
// CHAR8 *p;
// UINT32 i, outlen = 0;
// CHAR8 buf[3];
//
// if (hex == NULL || bin == NULL || len <= 0 || AsciiStrLen(hex) < len * 2) {
// // DBG("[ERROR] bin2hex input error\n"); //this is not error, this is empty value
// return FALSE;
// }
//
// buf[2] = '\0';
// p = (CHAR8 *) hex;
//
// for (i = 0; i < len; i++)
// {
// while ( *p == 0x20 || *p == ',' || *p == '\n' || *p == '\r' ) {
// p++; //skip spaces and commas
// }
// if (*p == 0) {
// break;
// }
// if (!IsHexDigit(p[0]) || !IsHexDigit(p[1])) {
// MsgLog("[ERROR] bin2hex '%s' syntax error\n", hex);
// return 0;
// }
// buf[0] = *p++;
// buf[1] = *p++;
// bin[i] = hexstrtouint8(buf);
// outlen++;
// }
// //bin[outlen] = 0;
// return outlen;
//}
#ifdef __cplusplus
size_t hex2bin(const XString8& s, uint8_t *out, size_t outlen)
{ {
CHAR8 *p; return hex2bin(s.c_str(), s.length(), out, outlen);
UINT32 i, outlen = 0;
CHAR8 buf[3];
if (hex == NULL || bin == NULL || len <= 0 || AsciiStrLen(hex) < len * 2) {
// DBG("[ERROR] bin2hex input error\n"); //this is not error, this is empty value
return FALSE;
}
buf[2] = '\0';
p = (CHAR8 *) hex;
for (i = 0; i < len; i++)
{
while ( *p == 0x20 || *p == ',' || *p == '\n' || *p == '\r' ) {
p++; //skip spaces and commas
}
if (*p == 0) {
break;
}
if (!IsHexDigit(p[0]) || !IsHexDigit(p[1])) {
MsgLog("[ERROR] bin2hex '%s' syntax error\n", hex);
return 0;
}
buf[0] = *p++;
buf[1] = *p++;
bin[i] = hexstrtouint8(buf);
outlen++;
}
//bin[outlen] = 0;
return outlen;
} }
size_t hex2bin(const XStringW& s, uint8_t *out, size_t outlen)
{
return hex2bin(s.wc_str(), s.length(), out, outlen);
}
#endif
XString8 Bytes2HexStr(UINT8 *data, UINTN len) XString8 Bytes2HexStr(UINT8 *data, UINTN len)
{ {
UINTN i, j, b = 0; UINTN i, j, b = 0;

View File

@ -38,7 +38,7 @@ inline bool isPathSeparator(char32_t c) { return c == '/' || c == '\\'; }
////void LowCase (IN OUT CHAR8 *Str); ////void LowCase (IN OUT CHAR8 *Str);
UINT32 hex2bin(IN const CHAR8 *hex, OUT UINT8 *bin, UINT32 len); //UINT32 hex2bin(IN const CHAR8 *hex, OUT UINT8 *bin, UINT32 len);
BOOLEAN IsHexDigit (CHAR8 c); BOOLEAN IsHexDigit (CHAR8 c);
UINT8 hexstrtouint8 (CONST CHAR8* buf); //one or two hex letters to one byte UINT8 hexstrtouint8 (CONST CHAR8* buf); //one or two hex letters to one byte
@ -47,6 +47,49 @@ UINT8 hexstrtouint8 (CONST CHAR8* buf); //one or two hex letters to one by
#include "../cpp_foundation/XString.h" #include "../cpp_foundation/XString.h"
template <typename T, enable_if( is_char_ptr(T) || is___String(T) )>
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;
}
for (size_t hexidx = 0; hexidx < hexlen ; )
{
while ( hex[hexidx] == 0x20 || hex[hexidx] == ',' || hex[hexidx] == '\n' || hex[hexidx] == '\r' ) {
if ( hexidx == hexlen ) {
return outidx;
}
hexidx++; //skip spaces and commas
}
if ( hexidx == hexlen-1 ) {
printf("[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());
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;
}
out[outidx++] = hexstrtouint8(buf);
}
//bin[outlen] = 0;
return outidx;
}
size_t hex2bin(const XString8& s, uint8_t *out, size_t outlen);
size_t hex2bin(const XStringW& s, uint8_t *out, size_t outlen);
XString8 Bytes2HexStr(UINT8 *data, UINTN len); XString8 Bytes2HexStr(UINT8 *data, UINTN len);

View File

@ -2476,10 +2476,9 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize)
j++; curs++; j++; curs++;
} }
} }
// if (KernelAndKextPatches.KPDebug) { if (KernelAndKextPatches.KPDebug) {
// gBS->Stall(2000000); gBS->Stall(2000000);
// } }
Stall(2000000);
return (y != 0); return (y != 0);
} }
@ -2610,7 +2609,7 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize)
// KernelAndKextPatcherInit(); // KernelAndKextPatcherInit();
// //
// KextPatchesNeeded = ( // KextPatchesNeeded = (
// KernelAndKextPatches.KPAppleIntelCPUPM || // KernelAndKextPatches.KPAppleIntelCPUPM || GlobalConfig.NeedPMfix ||
// KernelAndKextPatches.KPAppleRTC || // KernelAndKextPatches.KPAppleRTC ||
// KernelAndKextPatches.EightApple || // KernelAndKextPatches.EightApple ||
// KernelAndKextPatches.KPDELLSMBIOS || // KernelAndKextPatches.KPDELLSMBIOS ||
@ -2669,7 +2668,7 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize)
// //
// // CPU power management patch for CPU with locked msr // // CPU power management patch for CPU with locked msr
// DBG_RT( "\nKernelPm patch: "); // DBG_RT( "\nKernelPm patch: ");
// if (KernelAndKextPatches.KPKernelPm || KernelAndKextPatches.KPKernelXCPM) { // if (KernelAndKextPatches.KPKernelPm||GlobalConfig.NeedPMfix || KernelAndKextPatches.KPKernelXCPM) {
// DBG_RT( "Enabled: \n"); // DBG_RT( "Enabled: \n");
// DBG( "KernelPm patch: Enabled\n"); // DBG( "KernelPm patch: Enabled\n");
//// KernelAndKextPatcherInit(); //// KernelAndKextPatcherInit();

View File

@ -486,17 +486,17 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
} }
// Force kexts to load // Force kexts to load
if ( KernelAndKextPatches.ForceKexts.notEmpty() ) { if ( KernelAndKextPatches.ForceKextsToLoad.notEmpty() ) {
for (size_t i = 0; i < KernelAndKextPatches.ForceKexts.size(); ++i) { for (size_t i = 0; i < KernelAndKextPatches.ForceKextsToLoad.size(); ++i) {
MsgLog(" Force kext: %ls\n", KernelAndKextPatches.ForceKexts[i].wc_str()); MsgLog(" Force kext: %ls\n", KernelAndKextPatches.ForceKextsToLoad[i].wc_str());
if (Volume && Volume->RootDir) { if (Volume && Volume->RootDir) {
// Check if the entry is a directory // Check if the entry is a directory
if (StrStr(KernelAndKextPatches.ForceKexts[i].wc_str(), L".kext") == NULL) { if (StrStr(KernelAndKextPatches.ForceKextsToLoad[i].wc_str(), L".kext") == NULL) {
DirIterOpen(Volume->RootDir, KernelAndKextPatches.ForceKexts[i].wc_str(), &PlugInIter); DirIterOpen(Volume->RootDir, KernelAndKextPatches.ForceKextsToLoad[i].wc_str(), &PlugInIter);
while (DirIterNext(&PlugInIter, 1, L"*.kext", &PlugInFile)) { while (DirIterNext(&PlugInIter, 1, L"*.kext", &PlugInFile)) {
if (PlugInFile->FileName[0] == '.' || StrStr(PlugInFile->FileName, L".kext") == NULL) if (PlugInFile->FileName[0] == '.' || StrStr(PlugInFile->FileName, L".kext") == NULL)
continue; // skip this continue; // skip this
FileName = SWPrintf("%ls\\%ls", KernelAndKextPatches.ForceKexts[i].wc_str(), PlugInFile->FileName); FileName = SWPrintf("%ls\\%ls", KernelAndKextPatches.ForceKextsToLoad[i].wc_str(), PlugInFile->FileName);
// snwprintf(FileName, 512, "%s\\%s", KernelAndKextPatches.ForceKexts[i], PlugInFile->FileName); // snwprintf(FileName, 512, "%s\\%s", KernelAndKextPatches.ForceKexts[i], PlugInFile->FileName);
MsgLog(" Force kext: %s\n", FileName.c_str()); MsgLog(" Force kext: %s\n", FileName.c_str());
AddKext( Volume->RootDir, FileName, archCpuType); AddKext( Volume->RootDir, FileName, archCpuType);
@ -506,8 +506,8 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
} }
DirIterClose(&PlugInIter); DirIterClose(&PlugInIter);
} else { } else {
AddKext( Volume->RootDir, KernelAndKextPatches.ForceKexts[i], archCpuType); AddKext( Volume->RootDir, KernelAndKextPatches.ForceKextsToLoad[i], archCpuType);
PlugIns = SWPrintf("%ls\\Contents\\PlugIns", KernelAndKextPatches.ForceKexts[i].wc_str()); PlugIns = SWPrintf("%ls\\Contents\\PlugIns", KernelAndKextPatches.ForceKextsToLoad[i].wc_str());
// snwprintf(PlugIns, 512, "%s\\Contents\\PlugIns", KernelAndKextPatches.ForceKexts[i]); // snwprintf(PlugIns, 512, "%s\\Contents\\PlugIns", KernelAndKextPatches.ForceKexts[i]);
LoadPlugInKexts(Volume->RootDir, PlugIns, archCpuType, TRUE); LoadPlugInKexts(Volume->RootDir, PlugIns, archCpuType, TRUE);
} }

View File

@ -18,6 +18,7 @@ extern "C" {
#include <UefiLoader.h> #include <UefiLoader.h>
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile #include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
#include "Settings.h"
#include "kernel_patcher.h" #include "kernel_patcher.h"
#include "kext_inject.h" #include "kext_inject.h"
#include "../gui/menu_items/menu_items.h" #include "../gui/menu_items/menu_items.h"
@ -1069,7 +1070,7 @@ void LOADER_ENTRY::PatchKext(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist,
ExtractKextBundleIdentifier(InfoPlist); ExtractKextBundleIdentifier(InfoPlist);
if (KernelAndKextPatches.KPAppleIntelCPUPM && if ( (GlobalConfig.KPAppleIntelCPUPM) &&
(AsciiStrStr(InfoPlist, (AsciiStrStr(InfoPlist,
"<string>com.apple.driver.AppleIntelCPUPowerManagement</string>") != NULL)) { "<string>com.apple.driver.AppleIntelCPUPowerManagement</string>") != NULL)) {
// //

View File

@ -1418,8 +1418,8 @@ void GetDefaultSettings()
//gSettings.HDALayoutId = 0; //gSettings.HDALayoutId = 0;
gSettings.USBInjection = TRUE; // enabled by default to have the same behavior as before gSettings.USBInjection = TRUE; // enabled by default to have the same behavior as before
gSettings.ACPI.DSDT.DsdtName = L"DSDT.aml"_XSW; gSettings.ACPI.DSDT.DsdtName = L"DSDT.aml"_XSW;
gSettings.BacklightLevel = 0xFFFF; //0x0503; -- the value from MBA52 gSettings.SystemParameters.BacklightLevel = 0xFFFF; //0x0503; -- the value from MBA52
gSettings.BacklightLevelConfig = FALSE; gSettings.SystemParameters.BacklightLevelConfig = FALSE;
gSettings.TrustSMBIOS = TRUE; gSettings.TrustSMBIOS = TRUE;
gSettings.SmUUID = nullGuid; gSettings.SmUUID = nullGuid;

View File

@ -69,54 +69,46 @@ const XMLEntity ents[] = {
{"amp;"_XS8, '&'} {"amp;"_XS8, '&'}
}; };
/* Replace XML entities by their value */ /*
CHAR8* * Replace XML entities by their value
XMLDecode(CHAR8* src) * out can be src
*/
size_t XMLDecode(const char* src, size_t srclen, char* out, size_t outlen)
{ {
UINTN len; const char* s;
CONST CHAR8 *s; char* o;
CHAR8 *out, *o;
if (!src) { if (!src) {
return 0; return 0;
} }
len = strlen(src);
#if 0
out = (__typeof__(out))AllocateZeroPool(len+1);
if (!out)
return 0;
#else // unsafe
// out is always <= src, let's overwrite src // out is always <= src, let's overwrite src
out = src;
#endif
o = out;
s = src; s = src;
while (s <= src+len) /* Make sure the terminator is also copied */ o = out;
while (s < src+srclen) /* Make sure the terminator is also copied */
{ {
if ( *s == '&' ) { if ( *s == '&' ) {
BOOLEAN entFound = FALSE;
UINTN i; UINTN i;
s++; s++;
for (i = 0; i < sizeof(ents)/sizeof(ents[0]); i++) { for (i = 0; i < sizeof(ents)/sizeof(ents[0]); i++) {
if ( ents[i].name.strncmp(s, ents[i].nameLen) == 0 ) { if ( ents[i].name.strncmp(s, ents[i].nameLen) == 0 ) {
entFound = TRUE; if ( uintptr_t(o)-uintptr_t(out) >= outlen ) return uintptr_t(o)-uintptr_t(out);
*o++ = ents[i].value;
s += ents[i].nameLen;
break; break;
} }
} }
if ( entFound ) {
*o++ = ents[i].value;
s += ents[i].nameLen;
continue;
}
} }
if ( uintptr_t(o)-uintptr_t(out) >= outlen ) return uintptr_t(o)-uintptr_t(out);
*o++ = *s++; *o++ = *s++;
} }
if ( uintptr_t(o)-uintptr_t(out) < outlen ) *o = 0;
return out; return uintptr_t(o)-uintptr_t(out);
} }
char* XMLDecode(char* src)
{
XMLDecode(src, strlen(src), src, strlen(src)+1);
return src;
}

View File

@ -25,9 +25,7 @@
#define kXMLTagFloat "real" #define kXMLTagFloat "real"
CHAR8* size_t XMLDecode (const char* src, size_t srclen, char* out, size_t outlen);
XMLDecode ( char* XMLDecode (char* src);
CHAR8 *src
);
#endif /* __xml_h__ */ #endif /* __xml_h__ */

View File

@ -2198,7 +2198,7 @@ void FinalizeSmbios() //continue
// //
// to fix Dell's SMBIOS truncate credit David Passmore // to fix Dell's SMBIOS truncate credit David Passmore
// //
if (gRemapSmBiosIsRequire) if (gSettings.KernelAndKextPatches.KPDELLSMBIOS)
{ {
// //
// syscl: remap smbios table 1 guid // syscl: remap smbios table 1 guid

View File

@ -35,7 +35,7 @@ protected:
const XBuffer &operator =(const XBuffer &aBuffer); const XBuffer &operator =(const XBuffer &aBuffer);
template<typename IntegralType, enable_if(is_integral(IntegralType))> template<typename IntegralType, enable_if(is_integral(IntegralType))>
void stealValueFrom(T* p, IntegralType count) { void stealValueFrom(T* p, IntegralType count) {
if ( count < 0 ) { if ( count < 0 ) {
#ifdef DEBUG #ifdef DEBUG
panic("XBuffer::stealValueFrom : count < 0. System halted\n"); panic("XBuffer::stealValueFrom : count < 0. System halted\n");
@ -44,7 +44,25 @@ protected:
#endif #endif
} }
if( _WData ) free(_WData); if( _WData ) free(_WData);
Initialize(p, count, 0); m_allocatedSize = count;
XRBuffer<T>::_RData = _WData = p;
XRBuffer<T>::m_size = count;
XRBuffer<T>::_Index = 0;
}
template<typename IntegralType, enable_if(is_integral(IntegralType))>
void stealValueFrom(T* p, IntegralType count, IntegralType allocatedSize) {
if ( count < 0 ) {
panic("XBuffer::stealValueFrom : count < 0. System halted\n");
}
if ( allocatedSize < count ) {
panic("XBuffer::stealValueFrom : allocatedSize < count. System halted\n");
}
if( _WData ) free(_WData);
m_allocatedSize = allocatedSize;
XRBuffer<T>::_RData = _WData = p;
XRBuffer<T>::m_size = count;
XRBuffer<T>::_Index = 0;
} }
~XBuffer(); ~XBuffer();
@ -113,26 +131,27 @@ public:
template<typename IntegralType, enable_if(is_integral(IntegralType))> template<typename IntegralType, enable_if(is_integral(IntegralType))>
T& operator [](IntegralType i) T& operator [](IntegralType i)
{ {
#ifdef DEBUG //#ifdef DEBUG
if (i < 0) panic("XBuffer::[] : i < 0. System halted\n"); if (i < 0) panic("XBuffer::[] : i < 0. System halted\n");
if ( (unsigned_type(IntegralType))i >= size() ) panic("XBuffer::[] : i > _Len. System halted\n"); if ( (unsigned_type(IntegralType))i >= size() ) panic("XBuffer::[] : i > _Len. System halted\n");
#else //#else
if (i < 0) return 0; // // Cannot return 0, return value type is T, unknown at this stage.
if ( (unsigned_type(IntegralType))i >= size() ) return 0; // if (i < 0) return 0;
// if ( (unsigned_type(IntegralType))i >= size() ) return 0;
#endif //#endif
return _WData[(unsigned_type(IntegralType))i]; return _WData[(unsigned_type(IntegralType))i];
} }
template<typename IntegralType, enable_if(is_integral(IntegralType))> template<typename IntegralType, enable_if(is_integral(IntegralType))>
const T& operator [](IntegralType i) const const T& operator [](IntegralType i) const
{ {
#ifdef DEBUG //#ifdef DEBUG
if (i < 0) panic("XBuffer::[] : i < 0. System halted\n"); if (i < 0) panic("XBuffer::[] : i < 0. System halted\n");
if ( (unsigned_type(IntegralType))i >= size() ) panic("XBuffer::[] : i > _Len. System halted\n"); if ( (unsigned_type(IntegralType))i >= size() ) panic("XBuffer::[] : i > _Len. System halted\n");
#else //#else
if (i < 0) return 0; // // Cannot return 0, return value type is T, unknown at this stage.
if ( (unsigned_type(IntegralType))i >= size() ) return 0; // if (i < 0) return 0;
#endif // if ( (unsigned_type(IntegralType))i >= size() ) return 0;
//#endif
return _WData[(unsigned_type(IntegralType))i]; return _WData[(unsigned_type(IntegralType))i];
} }

View File

@ -57,7 +57,7 @@ class XString8 : public XStringAbstract<char, XString8>
protected: protected:
static void transmitS8Printf(const char* buf, unsigned int nbchar, void* context) static void transmitS8Printf(const char* buf, unsigned int nbchar, void* context)
{ {
((XString8*)(context))->strncat(buf, nbchar); ((XString8*)(context))->strsicat(buf, nbchar);
} }
public: public:
void vS8Printf(const char* format, XTOOLS_VA_LIST va) void vS8Printf(const char* format, XTOOLS_VA_LIST va)
@ -174,7 +174,7 @@ public:
protected: protected:
static void transmitSWPrintf(const wchar_t* buf, unsigned int nbchar, void* context) static void transmitSWPrintf(const wchar_t* buf, unsigned int nbchar, void* context)
{ {
((XStringW*)(context))->strncat(buf, nbchar); ((XStringW*)(context))->strsicat(buf, nbchar);
} }
public: public:
void vSWPrintf(const char* format, XTOOLS_VA_LIST va) void vSWPrintf(const char* format, XTOOLS_VA_LIST va)

View File

@ -352,7 +352,7 @@ public:
//// template<class O> //// template<class O>
//// ThisXStringClass& operator =(const O* S) { strcpy(S); return *this; } //// ThisXStringClass& operator =(const O* S) { strcpy(S); return *this; }
//--------------------------------------------------------------------- indexOf, rindexOf, contains, subString //--------------------------------------------------------------------- indexOf, rindexOf, contains, subString, startWith
/* indexOf */ /* indexOf */
size_t indexOf(char32_t char32Searched, size_t Pos = 0) const size_t indexOf(char32_t char32Searched, size_t Pos = 0) const
@ -501,7 +501,7 @@ public:
// return true; // return true;
//} //}
//--------------------------------------------------------------------- //--------------------------------------------------------------------- strcmp, equal, comparison operator
template<typename O> template<typename O>
int strcmp(const O* S) const { return XStringAbstract__compare(m_data, S, false); } int strcmp(const O* S) const { return XStringAbstract__compare(m_data, S, false); }
@ -997,7 +997,8 @@ public:
{ {
if ( other && *other && other_len > 0 ) { if ( other && *other && other_len > 0 ) {
size_t currentSize = size_of_utf_string(m_data); size_t currentSize = size_of_utf_string(m_data);
size_t newSize = currentSize + utf_size_of_utf_string_len(m_data, other, other_len); size_t other_size = utf_size_of_utf_string_len(m_data, other, other_len);
size_t newSize = currentSize + other_size;
CheckSize(newSize, 0); CheckSize(newSize, 0);
utf_string_from_utf_string_len(m_data+currentSize, m_allocatedSize, other, other_len); utf_string_from_utf_string_len(m_data+currentSize, m_allocatedSize, other, other_len);
m_data[newSize] = 0; m_data[newSize] = 0;
@ -1005,7 +1006,21 @@ public:
// nothing to do // nothing to do
} }
} }
/* strsicat */
template<typename O>
void strsicat(const O* other, size_t other_size)
{
if ( other && *other && other_size > 0 ) {
size_t currentSize = size_of_utf_string(m_data);
size_t newSize = currentSize + other_size;
CheckSize(newSize, 0);
utf_string_from_utf_string_len(m_data+currentSize, m_allocatedSize, other, other_size);
m_data[newSize] = 0;
}else{
// nothing to do
}
}
/* insert char* */ /* insert char* */
template<typename O> template<typename O>
ThisXStringClass& insertAtPos(const O* other, size_t other_len, size_t pos) ThisXStringClass& insertAtPos(const O* other, size_t other_len, size_t pos)
@ -1188,6 +1203,13 @@ public:
} }
} }
/* size is in number of technical chars, NOT in bytes */
ThisXStringClass& stealValueFrom(T* S, size_t size) {
if ( m_allocatedSize > 0 ) free((void*)m_data);
m_data = S;
m_allocatedSize = size;
return *((ThisXStringClass*)this);
}
ThisXStringClass& stealValueFrom(T* S) { ThisXStringClass& stealValueFrom(T* S) {
if ( m_allocatedSize > 0 ) free((void*)m_data); if ( m_allocatedSize > 0 ) free((void*)m_data);

View File

@ -515,7 +515,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
CUSTOM_LOADER_ENTRY& Custom = GlobalConfig.CustomEntries[CustomIndex]; CUSTOM_LOADER_ENTRY& Custom = GlobalConfig.CustomEntries[CustomIndex];
if ( Custom.settings.Disabled ) continue; // before, disabled entries settings weren't loaded. if ( Custom.settings.Disabled ) continue; // before, disabled entries settings weren't loaded.
// Check if the custom entry is hidden or disabled // Check if the custom entry is hidden or disabled
if ( OSFLAG_ISSET(Custom.getFlags(gSettings.NoCaches), OSFLAG_DISABLED) || Custom.settings.Hidden ) { if ( OSFLAG_ISSET(Custom.getFlags(gSettings.SystemParameters.NoCaches), OSFLAG_DISABLED) || Custom.settings.Hidden ) {
INTN volume_match=0; INTN volume_match=0;
INTN volume_type_match=0; INTN volume_type_match=0;
@ -1055,7 +1055,7 @@ LOADER_ENTRY* AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XString8Arr
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_CHECKFAKESMC); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_CHECKFAKESMC);
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS); // Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS);
// } // }
if (gSettings.NoCaches) { if (gSettings.SystemParameters.NoCaches) {
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NOCACHES); Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NOCACHES);
} }
} }
@ -1894,7 +1894,7 @@ STATIC void AddCustomSubEntry(REFIT_VOLUME *Volume,
// do { // when not scanning for kernels, this loop will execute only once // do { // when not scanning for kernels, this loop will execute only once
XString8Array CustomOptions = Custom.getLoadOptions(); XString8Array CustomOptions = Custom.getLoadOptions();
UINT8 newCustomFlags = Custom.getFlags(gSettings.NoCaches); UINT8 newCustomFlags = Custom.getFlags(gSettings.SystemParameters.NoCaches);
// Create an entry for this volume // Create an entry for this volume
Entry = CreateLoaderEntry(CustomPath, CustomOptions, Custom.getFullTitle(), Custom.getTitle(), Volume, Entry = CreateLoaderEntry(CustomPath, CustomOptions, Custom.getFullTitle(), Custom.getTitle(), Volume,
@ -1975,7 +1975,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex,
return; return;
} }
if (OSFLAG_ISSET(Custom.getFlags(gSettings.NoCaches), OSFLAG_DISABLED)) { if (OSFLAG_ISSET(Custom.getFlags(gSettings.SystemParameters.NoCaches), OSFLAG_DISABLED)) {
// DBG("Custom %lsentry %llu skipped because it is disabled.\n", IsSubEntry ? L"sub " : L"", CustomIndex); // DBG("Custom %lsentry %llu skipped because it is disabled.\n", IsSubEntry ? L"sub " : L"", CustomIndex);
return; return;
} }
@ -2151,13 +2151,13 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex,
break; break;
} }
UINT8 newCustomFlags = Custom.getFlags(gSettings.NoCaches); UINT8 newCustomFlags = Custom.getFlags(gSettings.SystemParameters.NoCaches);
// Check to make sure if we should update linux custom options or not // Check to make sure if we should update linux custom options or not
if (FindCustomPath && Custom.settings.Type == OSTYPE_LINEFI && OSFLAG_ISUNSET(Custom.getFlags(gSettings.NoCaches), OSFLAG_NODEFAULTARGS)) { if (FindCustomPath && Custom.settings.Type == OSTYPE_LINEFI && OSFLAG_ISUNSET(Custom.getFlags(gSettings.SystemParameters.NoCaches), OSFLAG_NODEFAULTARGS)) {
// Find the init ram image and select root // Find the init ram image and select root
CustomOptions = LinuxKernelOptions(Iter->DirHandle, Basename(CustomPath.wc_str()) + LINUX_LOADER_PATH.length(), PartUUID, Custom.getLoadOptions()); CustomOptions = LinuxKernelOptions(Iter->DirHandle, Basename(CustomPath.wc_str()) + LINUX_LOADER_PATH.length(), PartUUID, Custom.getLoadOptions());
newCustomFlags = OSFLAG_SET(Custom.getFlags(gSettings.NoCaches), OSFLAG_NODEFAULTARGS); newCustomFlags = OSFLAG_SET(Custom.getFlags(gSettings.SystemParameters.NoCaches), OSFLAG_NODEFAULTARGS);
} }
// Check to make sure that this entry is not hidden or disabled by another custom entry // Check to make sure that this entry is not hidden or disabled by another custom entry

View File

@ -113,7 +113,7 @@ void DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
// Only for non-legacy entries, as LEGACY_ENTRY doesn't have OSVersion // Only for non-legacy entries, as LEGACY_ENTRY doesn't have OSVersion
if (gSettings.OptionsBits & OPT_NVWEBON) { if (gSettings.OptionsBits & OPT_NVWEBON) {
if ( loaderEntry->macOSVersion >= MacOsVersion("10.12"_XS8) ) { if ( loaderEntry->macOSVersion >= MacOsVersion("10.12"_XS8) ) {
gSettings.NvidiaWeb = TRUE; gSettings.SystemParameters.NvidiaWeb = TRUE;
} else { } else {
//Entry->LoadOptions = loaderEntry->LoadOptions; //Entry->LoadOptions = loaderEntry->LoadOptions;
// Entry->LoadOptions = Split<XString8Array>(loaderEntry->LoadOptions.ConcatAll(" "_XS8).wc_str(), " "); // Entry->LoadOptions = Split<XString8Array>(loaderEntry->LoadOptions.ConcatAll(" "_XS8).wc_str(), " ");
@ -122,7 +122,7 @@ void DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
} }
if ((gSettings.OptionsBits & OPT_NVWEBON) == 0) { if ((gSettings.OptionsBits & OPT_NVWEBON) == 0) {
if ( loaderEntry->macOSVersion >= MacOsVersion("10.12"_XS8)) { if ( loaderEntry->macOSVersion >= MacOsVersion("10.12"_XS8)) {
gSettings.NvidiaWeb = FALSE; gSettings.SystemParameters.NvidiaWeb = FALSE;
} else { } else {
//Entry->LoadOptions = loaderEntry->LoadOptions; //Entry->LoadOptions = loaderEntry->LoadOptions;
// Entry->LoadOptions = Split<XString8Array>(loaderEntry->LoadOptions.ConcatAll(" "_XS8).wc_str(), " "); // Entry->LoadOptions = Split<XString8Array>(loaderEntry->LoadOptions.ConcatAll(" "_XS8).wc_str(), " ");

View File

@ -1295,7 +1295,7 @@ static unsigned int nsvg__parseColorHex(const char* str)
while(str[n] && IsHexDigit(str[n])) while(str[n] && IsHexDigit(str[n]))
n++; n++;
if (n == 6) { if (n == 6) {
n = hex2bin((CHAR8*)str, (UINT8*)&c, 3); //big endian n = hex2bin((CHAR8*)str, 6, (UINT8*)&c, 3); //big endian
b = (c >> 16) & 0xff; b = (c >> 16) & 0xff;
g = (c >> 8) & 0xff; g = (c >> 8) & 0xff;
r = c & 0xff; r = c & 0xff;

View File

@ -399,11 +399,11 @@ void DumpKernelAndKextPatches(KERNEL_AND_KEXT_PATCHES *Patches)
DBG("\tFakeCPUID: 0x%X\n", Patches->FakeCPUID); DBG("\tFakeCPUID: 0x%X\n", Patches->FakeCPUID);
DBG("\tATIController: %s\n", Patches->KPATIConnectorsController.isEmpty() ? "(null)": Patches->KPATIConnectorsController.c_str()); DBG("\tATIController: %s\n", Patches->KPATIConnectorsController.isEmpty() ? "(null)": Patches->KPATIConnectorsController.c_str());
DBG("\tATIDataLength: %zu\n", Patches->KPATIConnectorsData.size()); DBG("\tATIDataLength: %zu\n", Patches->KPATIConnectorsData.size());
DBG("\t%zu Kexts to load\n", Patches->ForceKexts.size()); DBG("\t%zu Kexts to load\n", Patches->ForceKextsToLoad.size());
if (Patches->ForceKexts.size()) { if (Patches->ForceKextsToLoad.size()) {
size_t i = 0; size_t i = 0;
for (; i < Patches->ForceKexts.size(); ++i) { for (; i < Patches->ForceKextsToLoad.size(); ++i) {
DBG("\t KextToLoad[%zu]: %ls\n", i, Patches->ForceKexts[i].wc_str()); DBG("\t KextToLoad[%zu]: %ls\n", i, Patches->ForceKextsToLoad[i].wc_str());
} }
} }
DBG("\t%zu Kexts to patch\n", Patches->KextPatches.size()); DBG("\t%zu Kexts to patch\n", Patches->KextPatches.size());
@ -687,7 +687,7 @@ MsgLog("debugStartImageWithOC\n");
#endif #endif
void LOADER_ENTRY::DelegateKernelPatches() void LOADER_ENTRY::DelegateKernelPatches()
{ {
XObjArray<KEXT_PATCH> selectedPathArray; XObjArray<ABSTRACT_KEXT_OR_KERNEL_PATCH> selectedPathArray;
for (size_t kextPatchIdx = 0 ; kextPatchIdx < KernelAndKextPatches.KextPatches.size() ; kextPatchIdx++ ) for (size_t kextPatchIdx = 0 ; kextPatchIdx < KernelAndKextPatches.KextPatches.size() ; kextPatchIdx++ )
{ {
if ( KernelAndKextPatches.KextPatches[kextPatchIdx].MenuItem.BValue ) if ( KernelAndKextPatches.KextPatches[kextPatchIdx].MenuItem.BValue )
@ -706,7 +706,7 @@ void LOADER_ENTRY::DelegateKernelPatches()
for (size_t kextPatchIdx = 0 ; kextPatchIdx < selectedPathArray.size() ; kextPatchIdx++ ) for (size_t kextPatchIdx = 0 ; kextPatchIdx < selectedPathArray.size() ; kextPatchIdx++ )
{ {
const KEXT_PATCH& kextPatch = selectedPathArray[kextPatchIdx]; //as well as kernel patches const ABSTRACT_KEXT_OR_KERNEL_PATCH& kextPatch = selectedPathArray[kextPatchIdx]; //as well as kernel patches
DBG("Bridge %s patch to OC : %s\n", kextPatch.Name.c_str(), kextPatch.Label.c_str()); DBG("Bridge %s patch to OC : %s\n", kextPatch.Name.c_str(), kextPatch.Label.c_str());
mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx] = (__typeof_am__(*mOpenCoreConfiguration.Kernel.Patch.Values))AllocateZeroPool(mOpenCoreConfiguration.Kernel.Patch.ValueSize); // sizeof(OC_KERNEL_ADD_ENTRY) == 680 mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx] = (__typeof_am__(*mOpenCoreConfiguration.Kernel.Patch.Values))AllocateZeroPool(mOpenCoreConfiguration.Kernel.Patch.ValueSize); // sizeof(OC_KERNEL_ADD_ENTRY) == 680
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Arch, OC_BLOB_GET(&mOpenCoreConfiguration.Kernel.Scheme.KernelArch)); OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Arch, OC_BLOB_GET(&mOpenCoreConfiguration.Kernel.Scheme.KernelArch));
@ -1014,9 +1014,11 @@ void LOADER_ENTRY::StartLoader()
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Scheme.KernelArch, "x86_64"); OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Scheme.KernelArch, "x86_64");
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Scheme.KernelCache, gSettings.KernelAndKextPatches.OcKernelCache.c_str()); OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Scheme.KernelCache, gSettings.Quirks.OcKernelCache.c_str());
mOpenCoreConfiguration.Kernel.Scheme.FuzzyMatch = gSettings.KernelAndKextPatches.FuzzyMatch; mOpenCoreConfiguration.Kernel.Scheme.FuzzyMatch = gSettings.Quirks.FuzzyMatch;
memcpy(&mOpenCoreConfiguration.Kernel.Quirks, &gSettings.KernelAndKextPatches.OcKernelQuirks, sizeof(mOpenCoreConfiguration.Kernel.Quirks)); memcpy(&mOpenCoreConfiguration.Kernel.Quirks, &gSettings.Quirks.OcKernelQuirks, sizeof(mOpenCoreConfiguration.Kernel.Quirks));
gSettings.Quirks.OcKernelQuirks.AppleXcpmCfgLock = GlobalConfig.KPKernelPm;
gSettings.Quirks.OcKernelQuirks.AppleCpuPmCfgLock = GlobalConfig.KPAppleIntelCPUPM;
mOpenCoreConfiguration.Kernel.Add.Count = (UINT32)kextArray.size(); mOpenCoreConfiguration.Kernel.Add.Count = (UINT32)kextArray.size();
mOpenCoreConfiguration.Kernel.Add.AllocCount = mOpenCoreConfiguration.Kernel.Add.Count; mOpenCoreConfiguration.Kernel.Add.AllocCount = mOpenCoreConfiguration.Kernel.Add.Count;
@ -1118,9 +1120,9 @@ void LOADER_ENTRY::StartLoader()
//DelegateKernelPatches(); //DelegateKernelPatches();
for (size_t forceKextIdx = 0 ; forceKextIdx < KernelAndKextPatches.ForceKexts.size() ; forceKextIdx++ ) for (size_t forceKextIdx = 0 ; forceKextIdx < KernelAndKextPatches.ForceKextsToLoad.size() ; forceKextIdx++ )
{ {
const XStringW& forceKext = KernelAndKextPatches.ForceKexts[forceKextIdx]; const XStringW& forceKext = KernelAndKextPatches.ForceKextsToLoad[forceKextIdx];
DBG("TODO !!!!!!!! Bridge force kext to OC : %ls\n", forceKext.wc_str()); DBG("TODO !!!!!!!! Bridge force kext to OC : %ls\n", forceKext.wc_str());
} }
#endif #endif
@ -2323,7 +2325,7 @@ void SetVariablesFromNvram()
tmpString = (__typeof__(tmpString))GetNvramVariable(L"nvda_drv", &gEfiAppleBootGuid, NULL, NULL); tmpString = (__typeof__(tmpString))GetNvramVariable(L"nvda_drv", &gEfiAppleBootGuid, NULL, NULL);
if (tmpString && AsciiStrCmp(tmpString, "1") == 0) { if (tmpString && AsciiStrCmp(tmpString, "1") == 0) {
gSettings.NvidiaWeb = TRUE; gSettings.SystemParameters.NvidiaWeb = TRUE;
} }
if (tmpString) { if (tmpString) {
FreePool(tmpString); FreePool(tmpString);
@ -2691,6 +2693,9 @@ void afterGetUserSettings(const SETTINGS_DATA& gSettings)
} }
} }
GlobalConfig.KPKernelPm = gSettings.KernelAndKextPatches._KPKernelPm || GlobalConfig.NeedPMfix;
GlobalConfig.KPAppleIntelCPUPM = gSettings.KernelAndKextPatches._KPAppleIntelCPUPM || GlobalConfig.NeedPMfix;
} }
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View File

@ -181,7 +181,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Decimal; //17 InputItems[InputItemsCount].ItemType = Decimal; //17
InputItems[InputItemsCount++].SValue.SWPrintf("0x%llX", gPlatformFeature); InputItems[InputItemsCount++].SValue.SWPrintf("0x%llX", gPlatformFeature);
InputItems[InputItemsCount].ItemType = Hex; //18 InputItems[InputItemsCount].ItemType = Hex; //18
InputItems[InputItemsCount++].SValue.SWPrintf("0x%hX", gSettings.BacklightLevel); InputItems[InputItemsCount++].SValue.SWPrintf("0x%hX", gSettings.SystemParameters.BacklightLevel);
InputItems[InputItemsCount].ItemType = Decimal; //19 InputItems[InputItemsCount].ItemType = Decimal; //19
if (gSettings.CPU.BusSpeed > 20000) { if (gSettings.CPU.BusSpeed > 20000) {
InputItems[InputItemsCount++].SValue.SWPrintf("%06d", gSettings.CPU.BusSpeed); InputItems[InputItemsCount++].SValue.SWPrintf("%06d", gSettings.CPU.BusSpeed);
@ -250,11 +250,11 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = BoolValue; //45 InputItems[InputItemsCount].ItemType = BoolValue; //45
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.EightApple; InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.EightApple;
InputItems[InputItemsCount].ItemType = BoolValue; //46 InputItems[InputItemsCount].ItemType = BoolValue; //46
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPAppleIntelCPUPM; InputItems[InputItemsCount++].BValue = GlobalConfig.KPAppleIntelCPUPM;
InputItems[InputItemsCount].ItemType = BoolValue; //47 InputItems[InputItemsCount].ItemType = BoolValue; //47
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPAppleRTC; InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPAppleRTC;
InputItems[InputItemsCount].ItemType = BoolValue; //48 InputItems[InputItemsCount].ItemType = BoolValue; //48
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPKernelPm; InputItems[InputItemsCount++].BValue = GlobalConfig.KPKernelPm;
InputItems[InputItemsCount].ItemType = BoolValue; //49 InputItems[InputItemsCount].ItemType = BoolValue; //49
InputItems[InputItemsCount++].BValue = gSettings.ACPI.FixMCFG; InputItems[InputItemsCount++].BValue = gSettings.ACPI.FixMCFG;
@ -277,7 +277,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = BoolValue; //55 InputItems[InputItemsCount].ItemType = BoolValue; //55
InputItems[InputItemsCount++].BValue = gSettings.NvidiaGeneric; InputItems[InputItemsCount++].BValue = gSettings.NvidiaGeneric;
InputItems[InputItemsCount].ItemType = BoolValue; //56 InputItems[InputItemsCount].ItemType = BoolValue; //56
InputItems[InputItemsCount++].BValue = gSettings.NvidiaWeb; InputItems[InputItemsCount++].BValue = gSettings.SystemParameters.NvidiaWeb;
InputItems[InputItemsCount].ItemType = BoolValue; //57 InputItems[InputItemsCount].ItemType = BoolValue; //57
InputItems[InputItemsCount++].BValue = gSettings.ResetHDA; InputItems[InputItemsCount++].BValue = gSettings.ResetHDA;
InputItems[InputItemsCount].ItemType = BoolValue; //58 InputItems[InputItemsCount].ItemType = BoolValue; //58
@ -425,7 +425,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = BoolValue; //114 InputItems[InputItemsCount].ItemType = BoolValue; //114
InputItems[InputItemsCount++].BValue = gSettings.DeInit; InputItems[InputItemsCount++].BValue = gSettings.DeInit;
InputItems[InputItemsCount].ItemType = BoolValue; //115 InputItems[InputItemsCount].ItemType = BoolValue; //115
InputItems[InputItemsCount++].BValue = gSettings.NoCaches; InputItems[InputItemsCount++].BValue = gSettings.SystemParameters.NoCaches;
InputItems[InputItemsCount].ItemType = RadioSwitch; //116 - DSDT chooser InputItems[InputItemsCount].ItemType = RadioSwitch; //116 - DSDT chooser
InputItems[InputItemsCount++].IValue = 116; InputItems[InputItemsCount++].IValue = 116;
@ -471,7 +471,6 @@ void ApplyInputs(void)
BOOLEAN NeedSave = TRUE; BOOLEAN NeedSave = TRUE;
INTN i = 0; INTN i = 0;
UINTN j; UINTN j;
CHAR8 AString[256];
// DBG("ApplyInputs\n"); // DBG("ApplyInputs\n");
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
@ -561,8 +560,8 @@ void ApplyInputs(void)
} }
i++; //18 | Download-Fritz: There is no GUI element for BacklightLevel; please revise i++; //18 | Download-Fritz: There is no GUI element for BacklightLevel; please revise
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.BacklightLevel = (UINT16)StrHexToUint64(InputItems[i].SValue.wc_str()); gSettings.SystemParameters.BacklightLevel = (UINT16)StrHexToUint64(InputItems[i].SValue.wc_str());
gSettings.BacklightLevelConfig = TRUE; gSettings.SystemParameters.BacklightLevelConfig = TRUE;
} }
i++; //19 i++; //19
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
@ -591,9 +590,7 @@ void ApplyInputs(void)
if (gGraphics[j].Vendor == Ati) { if (gGraphics[j].Vendor == Ati) {
gSettings.FBName = InputItems[i].SValue; gSettings.FBName = InputItems[i].SValue;
} else if (gGraphics[j].Vendor == Nvidia) { } else if (gGraphics[j].Vendor == Nvidia) {
ZeroMem(AString, 256); hex2bin(InputItems[i].SValue, (UINT8*)&gSettings.Dcfg[0], sizeof(gSettings.Dcfg));
snprintf(AString, 255, "%ls", InputItems[i].SValue.wc_str());
hex2bin(AString, (UINT8*)&gSettings.Dcfg[0], 8);
} else if (gGraphics[j].Vendor == Intel) { } else if (gGraphics[j].Vendor == Intel) {
//ig-platform-id for Ivy+ and snb-platform-id for Sandy //ig-platform-id for Ivy+ and snb-platform-id for Sandy
gSettings.IgPlatform = (UINT32)StrHexToUint64(InputItems[i].SValue.wc_str()); gSettings.IgPlatform = (UINT32)StrHexToUint64(InputItems[i].SValue.wc_str());
@ -613,10 +610,8 @@ void ApplyInputs(void)
i++; //24 i++; //24
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
if (gGraphics[j].Vendor == Nvidia) { if (gGraphics[j].Vendor == Nvidia) {
ZeroMem(AString, 256);
if ( InputItems[i].SValue.notEmpty() ) { if ( InputItems[i].SValue.notEmpty() ) {
snprintf(AString, 255, "%ls", InputItems[i].SValue.wc_str()); hex2bin(InputItems[i].SValue, (UINT8*)&gSettings.NVCAP[0], sizeof(gSettings.NVCAP));
hex2bin(AString, (UINT8*)&gSettings.NVCAP[0], 20);
} }
} else { } else {
gGraphics[j].Connectors = (UINT32)StrHexToUint64(InputItems[i].SValue.wc_str()); gGraphics[j].Connectors = (UINT32)StrHexToUint64(InputItems[i].SValue.wc_str());
@ -642,7 +637,7 @@ void ApplyInputs(void)
} }
i++; //46 i++; //46
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.KernelAndKextPatches.KPAppleIntelCPUPM = InputItems[i].BValue; GlobalConfig.KPAppleIntelCPUPM = InputItems[i].BValue;
GlobalConfig.gBootChanged = TRUE; GlobalConfig.gBootChanged = TRUE;
} }
i++; //47 i++; //47
@ -652,7 +647,7 @@ void ApplyInputs(void)
} }
i++; //48 i++; //48
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.KernelAndKextPatches.KPKernelPm = InputItems[i].BValue; GlobalConfig.KPKernelPm = InputItems[i].BValue;
GlobalConfig.gBootChanged = TRUE; GlobalConfig.gBootChanged = TRUE;
} }
i++; //49 i++; //49
@ -689,7 +684,7 @@ void ApplyInputs(void)
} }
i++; //56 i++; //56
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.NvidiaWeb = InputItems[i].BValue; gSettings.SystemParameters.NvidiaWeb = InputItems[i].BValue;
} }
i++; //57 i++; //57
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
@ -710,8 +705,8 @@ void ApplyInputs(void)
i++; //61 i++; //61
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.KernelAndKextPatches.KPDELLSMBIOS = InputItems[i].BValue; gSettings.KernelAndKextPatches.KPDELLSMBIOS = InputItems[i].BValue;
// yes, we do need to change gRemapSmBiosIsRequire here as well // // yes, we do need to change gRemapSmBiosIsRequire here as well
gRemapSmBiosIsRequire = InputItems[i].BValue; // gRemapSmBiosIsRequire = InputItems[i].BValue;
GlobalConfig.gBootChanged = TRUE; GlobalConfig.gBootChanged = TRUE;
} }
i++; //62 i++; //62
@ -999,7 +994,7 @@ void ApplyInputs(void)
} }
i++; //115 i++; //115
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.NoCaches = InputItems[i].BValue; gSettings.SystemParameters.NoCaches = InputItems[i].BValue;
} }
i++; //116 i++; //116
if (InputItems[i].Valid) { if (InputItems[i].Valid) {