Merge pull request #993 from dortania/web-driver-alpha

Implement Alpha Support for Nvidia Web Drivers
This commit is contained in:
Mykola Grymalyuk
2022-05-30 13:03:44 -06:00
committed by GitHub
16 changed files with 609 additions and 162 deletions

View File

@@ -18,6 +18,8 @@
- Downgrade AppleFSCompressionTypeZlib to 12.3.1 on pre-Sandy Bridge Macs
- Resolves ZLib decompression kernel panics on 12.4 and newer
- Resolve AppleGVACore crashing on MacBookPro11,3 in Monterey 12.4+
- Add Nvidia Web Driver support for Maxwell and Pascal
- Currently running in OpenGL mode, [non-Metal issues](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108) applicable
## 0.4.5
- Fix AutoPatcher.pkg download on releases

View File

@@ -3,8 +3,9 @@ class nvidia_ids:
# Courteous of envytools as well as Macrumors:
# https://envytools.readthedocs.io/en/latest/hw/pciid.html
# https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/
# https://pci-ids.ucw.cz/read/PC/10de
curie_ids = [
0x0040, # NV40 [GeForce 6800 Ultra]
0x0040, # NV40 [GeForce 6800 Ultra]
0x00f0, # BR02
0x0220, # NV44A
0x0140, # NV43 [GeForce 6600 GT]
@@ -525,76 +526,183 @@ class nvidia_ids:
maxwell_ids = [
0x1381, # GM107 [GeForce GTX 750]
0x1392, # GM107 [GeForce GTX 860M]
0x139a, # GM107 [GeForce GTX 950M]
0x139b, # GM107 [GeForce GTX 960M]
0x13b0, # GM107 [Quadro M2000M]
0x13BB, # GM107 [Quadro K620]
0x1340, # GM108M [GeForce 830M]
0x1341, # GM108M [GeForce 840M]
0x1344, # GM108M [GeForce 845M]
0x1346, # GM108M [GeForce 930M]
0x1347, # GM108M [GeForce 940M]
0x1348, # GM108M [GeForce 945M / 945A]
0x1349, # GM108M [GeForce 930M]
0x134b, # GM108M [GeForce 940MX]
0x134d, # GM108M [GeForce 940MX]
0x134e, # GM108M [GeForce 930MX]
0x134f, # GM108M [GeForce 920MX]
0x137a, # GM108GLM [Quadro K620M / Quadro M500M]
0x137b, # GM108GLM [Quadro M520 Mobile]
0x137d, # GM108M [GeForce 940A]
0x1340, # GM108
0x1341, # GM108 [GeForce 840M]
0x1346, # GM108 [GeForce 930M]
0x1347, # GM108 [GeForce 940M]
0x134d, # GM108 [GeForce 940MX]
0x1380, # GM107 [GeForce GTX 750 Ti]
0x1381, # GM107 [GeForce GTX 750]
0x1382, # GM107 [GeForce GTX 745]
0x1389, # GM107GL [GRID M30]
0x1390, # GM107M [GeForce 845M]
0x1391, # GM107M [GeForce GTX 850M]
0x1392, # GM107M [GeForce GTX 860M]
0x1393, # GM107M [GeForce 840M]
0x1398, # GM107M [GeForce 845M]
0x1399, # GM107M [GeForce 945M]
0x139a, # GM107M [GeForce GTX 950M]
0x139b, # GM107M [GeForce GTX 960M]
0x139c, # GM107M [GeForce 940M]
0x139d, # GM107M [GeForce GTX 750 Ti]
0x13b0, # GM107GLM [Quadro M2000M]
0x13b1, # GM107GLM [Quadro M1000M]
0x13b2, # GM107GLM [Quadro M600M]
0x13b3, # GM107GLM [Quadro K2200M]
0x13b4, # GM107GLM [Quadro M620 Mobile]
0x13b6, # GM107GLM [Quadro M1200 Mobile]
0x13b9, # GM107GL [NVS 810]
0x13ba, # GM107GL [Quadro K2200]
0x13bb, # GM107GL [Quadro K620]
0x13bc, # GM107GL [Quadro K1200]
0x13bd, # GM107GL [Tesla M10]
0x13c0, # GM204 [GeForce GTX 980]
0x13c2, # GM204 [GeForce GTX 970]
0x13d7, # GM204 [GeForce GTX 980M]
0x13d8, # GM204 [GeForce GTX 970M]
0x13d9, # GM204 [GeForce GTX 965M]
0x13c0, # GM204 [GeForce GTX 980]
0x13c1, # GM204
0x13c2, # GM204 [GeForce GTX 970]
0x13c3, # GM204
0x13d7, # GM204M [GeForce GTX 980M]
0x13d8, # GM204M [GeForce GTX 970M]
0x13d9, # GM204M [GeForce GTX 965M]
0x13da, # GM204M [GeForce GTX 980 Mobile]
0x13e7, # GM204GL [GeForce GTX 980 Engineering Sample]
0x13f0, # GM204GL [Quadro M5000]
0x13f1, # GM204GL [Quadro M4000]
0x13f2, # GM204GL [Tesla M60]
0x13f3, # GM204GL [Tesla M6]
0x13f8, # GM204GLM [Quadro M5000M / M5000 SE]
0x13f9, # GM204GLM [Quadro M4000M]
0x13fa, # GM204GLM [Quadro M3000M]
0x13fb, # GM204GLM [Quadro M5500]
0x1401, # GM206 [GeForce GTX 960]
0x1407, # GM206 [GeForce GTX 750 v2]
0x1427, # GM206 [GeForce GTX 965M v2]
0x1401, # GM206 [GeForce GTX 960]
0x1402, # GM206 [GeForce GTX 950]
0x1404, # GM206 [GeForce GTX 960 FAKE]
0x1406, # GM206 [GeForce GTX 960 OEM]
0x1407, # GM206 [GeForce GTX 750 v2]
0x1427, # GM206M [GeForce GTX 965M]
0x1430, # GM206GL [Quadro M2000]
0x1431, # GM206GL [Tesla M4]
0x1436, # GM206GLM [Quadro M2200 Mobile]
]
pascal_ids = [
0x15f7, # GP100 [Tesla P100 PCIe 12GB]
0x15f8, # GP100 [Tesla P100 PCIe 16GB]
0x15f9, # GP100 [Tesla P100 SXM2 16GB]
0x15f0, # GP100GL [Quadro GP100]
0x15f1, # GP100GL
0x15f7, # GP100GL [Tesla P100 PCIe 12GB]
0x15f8, # GP100GL [Tesla P100 PCIe 16GB]
0x15f9, # GP100GL [Tesla P100 SXM2 16GB]
0x1b00, # GP102 [GeForce TITAN X]
0x1b02, # GP102 [GeForce TITAN Xp]
0x1b06, # GP102 [GeForce GTX 1080 Ti]
0x1b30, # GP102 [Quadro P6000]
0x1b38, # GP102 [Tesla P40]
0x1b00, # GP102 [TITAN X]
0x1b01, # GP102 [GeForce GTX 1080 Ti 10GB]
0x1b02, # GP102 [TITAN Xp]
0x1b04, # GP102
0x1b06, # GP102 [GeForce GTX 1080 Ti]
0x1b07, # GP102 [P102-100]
0x1b30, # GP102GL [Quadro P6000]
0x1b38, # GP102GL [Tesla P40]
0x1b39, # GP102GL [Tesla P10]
0x1b70, # GP102GL
0x1b78, # GP102GL
0x1b80, # GP104 [GeForce GTX 1080]
0x1b81, # GP104 [GeForce GTX 1070]
0x1b82, # GP104 [GeForce GTX 1070 Ti]
0x1b83, # GP104 [GeForce GTX 1060 6GB]
0x1b84, # GP104 [GeForce GTX 1060 3GB]
0x1ba0, # GP104 [GeForce GTX 1080 Mobile]
0x1ba1, # GP104 [GeForce GTX 1070 Mobile]
0x1ba2, # GP104 [GeForce GTX 1070 Mobile]
0x1bb0, # GP104 [Quadro P5000]
0x1bb3, # GP104 [Tesla P4]
0x1bb6, # GP104 [Quadro P5000 Mobile]
0x1bb7, # GP104 [Quadro P4000 Mobile]
0x1bb8, # GP104 [Quadro P3000 Mobile]
0x1be0, # GP104 [GeForce GTX 1080 Mobile]
0x1be1, # GP104 [GeForce GTX 1070 Mobile]
0x1b80, # GP104 [GeForce GTX 1080]
0x1b81, # GP104 [GeForce GTX 1070]
0x1b82, # GP104 [GeForce GTX 1070 Ti]
0x1b83, # GP104 [GeForce GTX 1060 6GB]
0x1b84, # GP104 [GeForce GTX 1060 3GB]
0x1b87, # GP104 [P104-100]
0x1ba0, # GP104M [GeForce GTX 1080 Mobile]
0x1ba1, # GP104M [GeForce GTX 1070 Mobile]
0x1ba2, # GP104M [GeForce GTX 1070 Mobile]
0x1ba9, # GP104M
0x1baa, # GP104M
0x1bad, # GP104 [GeForce GTX 1070 Engineering Sample]
0x1bb0, # GP104GL [Quadro P5000]
0x1bb1, # GP104GL [Quadro P4000]
0x1bb3, # GP104GL [Tesla P4]
0x1bb4, # GP104GL [Tesla P6]
0x1bb5, # GP104GLM [Quadro P5200 Mobile]
0x1bb6, # GP104GLM [Quadro P5000 Mobile]
0x1bb7, # GP104GLM [Quadro P4000 Mobile]
0x1bb8, # GP104GLM [Quadro P3000 Mobile]
0x1bb9, # GP104GLM [Quadro P4200 Mobile]
0x1bbb, # GP104GLM [Quadro P3200 Mobile]
0x1bc7, # GP104 [P104-101]
0x1be0, # GP104BM [GeForce GTX 1080 Mobile]
0x1be1, # GP104BM [GeForce GTX 1070 Mobile]
0x1c02, # GP106 [GeForce GTX 1060 3GB]
0x1c03, # GP106 [GeForce GTX 1060 6GB]
0x1c20, # GP106 [GeForce GTX 1060 Mobile]
0x1c23, # GP106 [GeForce GTX 1060]
0x1c60, # GP106 [GeForce GTX 1060 Mobile]
0x1c61, # GP106 [GeForce GTX 1050 Ti Mobile]
0x1c62, # GP106 [GeForce GTX 1050 Mobile]
0x1c00, # GP106
0x1c01, # GP106
0x1c02, # GP106 [GeForce GTX 1060 3GB]
0x1c03, # GP106 [GeForce GTX 1060 6GB]
0x1c04, # GP106 [GeForce GTX 1060 5GB]
0x1c06, # GP106 [GeForce GTX 1060 6GB Rev. 2]
0x1c07, # GP106 [P106-100]
0x1c09, # GP106 [P106-090]
0x1c20, # GP106M [GeForce GTX 1060 Mobile]
0x1c21, # GP106M [GeForce GTX 1050 Ti Mobile]
0x1c22, # GP106M [GeForce GTX 1050 Mobile]
0x1c23, # GP106M [GeForce GTX 1060 Mobile Rev. 2]
0x1c2d, # GP106M
0x1c30, # GP106GL [Quadro P2000]
0x1c31, # GP106GL [Quadro P2200]
0x1c35, # GP106M [Quadro P2000 Mobile]
0x1c36, # GP106 [P106M]
0x1c60, # GP106BM [GeForce GTX 1060 Mobile 6GB]
0x1c61, # GP106BM [GeForce GTX 1050 Ti Mobile]
0x1c62, # GP106BM [GeForce GTX 1050 Mobile]
0x1c70, # GP106GL
0x1c81, # GP107 [GeForce GTX 1050]
0x1c82, # GP107 [GeForce GTX 1050 Ti]
0x1c83, # GP107 [GeForce GTX 1050 3GB]
0x1c8c, # GP107 [GeForce GTX 1050 Ti Mobile]
0x1c8d, # GP107 [GeForce GTX 1050 Mobile]
0x1c8f, # GP107 [GeForce GTX 1050 Ti Max-Q]
0x1c92, # GP107 [GeForce GTX 1050 Max-Q]
0x1c80,
0x1c81, # GP107 [GeForce GTX 1050]
0x1c82, # GP107 [GeForce GTX 1050 Ti]
0x1c83, # GP107 [GeForce GTX 1050 3GB]
0x1c8c, # GP107M [GeForce GTX 1050 Ti Mobile]
0x1c8d, # GP107M [GeForce GTX 1050 Mobile]
0x1c8e, # GP107M
0x1c8f, # GP107M [GeForce GTX 1050 Ti Max-Q]
0x1c90, # GP107M [GeForce MX150]
0x1c91, # GP107M [GeForce GTX 1050 3 GB Max-Q]
0x1c92, # GP107M [GeForce GTX 1050 Mobile]
0x1c94, # GP107M [GeForce MX350]
0x1c96, # GP107M [GeForce MX350]
0x1ca7, # GP107GL
0x1ca8, # GP107GL
0x1caa, # GP107GL
0x1cb1, # GP107GL [Quadro P1000]
0x1cb2, # GP107GL [Quadro P600]
0x1cb3, # GP107GL [Quadro P400]
0x1cb6, # GP107GL [Quadro P620]
0x1cba, # GP107GLM [Quadro P2000 Mobile]
0x1cbb, # GP107GLM [Quadro P1000 Mobile]
0x1cbc, # GP107GLM [Quadro P600 Mobile]
0x1cbd, # GP107GLM [Quadro P620]
0x1ccc, # GP107BM [GeForce GTX 1050 Ti Mobile]
0x1ccd, # GP107BM [GeForce GTX 1050 Mobile]
0x1cfa, # GP107GL [Quadro P2000]
0x1cfb, # GP107GL [Quadro P1000]
0x1d01, # GP108 [GeForce GT 1030]
0x1d10, # GP108 [GeForce MX150]
0x1d12, # GP108 [GeForce MX150]
0x1d01, # GP108 [GeForce GT 1030]
0x1d02, # GP108 [GeForce GT 1010]
0x1d10, # GP108M [GeForce MX150]
0x1d11, # GP108M [GeForce MX230]
0x1d12, # GP108M [GeForce MX150]
0x1d13, # GP108M [GeForce MX250]
0x1d16, # GP108M [GeForce MX330]
0x1d33, # GP108GLM [Quadro P500 Mobile]
0x1d34, # GP108GLM [Quadro P520]
0x1d52, # GP108BM [GeForce MX250]
0x1d56, # GP108BM [GeForce MX330]
]
@@ -675,7 +783,7 @@ class amd_ids:
0x67E9, # Unknown
# AMDEllesmereGraphicsAccelerator - AMD9500Controller
0x67C0, # Pro WX 7100 Mobile
0x67C1, # Unknown
0x67C1, # Unknown
0x67C2, # Pro V7300X / V7350x2
0x67C4, # Pro WX 7100
0x67C7, # Pro WX 5100

View File

@@ -126,6 +126,14 @@ class system_integrity_protection:
"CSR_ALLOW_UNAUTHENTICATED_ROOT", # 0x800 - Required to avoid KC mismatch kernel panic
]
root_patch_sip_big_sur_3rd_part_kexts = [
# Variables required to root patch in Big Sur and Monterey with 3rd party kexts
"CSR_ALLOW_UNTRUSTED_KEXTS", # 0x1 - Required for Aux Cache in Big Sur+
"CSR_ALLOW_UNRESTRICTED_FS", # 0x2 - Required to mount and edit root volume, as well as load modded platform binaries
"CSR_ALLOW_UNAUTHENTICATED_ROOT", # 0x800 - Required to avoid KC mismatch kernel panic
"CSR_ALLOW_UNAPPROVED_KEXTS", # 0x200 - Required for Aux Cache in Big Sur+
]
# CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE (introduced with Mojave):
# This bit is quite strange and was originally assumed to be required for modded platform binaries
# However after extensive testing, this doesn't seem true. In addition, this bit is never flipped via

