sys_patch_detect.py: Add support for Web Drivers on Tesla/Kepler

This commit is contained in:
Mykola Grymalyuk
2022-05-27 16:02:19 -06:00
parent 7a0e824536
commit 90e23bef92
5 changed files with 29 additions and 11 deletions

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.5.0" # 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

View File

@@ -172,3 +172,11 @@ class generate_defaults:
settings.force_vmm = False
except KeyError:
pass
nv_web_status = subprocess.run(["defaults", "read", "com.dortania.opencore-legacy-patcher", "Force_Web_Drivers"], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
if nv_web_status in ["1", "true"]:
settings.force_nv_web = True
else:
subprocess.run(["defaults", "write", "com.dortania.opencore-legacy-patcher", "Force_Web_Drivers", "-bool", "FALSE"])
settings.force_nv_web = False

View File

@@ -166,7 +166,7 @@ class PatchSysVolume:
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\nallow the new kernel extensions to be loaded")
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")

View File

@@ -52,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]:
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
@@ -67,7 +67,13 @@ 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.Fermi, 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,
] and self.constants.force_nv_web is True:
if self.constants.detected_os > os_data.os_data.mojave:
self.nvidia_web = True
self.amfi_must_disable = True