View File

@@ -123,6 +123,26 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
},
"Non-Metal CoreDisplay Common": {
# Nvidia Web Drivers require an older build of CoreDisplay
"Display Name": "",
"OS Support": {
"Minimum OS Support": {
"OS Major": non_metal_os_support[0],
"OS Minor": 0
},
"Maximum OS Support": {
"OS Major": non_metal_os_support[-1],
"OS Minor": 99
},
},
"Install": {
"/System/Library/Frameworks": {
"CoreDisplay.framework": f"10.13.6-{os_major}",
},
},
},
"Non-Metal Enforcement": {
# Forces Metal kexts from High Sierra to run in the fallback non-Metal mode
# Verified functional with HD4000 and Iris Plus 655
@@ -324,9 +344,25 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
"NVDANV50HalTeslaWeb.kext": "WebDriver-387.10.10.10.40.140",
"NVDAResmanTeslaWeb.kext": "WebDriver-387.10.10.10.40.140",
},
"/Library/PreferencePanes": {
"NVIDIA Driver Manager.prefPane": "WebDriver-387.10.10.10.40.140",
},
# Disabled due to issues with Pref pane stripping 'nvda_drv' NVRAM
# variables
# "/Library/PreferencePanes": {
# "NVIDIA Driver Manager.prefPane": "WebDriver-387.10.10.10.40.140",
# },
# "/Library/LaunchAgents": {
# "com.nvidia.nvagent.plist": "WebDriver-387.10.10.10.40.140",
# },
# "/Library/LaunchDaemons": {
# "com.nvidia.nvroothelper.plist": "WebDriver-387.10.10.10.40.140",
# },
},
"Remove": {
"/System/Library/Extensions": [
# Due to how late the Auxiliary cache loads, NVDAStartup will match first and then the Web Driver kexts.
# This has no effect for Maxwell and Pascal, however for development purposes, Tesla and Kepler are partially supported.
"NVDAStartup.kext",
],
},
},
"AMD TeraScale Common": {

View File

@@ -164,7 +164,8 @@ class wx_python_gui:
def preflight_check(self):
if (
self.constants.computer.build_model != None and
self.constants.computer.build_model != self.constants.computer.real_model
self.constants.computer.build_model != self.constants.computer.real_model and
self.constants.host_is_hackintosh is False
):
# Notify user they're booting an unsupported configuration
self.constants.start_build_install = True
@@ -366,9 +367,16 @@ class wx_python_gui:
self.build_install.Centre(wx.HORIZONTAL)
# Disable button if real_model not in model_array.SupportedSMBIOS
if self.constants.allow_oc_everywhere is False and \
self.constants.custom_model is None and \
self.computer.real_model not in model_array.SupportedSMBIOS:
if (
(
self.constants.allow_oc_everywhere is False and \
self.constants.custom_model is None and \
self.computer.real_model not in model_array.SupportedSMBIOS
) or (
self.constants.custom_model is None and \
self.constants.host_is_hackintosh is True
)
):
self.build_install.Disable()
self.build_install.SetToolTip(wx.ToolTip("""If building for a native Mac model, \nselect 'Allow Native Models' in Settings.\nIf building for another Mac, change model in Settings"""))
@@ -932,11 +940,11 @@ class wx_python_gui:
for patch in patches:
if patch.startswith("Validation") and patches[patch] is True:
print(f"- Adding check: {patch} - {patches[patch]}")
self.patch_label = wx.StaticText(self.frame_modal, label=f"- {patch.lstrip('Validation: ')}")
self.patch_label = wx.StaticText(self.frame_modal, label=f"- {patch[12:]}")
self.patch_label.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.patch_label.SetPosition(
wx.Point(
self.subheader.GetPosition().x + 20,
self.subheader.GetPosition().x,
self.subheader.GetPosition().y + self.subheader.GetSize().height + 3 + i
)
)
@@ -1173,7 +1181,30 @@ class wx_python_gui:
sys.stderr = self.stock_stderr
if self.constants.root_patcher_succeded is True:
print("- Root Patcher finished successfully")
self.reboot_system(message="Root Patcher finished successfully\nWould you like to reboot now?")
if self.constants.needs_to_open_preferences is True:
# Create dialog box to open System Preferences -> Security and Privacy
self.popup = wx.MessageDialog(
self.frame_modal,
"We just finished installing the patches to your Root Volume!\n\nHowever, Apple requires users to manually approve the kernel extensions installed before they can be used next reboot.\n\nWould you like to open System Preferences?",
"Open System Preferences?",
wx.YES_NO | wx.ICON_INFORMATION
)
self.popup.SetYesNoLabels("Open System Preferences", "Ignore")
answer = self.popup.ShowModal()
if answer == wx.ID_YES:
output =subprocess.run(
[
"osascript", "-e",
'tell app "System Preferences" to reveal anchor "General" of pane id "com.apple.preference.security"',
"-e", 'tell app "System Preferences" to activate',
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
time.sleep(5)
self.OnCloseFrame(None)
else:
self.reboot_system(message="Root Patcher finished successfully\nWould you like to reboot now?")
self.return_to_main_menu.Enable()
wx.GetApp().Yield()
@@ -1854,9 +1885,16 @@ class wx_python_gui:
self.finished_cim_process = False
# Only prompt user with option to install OC to disk if
# the model is supported.
if self.constants.allow_oc_everywhere is False and \
self.constants.custom_model is None and \
self.computer.real_model not in model_array.SupportedSMBIOS:
if (
(
self.constants.allow_oc_everywhere is False and \
self.constants.custom_model is None and \
self.computer.real_model not in model_array.SupportedSMBIOS
) or (
self.constants.custom_model is None and \
self.constants.host_is_hackintosh is True
)
):
popup_message = wx.MessageDialog(self.frame, "Sucessfully created a macOS installer!", "Success", wx.OK)
popup_message.ShowModal()
else:
@@ -2249,13 +2287,23 @@ class wx_python_gui:
if self.computer.real_model not in ["MacBookPro8,2", "MacBookPro8,3"]:
self.set_terascale_accel_checkbox.Disable()
# Force Web Drivers in Tesla/Kepler
self.force_web_drivers_checkbox = wx.CheckBox(self.frame_modal, label="Force Web Drivers")
self.force_web_drivers_checkbox.SetValue(self.constants.force_nv_web)
self.force_web_drivers_checkbox.Bind(wx.EVT_CHECKBOX, self.force_web_drivers_click)
self.force_web_drivers_checkbox.SetPosition(wx.Point(
self.disable_thunderbolt_checkbox.GetPosition().x,
self.set_terascale_accel_checkbox.GetPosition().y + self.set_terascale_accel_checkbox.GetSize().height))
self.force_web_drivers_checkbox.SetToolTip(wx.ToolTip("This option will force Nvidia Web Driver support onto Nvidia Tesla and Kepler GPUs. This should only be used for development purposes."))
# Windows GMUX
self.windows_gmux_checkbox = wx.CheckBox(self.frame_modal, label="Windows GMUX")
self.windows_gmux_checkbox.SetValue(self.constants.dGPU_switch)
self.windows_gmux_checkbox.Bind(wx.EVT_CHECKBOX, self.windows_gmux_click)
self.windows_gmux_checkbox.SetPosition(wx.Point(
self.set_terascale_accel_checkbox.GetPosition().x,
self.set_terascale_accel_checkbox.GetPosition().y + self.set_terascale_accel_checkbox.GetSize().height))
self.force_web_drivers_checkbox.GetPosition().x,
self.force_web_drivers_checkbox.GetPosition().y + self.force_web_drivers_checkbox.GetSize().height))
self.windows_gmux_checkbox.SetToolTip(wx.ToolTip("Enable this option to allow usage of the hardware GMUX to switch between Intel and Nvidia/AMD GPUs in Windows."))
# Hibernation Workaround
@@ -2439,6 +2487,16 @@ class wx_python_gui:
global_settings.global_settings().write_property("MacBookPro_TeraScale_2_Accel", False)
self.constants.allow_ts2_accel = False
def force_web_drivers_click(self, event=None):
if self.force_web_drivers_checkbox.GetValue():
print("Force Web Drivers Enabled")
global_settings.global_settings().write_property("Force_Web_Drivers", True)
self.constants.force_nv_web = True
else:
print("Force Web Drivers Disabled")
global_settings.global_settings().write_property("Force_Web_Drivers", False)
self.constants.force_nv_web = False
def windows_gmux_click(self, event=None):
if self.windows_gmux_checkbox.GetValue():
print("Windows GMUX Enabled")

View File

@@ -713,6 +713,35 @@ class BuildOpenCore:
print("- Adding Mac Pro, Xserve DRM patches")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1 -wegtree"
if not self.constants.custom_model:
for i, device in enumerate(self.computer.gpus):
if isinstance(device, device_probe.NVIDIA):
if (
device.arch in [device_probe.NVIDIA.Archs.Fermi, device_probe.NVIDIA.Archs.Maxwell, device_probe.NVIDIA.Archs.Pascal] or
(self.constants.force_nv_web is True and device.arch in [device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Kepler])
):
print(f"- Enabling Web Driver Patches for GPU ({i + 1}): {utilities.friendly_hex(device.vendor_id)}:{utilities.friendly_hex(device.device_id)}")
if device.pci_path and device.acpi_path:
if device.pci_path in self.config["DeviceProperties"]["Add"]:
self.config["DeviceProperties"]["Add"][device.pci_path].update({"disable-metal": 1, "force-compat": 1})
else:
self.config["DeviceProperties"]["Add"][device.pci_path] = {"disable-metal": 1, "force-compat": 1}
if self.get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is False:
self.enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"].update({"nvda_drv": binascii.unhexlify("31")})
if "nvda_drv" not in self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]:
self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"] += ["nvda_drv"]
else:
if "ngfxgl=1 ngfxcompat=1" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"]:
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " ngfxgl=1 ngfxcompat=1"
if self.get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is False:
self.enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"].update({"nvda_drv": binascii.unhexlify("31")})
if "nvda_drv" not in self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]:
self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"] += ["nvda_drv"]
if self.constants.disable_tb is True and self.model in ["MacBookPro11,1", "MacBookPro11,2", "MacBookPro11,3", "MacBookPro11,4", "MacBookPro11,5"]:
print("- Disabling 2013-2014 laptop Thunderbolt Controller")
if self.model in ["MacBookPro11,3", "MacBookPro11,5"]:

View File

@@ -15,7 +15,7 @@ class Constants:
def __init__(self):
# Patcher Versioning
self.patcher_version = "0.4.6" # OpenCore-Legacy-Patcher
self.patcher_support_pkg_version = "0.4.1" # PatcherSupportPkg
self.patcher_support_pkg_version = "0.5.1" # PatcherSupportPkg
self.url_patcher_support_pkg = "https://github.com/dortania/PatcherSupportPkg/releases/download/"
self.nightly_url_patcher_support_pkg = "https://nightly.link/dortania/PatcherSupportPkg/workflows/build/master/"
self.discord_link = "https://discord.gg/rqdPgH8xSN"
@@ -167,6 +167,7 @@ class Constants:
self.imac_model = "" # Set MXM GPU model
self.drm_support = False # Set iMac14,x DRM support
self.allow_ts2_accel = True # Set TeraScale 2 Acceleration support
self.force_nv_web = False # Force Nvidia Web Drivers on Tesla and Kepler
## Miscellaneous
self.disallow_cpufriend = False # Disable CPUFriend
@@ -190,6 +191,8 @@ class Constants:
self.booted_oc_disk = None # Determine current disk OCLP booted from
self.start_build_install = False # Determine if build install should be started
self.host_is_non_metal = False # Determine if host is non-metal (ie. enable UI hacks)
self.needs_to_open_preferences = False # Determine if preferences need to be opened
self.host_is_hackintosh = False # Determine if host is Hackintosh
self.legacy_accel_support = [
os_data.os_data.big_sur,

View File

@@ -1,6 +1,6 @@
# Generate Default Data
from resources import utilities, device_probe, generate_smbios, global_settings
from data import model_array, smbios_data, cpu_data
from data import model_array, smbios_data, cpu_data, os_data
import subprocess
@@ -39,6 +39,20 @@ class generate_defaults:
settings.sip_status = False
settings.allow_fv_root = True
settings.host_is_non_metal = True
# If a Mac is non-Metal based, Beta Blur is highly recommended
# However on lower end hardware, users may prefer the performance benefits without
if not model.startswith("MacBook") and settings.detected_os >= os_data.os_data.big_sur:
non_metal_args = [
"Moraea_BlurBeta",
"Moraea_RimBeta",
]
for arg in non_metal_args:
# If user explicitly set the blur, don't override
arg_result = subprocess.run(["defaults", "read", "-g", arg], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
if arg_result not in ["true", "1", "false", "0"]:
subprocess.run(["defaults", "write", "-g", arg, "-bool", "TRUE"])
if settings.computer.gpus:
for gpu in settings.computer.gpus:
if gpu.arch == device_probe.NVIDIA.Archs.Kepler:
@@ -47,6 +61,9 @@ class generate_defaults:
settings.amfi_status = True
settings.allow_fv_root = True # Allow FileVault on broken seal
break
elif gpu.arch in [device_probe.NVIDIA.Archs.Fermi, device_probe.NVIDIA.Archs.Maxwell, device_probe.NVIDIA.Archs.Pascal]:
settings.custom_sip_value = "0xA03"
break
if (
isinstance(settings.computer.wifi, device_probe.Broadcom)
and settings.computer.wifi.chipset in [device_probe.Broadcom.Chipsets.AirPortBrcm4331, device_probe.Broadcom.Chipsets.AirPortBrcm43224]
@@ -169,3 +186,7 @@ class generate_defaults:
settings.force_vmm = False
except KeyError:
pass
nv_web_status = global_settings.global_settings().read_property("Force_Web_Drivers")
if nv_web_status is True:
settings.force_nv_web = True

View File

@@ -30,10 +30,12 @@ class PCIDevice:
device_id: int # The device ID of this PCI device
class_code: int # The class code of this PCI device - https://pci-ids.ucw.cz/read/PD
name: Optional[str] = None # Name of IORegistryEntry
model: Optional[str] = None # model property
acpi_path: Optional[str] = None
pci_path: Optional[str] = None
name: Optional[str] = None # Name of IORegistryEntry
model: Optional[str] = None # model property
acpi_path: Optional[str] = None # ACPI Device Path
pci_path: Optional[str] = None # PCI Device Path
disable_metal: Optional[bool] = False # 'disable-metal' property
force_compatible: Optional[bool] = False # 'force-compat' property
@classmethod
def from_ioregistry(cls, entry: ioreg.io_registry_entry_t, anti_spoof=False):
@@ -51,6 +53,10 @@ class PCIDevice:
device.model = model
if "acpi-path" in properties:
device.acpi_path = properties["acpi-path"]
if "disable-metal" in properties:
device.disable_metal = True
if "force-compat" in properties:
device.force_compatible = True
device.populate_pci_path(entry)
return device
@@ -478,6 +484,7 @@ class Computer:
secure_boot_policy: Optional[int] = None
oclp_sys_version: Optional[str] = None
oclp_sys_date: Optional[str] = None
firmware_vendor: Optional[str] = None
@staticmethod
def probe():
@@ -698,6 +705,13 @@ class Computer:
# SecureBoot Variables
self.secure_boot_model = utilities.check_secure_boot_model()
self.secure_boot_policy = utilities.check_ap_security_policy()
# Firmware Vendor
firmware_vendor = utilities.get_firmware_vendor(decode=False)
if isinstance(firmware_vendor, bytes):
firmware_vendor = str(firmware_vendor.replace(b"\x00", b"").decode("utf-8"))
self.firmware_vendor = firmware_vendor
def cpu_probe(self):
self.cpu = CPU(
subprocess.run("sysctl machdep.cpu.brand_string".split(), stdout=subprocess.PIPE).stdout.decode().partition(": ")[2].strip(),

View File

@@ -13,6 +13,7 @@ class global_settings:
self.global_settings_folder = "/Users/Shared"
self.global_settings_plist = f"{self.global_settings_folder}/{self.file_name}"
self.generate_settings_file()
self.convert_defaults_to_global_settings()
def generate_settings_file(self):
if Path(self.global_settings_plist).exists():

View File

@@ -33,6 +33,9 @@ class OpenCoreLegacyPatcher:
self.constants.recovery_status = utilities.check_recovery()
self.computer = self.constants.computer
self.constants.booted_oc_disk = utilities.find_disk_off_uuid(utilities.clean_device_path(self.computer.opencore_path))
if self.constants.computer.firmware_vendor:
if self.constants.computer.firmware_vendor != "Apple":
self.constants.host_is_hackintosh = True
launcher_script = None
launcher_binary = sys.executable
if "python" in launcher_binary:
@@ -46,7 +49,6 @@ class OpenCoreLegacyPatcher:
self.constants.unpack_thread.start()
defaults.generate_defaults.probe(self.computer.real_model, True, self.constants)
global_settings.global_settings().convert_defaults_to_global_settings()
if utilities.check_cli_args() is not None:
print("- Detected arguments, switching to CLI mode")

View File

@@ -41,6 +41,7 @@ class PatchSysVolume:
self.root_mount_path = None
self.root_supports_snapshot = utilities.check_if_root_is_apfs_snapshot()
self.constants.root_patcher_succeded = False # Reset Variable each time we start
self.constants.needs_to_open_preferences = False
self.patch_set_dictionary = {}
self.needs_kmutil_exemptions = False # For '/Library/Extensions' rebuilds
@@ -107,6 +108,7 @@ class PatchSysVolume:
print("- Failed to revert snapshot via Apple's 'bless' command")
else:
self.clean_skylight_plugins()
self.delete_nonmetal_enforcement()
self.constants.root_patcher_succeded = True
print("- Unpatching complete")
print("\nPlease reboot the machine for patches to take effect")
@@ -114,14 +116,18 @@ class PatchSysVolume:
def rebuild_snapshot(self):
print("- Rebuilding Kernel Cache (This may take some time)")
args = ["kmutil", "install", "--volume-root", self.mount_location, "--update-all"]
if self.constants.detected_os > os_data.os_data.catalina:
args = ["kmutil", "install", "--volume-root", self.mount_location, "--update-all"]
if self.needs_kmutil_exemptions is True:
# When installing to '/Library/Extensions', following args skip kext consent
# prompt in System Preferences when SIP's disabled
print("- Disabling auth checks in kmutil")
args.append("--no-authentication")
args.append("--no-authorization")
if self.needs_kmutil_exemptions is True:
# When installing to '/Library/Extensions', following args skip kext consent
# prompt in System Preferences when SIP's disabled
print(" (You will get a prompt by System Preferences, ignore for now)")
args.append("--no-authentication")
args.append("--no-authorization")
self.constants.needs_to_open_preferences = True # Notify in GUI to open System Preferences
else:
args = ["kextcache", "-i", f"{self.mount_location}/"]
result = utilities.elevated(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
@@ -132,7 +138,7 @@ class PatchSysVolume:
# - will return 71 on failure to build KCs
# - will return 31 on 'No binaries or codeless kexts were provided'
# - will return -10 if the volume is missing (ie. unmounted by another process)
if result.returncode != 0:
if result.returncode != 0 or (self.constants.detected_os < os_data.os_data.catalina and "KernelCache ID" not in result.stdout.decode()):
print("- Unable to build new kernel cache")
print(f"\nReason for Patch Failure ({result.returncode}):")
print(result.stdout.decode())
@@ -142,6 +148,8 @@ class PatchSysVolume:
input("Press [ENTER] to continue")
else:
print("- Successfully built new kernel cache")
self.update_preboot_kernel_cache()
self.rebuild_dyld_shared_cache()
if self.root_supports_snapshot is True:
print("- Creating new APFS snapshot")
bless = utilities.elevated(
@@ -158,6 +166,8 @@ class PatchSysVolume:
self.unmount_drive()
print("- Patching complete")
print("\nPlease reboot the machine for patches to take effect")
if self.needs_kmutil_exemptions is True:
print("Note: Apple will require you to open System Preferences -> Security to allow the new kernel extensions to be loaded")
self.constants.root_patcher_succeded = True
if self.constants.gui_mode is False:
input("\nPress [ENTER] to continue")
@@ -166,6 +176,15 @@ class PatchSysVolume:
print("- Unmounting Root Volume (Don't worry if this fails)")
utilities.elevated(["diskutil", "unmount", self.root_mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode()
def rebuild_dyld_shared_cache(self):
if self.constants.detected_os <= os_data.os_data.catalina:
print("- Rebuilding dyld shared cache")
utilities.process_status(utilities.elevated(["update_dyld_shared_cache", "-root", f"{self.mount_location}/"]))
def update_preboot_kernel_cache(self):
if self.constants.detected_os == os_data.os_data.catalina:
print("- Rebuilding preboot kernel cache")
utilities.process_status(utilities.elevated(["kcditto"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
def clean_skylight_plugins(self):
if (Path(self.mount_application_support) / Path("SkyLightPlugins/")).exists():
@@ -175,6 +194,13 @@ class PatchSysVolume:
else:
print("- Creating SkylightPlugins folder")
utilities.process_status(utilities.elevated(["mkdir", "-p", f"{self.mount_application_support}/SkyLightPlugins/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
def delete_nonmetal_enforcement(self):
for arg in ["useMetal", "useIOP"]:
result = subprocess.run(["defaults", "read", "/Library/Preferences/com.apple.CoreDisplay", arg], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
if result in ["0", "false", "1", "true"]:
print(f"- Removing non-Metal Enforcement Preference: {arg}")
utilities.elevated(["defaults", "delete", "/Library/Preferences/com.apple.CoreDisplay", arg])
def write_patchset(self, patchset):
destination_path = f"{self.mount_location}/System/Library/CoreServices"
@@ -242,6 +268,8 @@ class PatchSysVolume:
# Make sure old SkyLight plugins aren't being used
self.clean_skylight_plugins()
# Make sure non-Metal Enforcement preferences are not present
self.delete_nonmetal_enforcement()
# Make sure SNB kexts are compatible with the host
if "Intel Sandy Bridge" in required_patches:

View File

@@ -115,6 +115,8 @@ class AutomaticSysPatch:
should_notify = global_settings.global_settings().read_property("AutoPatch_Notify_Mismatched_Disks")
if should_notify is False:
print("- Skipping due to user preference")
elif settings.host_is_hackintosh is True:
print("- Skipping due to hackintosh")
else:
if settings.booted_oc_disk:
root_disk = settings.booted_oc_disk.strip("disk")

View File

@@ -13,33 +13,38 @@ class detect_root_patch:
self.computer = self.constants.computer
# GPU Patch Detection
self.nvidia_tesla= False
self.kepler_gpu= False
self.nvidia_web= False
self.amd_ts1= False
self.amd_ts2= False
self.iron_gpu= False
self.sandy_gpu= False
self.ivy_gpu= False
self.nvidia_tesla = False
self.kepler_gpu = False
self.nvidia_web = False
self.amd_ts1 = False
self.amd_ts2 = False
self.iron_gpu = False
self.sandy_gpu = False
self.ivy_gpu = False
# Misc Patch Detection
self.brightness_legacy= False
self.legacy_audio= False
self.legacy_wifi= False
self.legacy_gmux= False
self.legacy_keyboard_backlight= False
self.brightness_legacy = False
self.legacy_audio = False
self.legacy_wifi = False
self.legacy_gmux = False
self.legacy_keyboard_backlight = False
# Patch Requirements
self.amfi_must_disable= False
self.supports_metal= False
self.amfi_must_disable = False
self.supports_metal = False
self.needs_nv_web_checks = False
# Validation Checks
self.sip_enabled = False
self.sbm_enabled = False
self.amfi_enabled = False
self.fv_enabled = False
self.sip_enabled = False
self.sbm_enabled = False
self.amfi_enabled = False
self.fv_enabled = False
self.dosdude_patched = False
self.missing_whatever_green = False
self.missing_nv_web_nvram = False
self.missing_nv_web_opengl = False
self.missing_nv_compat = False
def detect_gpus(self):
gpus = self.constants.computer.gpus
@@ -47,12 +52,12 @@ class detect_root_patch:
for i, gpu in enumerate(gpus):
if gpu.class_code and gpu.class_code != 0xFFFFFFFF:
print(f"- Found GPU ({i}): {utilities.friendly_hex(gpu.vendor_id)}:{utilities.friendly_hex(gpu.device_id)}")
if gpu.arch in [device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Fermi]:
if gpu.arch in [device_probe.NVIDIA.Archs.Tesla] and self.constants.force_nv_web is False:
if self.constants.detected_os > non_metal_os:
self.nvidia_tesla = True
self.amfi_must_disable = True
self.legacy_keyboard_backlight = self.check_legacy_keyboard_backlight()
elif gpu.arch == device_probe.NVIDIA.Archs.Kepler:
elif gpu.arch == device_probe.NVIDIA.Archs.Kepler and self.constants.force_nv_web is False:
if self.constants.detected_os > os_data.os_data.big_sur:
# Kepler drivers were dropped with Beta 7
# 12.0 Beta 5: 21.0.0 - 21A5304g
@@ -62,9 +67,17 @@ class detect_root_patch:
if "21A5506j" not in self.constants.detected_os_build:
self.kepler_gpu = True
self.supports_metal = True
elif gpu.arch in [device_probe.NVIDIA.Archs.Maxwell, device_probe.NVIDIA.Archs.Pascal]:
elif gpu.arch in [
device_probe.NVIDIA.Archs.Tesla,
device_probe.NVIDIA.Archs.Fermi,
device_probe.NVIDIA.Archs.Kepler,
device_probe.NVIDIA.Archs.Maxwell,
device_probe.NVIDIA.Archs.Pascal,
]:
if self.constants.detected_os > os_data.os_data.mojave:
self.nvidia_web = True
self.amfi_must_disable = True
self.needs_nv_web_checks = True
elif gpu.arch == device_probe.AMD.Archs.TeraScale_1:
if self.constants.detected_os > non_metal_os:
self.amd_ts1 = True
@@ -91,6 +104,7 @@ class detect_root_patch:
# Avoid patching Metal and non-Metal GPUs if both present, prioritize Metal GPU
# Main concerns are for iMac12,x with Sandy iGPU and Kepler dGPU
self.nvidia_tesla = False
self.nvidia_web = False
self.amd_ts1 = False
self.amd_ts2 = False
self.iron_gpu = False
@@ -109,7 +123,7 @@ class detect_root_patch:
def detect_demux(self):
# If GFX0 is missing, assume machine was demuxed
# -wegnoegpu would also trigger this, so ensure arg is not present
if not "-wegnoegpu" in (utilities.get_nvram("boot-args") or ""):
if not "-wegnoegpu" in (utilities.get_nvram("boot-args", decode=True) or ""):
igpu = self.constants.computer.igpu
dgpu = self.check_dgpu_status()
if igpu and not dgpu:
@@ -123,6 +137,64 @@ class detect_root_patch:
return self.constants.computer.ambient_light_sensor
return False
def check_nv_web_nvram(self):
# First check boot-args, then dedicated nvram variable
nv_on = utilities.get_nvram("boot-args", decode=True)
if nv_on:
if "nvda_drv_vrl=" in nv_on:
return True
nv_on = utilities.get_nvram("nvda_drv")
if nv_on:
return True
return False
def check_nv_web_opengl(self):
# First check boot-args, then whether property exists on GPU
nv_on = utilities.get_nvram("boot-args", decode=True)
if nv_on:
if "ngfxgl=" in nv_on:
return True
for gpu in self.constants.computer.gpus:
if isinstance(gpu, device_probe.NVIDIA):
if gpu.disable_metal is True:
return True
return False
def check_nv_compat(self):
# Check for 'nv_web' in boot-args, then whether property exists on GPU
nv_on = utilities.get_nvram("boot-args", decode=True)
if nv_on:
if "ngfxcompat=" in nv_on:
return True
for gpu in self.constants.computer.gpus:
if isinstance(gpu, device_probe.NVIDIA):
if gpu.force_compatible is True:
return True
return False
def check_whatevergreen(self):
return utilities.check_kext_loaded("WhateverGreen", self.constants.detected_os)
def check_sip(self):
if self.constants.detected_os > os_data.os_data.catalina:
if self.nvidia_web is True:
sip = sip_data.system_integrity_protection.root_patch_sip_big_sur_3rd_part_kexts
sip_hex = "0xA03"
sip_value = (
f"For Hackintoshes, please set csr-active-config to '030A0000' ({sip_hex})\nFor non-OpenCore Macs, please run 'csrutil disable' and \n'csrutil authenticated-root disable' in RecoveryOS"
)
else:
sip = sip_data.system_integrity_protection.root_patch_sip_big_sur
sip_hex = "0x802"
sip_value = (
f"For Hackintoshes, please set csr-active-config to '02080000' ({sip_hex})\nFor non-OpenCore Macs, please run 'csrutil disable' and \n'csrutil authenticated-root disable' in RecoveryOS"
)
else:
sip = sip_data.system_integrity_protection.root_patch_sip_mojave
sip_hex = "0x603"
sip_value = f"For Hackintoshes, please set csr-active-config to '03060000' ({sip_hex})\nFor non-OpenCore Macs, please run 'csrutil disable' in RecoveryOS"
return (sip, sip_value, sip_hex)
def detect_patch_set(self):
self.detect_gpus()
if self.model in model_array.LegacyBrightness:
@@ -157,40 +229,49 @@ class detect_root_patch:
self.legacy_gmux = True
self.root_patch_dict = {
"Graphics: Nvidia Tesla": self.nvidia_tesla,
"Graphics: Nvidia Kepler": self.kepler_gpu,
# "Graphics: Nvidia Web Drivers": self.nvidia_web,
"Graphics: Nvidia Web Drivers": False,
"Graphics: AMD TeraScale 1": self.amd_ts1,
"Graphics: AMD TeraScale 2": self.amd_ts2,
"Graphics: Intel Ironlake": self.iron_gpu,
"Graphics: Intel Sandy Bridge": self.sandy_gpu,
"Graphics: Intel Ivy Bridge": self.ivy_gpu,
"Brightness: Legacy Backlight Control": self.brightness_legacy,
"Audio: Legacy Realtek": self.legacy_audio,
"Networking: Legacy Wireless": self.legacy_wifi,
"Miscellaneous: Legacy GMUX": self.legacy_gmux,
"Miscellaneous: Legacy Keyboard Backlight": self.legacy_keyboard_backlight,
"Settings: Requires AMFI exemption": self.amfi_must_disable,
"Validation: Patching Possible": self.verify_patch_allowed(),
"Validation: SIP is enabled": self.sip_enabled,
"Validation: SecureBootModel is enabled": self.sbm_enabled,
"Validation: AMFI is enabled": self.amfi_enabled if self.amfi_must_disable else False,
"Validation: FileVault is enabled": self.fv_enabled,
"Validation: System is dosdude1 patched": self.dosdude_patched,
"Graphics: Nvidia Tesla": self.nvidia_tesla,
"Graphics: Nvidia Kepler": self.kepler_gpu,
"Graphics: Nvidia Web Drivers": self.nvidia_web,
"Graphics: AMD TeraScale 1": self.amd_ts1,
"Graphics: AMD TeraScale 2": self.amd_ts2,
"Graphics: Intel Ironlake": self.iron_gpu,
"Graphics: Intel Sandy Bridge": self.sandy_gpu,
"Graphics: Intel Ivy Bridge": self.ivy_gpu,
"Brightness: Legacy Backlight Control": self.brightness_legacy,
"Audio: Legacy Realtek": self.legacy_audio,
"Networking: Legacy Wireless": self.legacy_wifi,
"Miscellaneous: Legacy GMUX": self.legacy_gmux,
"Miscellaneous: Legacy Keyboard Backlight": self.legacy_keyboard_backlight,
"Settings: Requires AMFI exemption": self.amfi_must_disable,
"Validation: Patching Possible": self.verify_patch_allowed(),
f"Validation: SIP is enabled (Required: {self.check_sip()[2]} or higher)": self.sip_enabled,
f"Validation: Currently Booted SIP: ({hex(utilities.csr_dump())})": self.sip_enabled,
"Validation: SecureBootModel is enabled": self.sbm_enabled,
"Validation: AMFI is enabled": self.amfi_enabled if self.amfi_must_disable is True else False,
"Validation: FileVault is enabled": self.fv_enabled,
"Validation: System is dosdude1 patched": self.dosdude_patched,
"Validation: WhateverGreen.kext missing": self.missing_whatever_green if self.nvidia_web is True else False,
"Validation: Force OpenGL property missing": self.missing_nv_web_opengl if self.nvidia_web is True else False,
"Validation: Force compat property missing": self.missing_nv_compat if self.nvidia_web is True else False,
"Validation: nvda_drv(_vrl) variable missing": self.missing_nv_web_nvram if self.nvidia_web is True else False,
}
return self.root_patch_dict
def verify_patch_allowed(self, print_errors=False):
sip = sip_data.system_integrity_protection.root_patch_sip_big_sur if self.constants.detected_os > os_data.os_data.catalina else sip_data.system_integrity_protection.root_patch_sip_mojave
sip_dict = self.check_sip()
sip = sip_dict[0]
sip_value = sip_dict[1]
self.sip_enabled, self.sbm_enabled, self.amfi_enabled, self.fv_enabled, self.dosdude_patched = utilities.patching_status(sip, self.constants.detected_os)
if sip == sip_data.system_integrity_protection.root_patch_sip_mojave:
sip_value = "For Hackintoshes, please set csr-active-config to '03060000' (0x603)\nFor non-OpenCore Macs, please run 'csrutil disable' in RecoveryOS"
else:
sip_value = (
"For Hackintoshes, please set csr-active-config to '02080000' (0x802)\nFor non-OpenCore Macs, please run 'csrutil disable' and \n'csrutil authenticated-root disable' in RecoveryOS"
)
if self.nvidia_web is True:
self.missing_nv_web_nvram = not self.check_nv_web_nvram()
self.missing_nv_web_opengl = not self.check_nv_web_opengl()
self.missing_nv_compat = not self.check_nv_compat()
self.missing_whatever_green = not self.check_whatevergreen()
if print_errors is True:
if self.sip_enabled is True:
print("\nCannot patch! Please disable System Integrity Protection (SIP).")
@@ -217,8 +298,38 @@ class detect_root_patch:
print("\nCannot patch! Detected machine has already been patched by another patcher")
print("Please ensure your install is either clean or patched with OpenCore Legacy Patcher")
if self.nvidia_web is True:
if self.missing_nv_web_opengl is True:
print("\nCannot patch! Force OpenGL property missing")
print("Please ensure ngfxgl=1 is set in boot-args")
if self.missing_nv_compat is True:
print("\nCannot patch! Force Nvidia compatibility property missing")
print("Please ensure ngfxcompat=1 is set in boot-args")
if self.missing_nv_web_nvram is True:
print("\nCannot patch! nvda_drv(_vrl) variable missing")
print("Please ensure nvda_drv_vrl=1 is set in boot-args")
if self.missing_whatever_green is True:
print("\nCannot patch! WhateverGreen.kext missing")
print("Please ensure WhateverGreen.kext is installed")
if any(
[self.sip_enabled, self.sbm_enabled, self.fv_enabled, self.dosdude_patched, self.amfi_enabled if self.amfi_must_disable else False]
[
# General patch checks
self.sip_enabled, self.sbm_enabled, self.fv_enabled, self.dosdude_patched,
# non-Metal specific
self.amfi_enabled if self.amfi_must_disable is True else False,
# Web Driver specific
self.missing_nv_web_nvram if self.nvidia_web is True else False,
self.missing_nv_web_opengl if self.nvidia_web is True else False,
self.missing_nv_compat if self.nvidia_web is True else False,
self.missing_whatever_green if self.nvidia_web is True else False,
]
):
return False
else:
@@ -245,7 +356,9 @@ class detect_root_patch:
if hardware_details["Graphics: Nvidia Web Drivers"] is True:
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"Non-Metal IOAccelerator Common": all_hardware_patchset["Graphics"]["Non-Metal IOAccelerator Common"]})
required_patches.update({"Non-Metal CoreDisplay Common": all_hardware_patchset["Graphics"]["Non-Metal CoreDisplay Common"]})
required_patches.update({"Nvidia Web Drivers": all_hardware_patchset["Graphics"]["Nvidia Web Drivers"]})
required_patches.update({"Non-Metal Enforcement": all_hardware_patchset["Graphics"]["Non-Metal Enforcement"]})
if hardware_details["Graphics: Nvidia Kepler"] is True:
required_patches.update({"Metal Common": all_hardware_patchset["Graphics"]["Metal Common"]})
required_patches.update({"Nvidia Kepler": all_hardware_patchset["Graphics"]["Nvidia Kepler"]})

View File

@@ -147,19 +147,22 @@ def enable_sleep_after_running():
sleep_process = None
def amfi_status():
amfi_1 = "amfi_get_out_of_my_way=0x1"
amfi_2 = "amfi_get_out_of_my_way=1"
amfi_args = [
"amfi_get_out_of_my_way=0x1",
"amfi_get_out_of_my_way=1",
"amfi=128",
]
if get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=False):
if "-allow_amfi" in get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True):
oclp_guid = get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
if oclp_guid:
if "-allow_amfi" in oclp_guid:
return False
else:
return True
elif get_nvram("boot-args", decode=False):
if amfi_1 in get_nvram("boot-args", decode=False) or amfi_2 in get_nvram("boot-args", decode=False):
return False
else:
return True
boot_args = get_nvram("boot-args", decode=True)
if boot_args:
for arg in amfi_args:
if arg in boot_args:
return False
return True
def check_kext_loaded(kext_name, os_version):
@@ -197,6 +200,8 @@ def check_metal_support(device_probe, computer):
(gpu.arch in [
device_probe.NVIDIA.Archs.Tesla,
device_probe.NVIDIA.Archs.Fermi,
device_probe.NVIDIA.Archs.Maxwell,
device_probe.NVIDIA.Archs.Pascal,
device_probe.AMD.Archs.TeraScale_1,
device_probe.AMD.Archs.TeraScale_2,
device_probe.Intel.Archs.Iron_Lake,
@@ -210,10 +215,11 @@ def check_metal_support(device_probe, computer):
def check_filevault_skip():
# Check whether we can skip FileVault check with Root Patching
if get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=False) and "-allow_fv" in get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True):
return True
else:
return False
nvram = get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
if nvram:
if "-allow_fv" in nvram:
return True
return False
def check_secure_boot_model():
@@ -339,8 +345,11 @@ def get_nvram(variable: str, uuid: str = None, *, decode: bool = False):
value = ioreg.corefoundation_to_native(value)
if decode and isinstance(value, bytes):
value = value.strip(b"\0").decode()
if decode:
if isinstance(value, bytes):
value = value.strip(b"\0").decode()
elif isinstance(value, str):
value = value.strip("\0")
return value
@@ -362,6 +371,21 @@ def get_rom(variable: str, *, decode: bool = False):
value = value.strip(b"\0").decode()
return value
def get_firmware_vendor(*, decode: bool = False):
efi = ioreg.IORegistryEntryFromPath(ioreg.kIOMasterPortDefault, "IODeviceTree:/efi".encode())
value = ioreg.IORegistryEntryCreateCFProperty(efi, "firmware-vendor", ioreg.kCFAllocatorDefault, ioreg.kNilOptions)
ioreg.IOObjectRelease(efi)
if not value:
return None
value = ioreg.corefoundation_to_native(value)
if decode:
if isinstance(value, bytes):
value = value.strip(b"\0").decode()
elif isinstance(value, str):
value = value.strip("\0")
return value
def verify_network_connection(url):
try:

View File

@@ -66,8 +66,6 @@ def validate(settings):
host_os_float = float(f"{major_kernel}.{minor_kernel}")
for patch_subject in patchset:
for patch_core in patchset[patch_subject]:
if patch_core == "Nvidia Web Drivers":
continue
patch_os_min_float = float(f'{patchset[patch_subject][patch_core]["OS Support"]["Minimum OS Support"]["OS Major"]}.{patchset[patch_subject][patch_core]["OS Support"]["Minimum OS Support"]["OS Minor"]}')
patch_os_max_float = float(f'{patchset[patch_subject][patch_core]["OS Support"]["Maximum OS Support"]["OS Major"]}.{patchset[patch_subject][patch_core]["OS Support"]["Maximum OS Support"]["OS Minor"]}')
if (host_os_float < patch_os_min_float or host_os_float > patch_os_max_float):