Enhance OS patching detection

This commit is contained in:
Mykola Grymalyuk
2021-07-08 22:55:00 -06:00
parent 637981b405
commit 3b3f5b3290
5 changed files with 233 additions and 104 deletions

View File

@@ -120,7 +120,6 @@ class BuildOpenCore:
print("- Adding Internal Drive icon") print("- Adding Internal Drive icon")
shutil.copy(self.constants.icon_path_internal, self.constants.opencore_release_folder) shutil.copy(self.constants.icon_path_internal, self.constants.opencore_release_folder)
def build_efi(self): def build_efi(self):
Utilities.cls() Utilities.cls()
if not self.constants.custom_model: if not self.constants.custom_model:
@@ -140,8 +139,7 @@ class BuildOpenCore:
print("Deleting old copy of OpenCore folder") print("Deleting old copy of OpenCore folder")
shutil.rmtree(self.constants.opencore_release_folder, onerror=rmtree_handler, ignore_errors=True) shutil.rmtree(self.constants.opencore_release_folder, onerror=rmtree_handler, ignore_errors=True)
print() print(f"\n- Adding OpenCore v{self.constants.opencore_version} {self.constants.opencore_build}")
print(f"- Adding OpenCore v{self.constants.opencore_version} {self.constants.opencore_build}")
shutil.copy(self.constants.opencore_zip_source, self.constants.build_path) shutil.copy(self.constants.opencore_zip_source, self.constants.build_path)
zipfile.ZipFile(self.constants.opencore_zip_copied).extractall(self.constants.build_path) zipfile.ZipFile(self.constants.opencore_zip_copied).extractall(self.constants.build_path)
@@ -568,7 +566,9 @@ class BuildOpenCore:
print("- Adding Mac Pro, Xserve DRM patches") print("- Adding Mac Pro, Xserve DRM patches")
if "shikigva=128 unfairgva=1" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"]: if "shikigva=128 unfairgva=1" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"]:
print("- Falling back to boot-args") print("- Falling back to boot-args")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1" + (" -wegtree" if "-wegtree" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] else "") self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1" + (
" -wegtree" if "-wegtree" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] else ""
)
elif isinstance(device, device_probe.NVIDIA): elif isinstance(device, device_probe.NVIDIA):
print("- Enabling Nvidia Output Patch") print("- Enabling Nvidia Output Patch")
if "-wegtree" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"]: if "-wegtree" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"]:

View File

@@ -133,6 +133,12 @@ class Constants:
# External Files # External Files
self.url_patcher_support_pkg = "https://github.com/dortania/PatcherSupportPkg/releases/download/" self.url_patcher_support_pkg = "https://github.com/dortania/PatcherSupportPkg/releases/download/"
self.legacy_accel_support = [
self.mojave,
self.catalina,
self.big_sur,
]
# Payload Location # Payload Location
# OpenCore # OpenCore
@property @property
@@ -571,12 +577,12 @@ class Constants:
] ]
sandy_board_id = [ sandy_board_id = [
"Mac-E43C1C25D4880AD6", "Mac-E43C1C25D4880AD6",
"Mac-06F11F11946D27C5", "Mac-06F11F11946D27C5",
"Mac-9F18E312C5C2BF0B", "Mac-9F18E312C5C2BF0B",
"Mac-937CB26E2E02BB01", "Mac-937CB26E2E02BB01",
"Mac-35C5E08120C7EEAF", "Mac-35C5E08120C7EEAF",
"Mac-7BA5B2D9E42DDD94", "Mac-7BA5B2D9E42DDD94",
] ]
board_id = { board_id = {

View File

@@ -30,10 +30,9 @@ class PatchSysVolume:
self.iron_gpu = False self.iron_gpu = False
self.sandy_gpu = False self.sandy_gpu = False
self.ivy_gpu = False self.ivy_gpu = False
self.nvidia_legacy = False
self.brightness_legacy = False self.brightness_legacy = False
self.legacy_audio = False self.legacy_audio = False
self.added_kexts = False self.added_legacy_kexts = False
self.amfi_must_disable = False self.amfi_must_disable = False
self.check_board_id = False self.check_board_id = False
self.bad_board_id = False self.bad_board_id = False
@@ -43,7 +42,7 @@ class PatchSysVolume:
# Big Sur and newer use APFS snapshots # Big Sur and newer use APFS snapshots
self.mount_location = "/System/Volumes/Update/mnt1" self.mount_location = "/System/Volumes/Update/mnt1"
else: else:
self.mount_location = "/" self.mount_location = ""
self.mount_extensions = f"{self.mount_location}/System/Library/Extensions" self.mount_extensions = f"{self.mount_location}/System/Library/Extensions"
self.mount_frameworks = f"{self.mount_location}/System/Library/Frameworks" self.mount_frameworks = f"{self.mount_location}/System/Library/Frameworks"
self.mount_lauchd = f"{self.mount_location}/System/Library/LaunchDaemons" self.mount_lauchd = f"{self.mount_location}/System/Library/LaunchDaemons"
@@ -59,8 +58,8 @@ class PatchSysVolume:
self.root_mount_path = Utilities.get_disk_path() self.root_mount_path = Utilities.get_disk_path()
if self.root_mount_path.startswith("disk"): if self.root_mount_path.startswith("disk"):
if self.constants.detected_os == self.constants.catalina: if self.constants.detected_os == self.constants.catalina:
print("- Mounting Catalina Root Volume as writable") print("- Mounting Catalina Root Volume as writable")
self.elevated(["mount", "-uw", "/"], stdout=subprocess.PIPE).stdout.decode().strip().encode() self.elevated(["mount", "-uw", f"{self.mount_location}/"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
print(f"- Found Root Volume at: {self.root_mount_path}") print(f"- Found Root Volume at: {self.root_mount_path}")
if Path(self.mount_extensions).exists(): if Path(self.mount_extensions).exists():
print("- Root Volume is already mounted") print("- Root Volume is already mounted")
@@ -103,9 +102,11 @@ class PatchSysVolume:
if self.constants.detected_os > self.constants.catalina: if self.constants.detected_os > self.constants.catalina:
result = self.elevated(["kmutil", "install", "--volume-root", self.mount_location, "--update-all"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) result = self.elevated(["kmutil", "install", "--volume-root", self.mount_location, "--update-all"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
else: else:
result = self.elevated(["kextcache", "-i", "/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) result = self.elevated(["kextcache", "-i", f"{self.mount_location}/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if result.returncode != 0 or (self.constants.detected_os in [self.constants.mojave, self.constants.catalina] and "KernelCache ID" not in result): # kextcache always returns 0, even if it fails
# Check the output for 'KernelCache ID' to see if the cache was successfully rebuilt
if result.returncode != 0 or (self.constants.detected_os < self.constants.catalina and "KernelCache ID" not in result):
self.success_status = False self.success_status = False
print("- Unable to build new kernel cache") print("- Unable to build new kernel cache")
print("\nPlease report this to Github") print("\nPlease report this to Github")
@@ -118,24 +119,31 @@ class PatchSysVolume:
else: else:
self.success_status = True self.success_status = True
print("- Successfully built new kernel cache") print("- Successfully built new kernel cache")
if self.constants.gui_mode is False and self.constants.detected_os > self.constants.catalina: if self.constants.gui_mode is False:
input("Press [ENTER] to continue with snapshotting") if self.constants.detected_os > self.constants.catalina:
input("Press [ENTER] to continue with snapshotting")
else:
input("Press [ENTER] to continue with kernel and dyld cache merging")
if self.constants.detected_os > self.constants.catalina: if self.constants.detected_os > self.constants.catalina:
print("- Creating new APFS snapshot") print("- Creating new APFS snapshot")
self.elevated(["bless", "--folder", f"{self.mount_location}/System/Library/CoreServices", "--bootefi", "--create-snapshot"], stdout=subprocess.PIPE).stdout.decode().strip().encode() self.elevated(["bless", "--folder", f"{self.mount_location}/System/Library/CoreServices", "--bootefi", "--create-snapshot"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
self.unmount_drive() self.unmount_drive()
else: else:
print("Copying over KC") print("Merging kernel cache")
self.elevated(["kcditto"], stdout=subprocess.PIPE).stdout.decode().strip().encode() self.elevated(["kcditto"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
print("Merging dyld cache")
self.elevated(["update_dyld_shared_cache", "-root", f"{self.mount_location}/"]).stdout.decode().strip().encode()
print("- Patching complete") print("- Patching complete")
print("\nPlease reboot the machine for patches to take effect") print("\nPlease reboot the machine for patches to take effect")
if self.amd_ts2 is True: if self.amd_ts2 is True:
print("""\nPlease note that with ATI TeraScale 2 GPUs, you may experience colour strobing print(
"""\nPlease note that with ATI TeraScale 2 GPUs, you may experience colour strobing
on reboot. Please use SwitchResX or ResXtreme to force 1 million colours on your on reboot. Please use SwitchResX or ResXtreme to force 1 million colours on your
monitor to fix this. If you are epileptic, please ask for someone to aid you or monitor to fix this. If you are epileptic, please ask for someone to aid you or
set million colour before rebooting""") set million colour before rebooting"""
)
if self.constants.gui_mode is False: if self.constants.gui_mode is False:
input("Press [ENTER] to continue") input("\nPress [ENTER] to continue")
def unmount_drive(self): def unmount_drive(self):
print("- Unmounting Root Volume (Don't worry if this fails)") print("- Unmounting Root Volume (Don't worry if this fails)")
@@ -164,7 +172,9 @@ set million colour before rebooting""")
def add_brightness_patch(self): def add_brightness_patch(self):
self.delete_old_binaries(SysPatchArray.DeleteBrightness) self.delete_old_binaries(SysPatchArray.DeleteBrightness)
self.add_new_binaries(SysPatchArray.AddBrightness, self.constants.legacy_brightness) self.add_new_binaries(SysPatchArray.AddBrightness, self.constants.legacy_brightness)
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_brightness}/", self.mount_private_frameworks], stdout=subprocess.PIPE).stdout.decode().strip().encode() self.elevated(
["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_brightness}/", self.mount_private_frameworks], stdout=subprocess.PIPE
).stdout.decode().strip().encode()
self.elevated(["chmod", "-Rf", "755", f"{self.mount_private_frameworks}/DisplayServices.framework"], stdout=subprocess.PIPE).stdout.decode().strip().encode() self.elevated(["chmod", "-Rf", "755", f"{self.mount_private_frameworks}/DisplayServices.framework"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
self.elevated(["chown", "-Rf", "root:wheel", f"{self.mount_private_frameworks}/DisplayServices.framework"], stdout=subprocess.PIPE).stdout.decode().strip().encode() self.elevated(["chown", "-Rf", "root:wheel", f"{self.mount_private_frameworks}/DisplayServices.framework"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
@@ -172,71 +182,126 @@ set million colour before rebooting""")
self.delete_old_binaries(SysPatchArray.DeleteVolumeControl) self.delete_old_binaries(SysPatchArray.DeleteVolumeControl)
self.add_new_binaries(SysPatchArray.AddVolumeControl, self.constants.audio_path) self.add_new_binaries(SysPatchArray.AddVolumeControl, self.constants.audio_path)
def gpu_accel_legacy_nvidia_big_sur(self): def gpu_accel_legacy(self):
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11) if self.constants.detected_os == self.constants.mojave:
self.add_new_binaries(SysPatchArray.AddGeneralAccel, self.constants.legacy_general_path) print("- Installing General Acceleration Kext patches for Mojave")
self.add_new_binaries(SysPatchArray.AddNvidiaAccel11, self.constants.legacy_nvidia_path) self.add_new_binaries(SysPatchArray.AddGeneralAccelMojave, self.constants.legacy_general_path)
elif self.constants.detected_os == self.constants.catalina:
print("- Installing General Acceleration Kext patches for Catalina")
self.add_new_binaries(SysPatchArray.AddGeneralAccelCatalina, self.constants.legacy_general_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing General Acceleration Kext patches for Big Sur")
self.add_new_binaries(SysPatchArray.AddGeneralAccel, self.constants.legacy_general_path)
def gpu_framebuffer_legacy_nvidia(self): # Nvidia
self.add_new_binaries(SysPatchArray.AddNvidiaBrightness, self.constants.legacy_nvidia_path) def gpu_accel_legacy_nvidia_master(self):
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
print("- Installing Nvidia Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddNvidiaAccelLegacy, self.constants.legacy_nvidia_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing Nvidia Acceleration Kext patches for Big Sur")
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11)
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddNvidiaAccel11, self.constants.legacy_nvidia_path)
else:
print("- Installing basic Nvidia Framebuffer Kext patches for generic OS")
self.add_new_binaries(SysPatchArray.AddNvidiaBrightness, self.constants.legacy_nvidia_path)
def gpu_accel_legacy_ts1_big_sur(self): # AMD/ATI
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11) def gpu_accel_legacy_ts1_master(self):
self.add_new_binaries(SysPatchArray.AddGeneralAccel, self.constants.legacy_general_path) if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
self.add_new_binaries(SysPatchArray.AddAMDAccel11, self.constants.legacy_amd_path) print("- Installing TeraScale 1 Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddAMDAccelLegacy, self.constants.legacy_amd_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing TeraScale 1 Acceleration Kext patches for Big Sur")
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11)
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddAMDAccel11, self.constants.legacy_amd_path)
else:
print("- Installing basic TeraScale 1 Framebuffer Kext patches for generic OS")
self.add_new_binaries(SysPatchArray.AddAMDBrightness, self.constants.legacy_amd_path)
def gpu_accel_legacy_ts2_big_sur(self): def gpu_accel_legacy_ts2_master(self):
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11) if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11TS2) print("- Installing TeraScale 2 Acceleration Kext patches for Mojave/Catalina")
self.add_new_binaries(SysPatchArray.AddGeneralAccel, self.constants.legacy_general_path) self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddAMDAccel11, self.constants.legacy_amd_path) self.add_new_binaries(SysPatchArray.AddAMDAccelLegacy, self.constants.legacy_amd_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing TeraScale 2 Acceleration Kext patches for Big Sur")
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11)
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11TS2)
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddAMDAccel11, self.constants.legacy_amd_path)
else:
print("- Installing basic TeraScale 2 Framebuffer Kext patches for generic OS")
self.add_new_binaries(SysPatchArray.AddAMDBrightness, self.constants.legacy_amd_path)
def gpu_framebuffer_legacy_amd(self): # Intel
self.add_new_binaries(SysPatchArray.AddAMDBrightness, self.constants.legacy_amd_path) def gpu_accel_legacy_ironlake_master(self):
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
print("- Installing Ironlake Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing Ironlake Acceleration Kext patches for Big Sur")
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11)
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
else:
print("- Installing basic Ironlake Framebuffer Kext patches for generic OS")
self.add_new_binaries(SysPatchArray.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
def gpu_accel_legacy_ironlake_big_sur(self): def gpu_accel_legacy_sandybridge_master(self):
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11) if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
self.add_new_binaries(SysPatchArray.AddGeneralAccel, self.constants.legacy_general_path) print("- Installing Sandy Bridge Acceleration Kext patches for Mojave/Catalina")
self.add_new_binaries(SysPatchArray.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path) self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing Sandy Bridge Acceleration Kext patches for Big Sur")
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11)
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
else:
print("- Installing basic Sandy Bridge Framebuffer Kext patches for generic OS")
self.add_new_binaries(SysPatchArray.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
def gpu_framebuffer_legacy_ironlake(self): def gpu_framebuffer_ivybridge_master(self):
self.add_new_binaries(SysPatchArray.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path) if self.constants.detected_os == self.constants.monterey:
print("- Installing IvyBridge Acceleration Kext patches for Monterey")
def gpu_accel_legacy_sandybridge_big_sur(self): self.add_new_binaries(SysPatchArray.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11) print("- Fixing Acceleration in CoreMedia")
self.add_new_binaries(SysPatchArray.AddGeneralAccel, self.constants.legacy_general_path) subprocess.run(["defaults", "write", "com.apple.coremedia", "hardwareVideoDecoder", "-string", "enable"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
self.add_new_binaries(SysPatchArray.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path) print("- Merging Ivy Bridge Frameworks")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel_ivy}/", self.mount_frameworks], stdout=subprocess.PIPE).stdout.decode().strip().encode()
def gpu_framebuffer_legacy_sandybridge(self): print("- Merging Ivy Bridge PrivateFrameworks")
self.add_new_binaries(SysPatchArray.AddIntelGen2Accel, self.constants.legacy_intel_gen1_path) self.elevated(
["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_accel_ivy}/", self.mount_private_frameworks], stdout=subprocess.PIPE
def gpu_framebuffer_ivybridge_big_sur(self): ).stdout.decode().strip().encode()
self.add_new_binaries(SysPatchArray.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path) else:
print("- Fixing Acceleration in CoreMedia") print("- Installing basic Ivy Bridge Kext patches for generic OS")
subprocess.run(["defaults", "write", "com.apple.coremedia", "hardwareVideoDecoder", "-string", "enable"], stdout=subprocess.PIPE).stdout.decode().strip().encode() self.add_new_binaries(SysPatchArray.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
print("- Merging Ivy Bridge Frameworks")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel_ivy}/", self.mount_frameworks], stdout=subprocess.PIPE).stdout.decode().strip().encode()
print("- Merging Ivy Bridge PrivateFrameworks")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_accel_ivy}/", self.mount_private_frameworks], stdout=subprocess.PIPE).stdout.decode().strip().encode()
def gpu_accel_legacy_extended(self): def gpu_accel_legacy_extended(self):
print("- Merging general legacy Frameworks") print("- Merging general legacy Frameworks")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel}/", self.mount_frameworks], stdout=subprocess.PIPE).stdout.decode().strip().encode() self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel}/", self.mount_frameworks], stdout=subprocess.PIPE).stdout.decode().strip().encode()
if Path(self.mount_lauchd / Path("HiddHack.plist")).exists(): print("- Merging general legacy PrivateFrameworks")
print("- Removing legacy HiddHack") self.elevated(
self.elevated(["rm", f"{self.mount_lauchd}/HiddHack.plist"], stdout=subprocess.PIPE).stdout.decode().strip().encode() ["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_accel}/", self.mount_private_frameworks], stdout=subprocess.PIPE
).stdout.decode().strip().encode()
print("- Adding IOHID-Fixup.plist") print("- Adding IOHID-Fixup.plist")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_lauchd_path_accel}/", self.mount_lauchd], stdout=subprocess.PIPE).stdout.decode().strip().encode() self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_lauchd_path_accel}/", self.mount_lauchd], stdout=subprocess.PIPE).stdout.decode().strip().encode()
self.elevated(["chmod", "755", f"{self.mount_lauchd}/IOHID-Fixup.plist"], stdout=subprocess.PIPE).stdout.decode().strip().encode() self.elevated(["chmod", "755", f"{self.mount_lauchd}/IOHID-Fixup.plist"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
self.elevated(["chown", "root:wheel", f"{self.mount_lauchd}/IOHID-Fixup.plist"], stdout=subprocess.PIPE).stdout.decode().strip().encode() self.elevated(["chown", "root:wheel", f"{self.mount_lauchd}/IOHID-Fixup.plist"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
print("- Merging general legacy PrivateFrameworks")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_accel}/", self.mount_private_frameworks], stdout=subprocess.PIPE).stdout.decode().strip().encode()
def gpu_accel_legacy_extended_ts2(self): def gpu_accel_legacy_extended_ts2(self):
print("- Merging TeraScale 2 legacy Frameworks") print("- Merging TeraScale 2 legacy Frameworks")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel_ts2}/", self.mount_frameworks], stdout=subprocess.PIPE).stdout.decode().strip().encode() self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel_ts2}/", self.mount_frameworks], stdout=subprocess.PIPE).stdout.decode().strip().encode()
print("- Merging TeraScale 2 PrivateFrameworks") print("- Merging TeraScale 2 PrivateFrameworks")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_accel_ts2}/", self.mount_private_frameworks], stdout=subprocess.PIPE).stdout.decode().strip().encode() self.elevated(
["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_accel_ts2}/", self.mount_private_frameworks], stdout=subprocess.PIPE
).stdout.decode().strip().encode()
print("- Fixing Acceleration in CMIO") print("- Fixing Acceleration in CMIO")
subprocess.run(["defaults", "write", "com.apple.cmio", "CMIO_Unit_Input_ASC.DoNotUseOpenCL", "-bool", "true"], stdout=subprocess.PIPE).stdout.decode().strip().encode() subprocess.run(["defaults", "write", "com.apple.cmio", "CMIO_Unit_Input_ASC.DoNotUseOpenCL", "-bool", "true"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
@@ -245,63 +310,62 @@ set million colour before rebooting""")
# Graphics patches # Graphics patches
if self.nvidia_legacy is True: if self.nvidia_legacy is True:
print("- Installing legacy Nvidia Patches") print("- Installing legacy Nvidia Patches")
if self.constants.detected_os == self.constants.big_sur: if self.constants.detected_os in self.constants.legacy_accel_support:
print("- Detected Big Sur, installing Acceleration patches") print("- Detected supported OS, installing Acceleration Patches")
self.gpu_accel_legacy_nvidia_big_sur() self.added_legacy_kexts = True
self.added_kexts = True
else: else:
print("- Detected unsupported OS, installing Basic Framebuffer") print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_framebuffer_legacy_nvidia() self.gpu_accel_legacy_nvidia_master()
if self.amd_ts1 is True: elif self.amd_ts1 is True:
print("- Installing legacy TeraScale 1 Patches") print("- Installing legacy TeraScale 1 Patches")
if self.constants.detected_os == self.constants.big_sur: if self.constants.detected_os in self.constants.legacy_accel_support:
print("- Detected Big Sur, installing Acceleration patches") print("- Detected supported OS, installing Acceleration Patches")
self.gpu_accel_legacy_ts1_big_sur() self.added_legacy_kexts = True
self.added_kexts = True
else: else:
print("- Detected unsupported OS, installing Basic Framebuffer") print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_framebuffer_legacy_amd() self.gpu_accel_legacy_ts1_master()
if self.amd_ts2 is True: elif self.amd_ts2 is True:
print("- Installing legacy TeraScale 2 Patches") print("- Installing legacy TeraScale 2 Patches")
if self.constants.detected_os == self.constants.big_sur: if self.constants.detected_os in self.constants.legacy_accel_support:
print("- Detected Big Sur, installing Acceleration patches") print("- Detected supported OS, installing Acceleration Patches")
self.gpu_accel_legacy_ts2_big_sur() self.added_legacy_kexts = True
self.added_kexts = True
else: else:
print("- Detected unsupported OS, installing Basic Framebuffer") print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_framebuffer_legacy_amd() self.gpu_accel_legacy_ts2_master()
if self.iron_gpu is True: if self.iron_gpu is True:
print("- Installing legacy Ironlake Patches") print("- Installing legacy Ironlake Patches")
if self.constants.detected_os == self.constants.big_sur: if self.constants.detected_os in self.constants.legacy_accel_support:
print("- Detected Big Sur, installing Acceleration patches") print("- Detected supported OS, installing Acceleration Patches")
self.gpu_accel_legacy_ironlake_big_sur() self.added_legacy_kexts = True
self.added_kexts = True
else: else:
print("- Detected unsupported OS, installing Basic Framebuffer") print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_framebuffer_legacy_ironlake() self.gpu_accel_legacy_ironlake_master()
if self.sandy_gpu is True: elif self.sandy_gpu is True:
print("- Installing legacy Sandy Bridge Patches") print("- Installing legacy Sandy Bridge Patches")
if self.constants.detected_os == self.constants.big_sur: if self.constants.detected_os in self.constants.legacy_accel_support:
print("- Detected Big Sur, installing Acceleration patches") print("- Detected supported OS, installing Acceleration Patches")
self.gpu_accel_legacy_sandybridge_big_sur() self.added_legacy_kexts = True
self.added_kexts = True
else: else:
print("- Detected unsupported OS, installing Basic Framebuffer") print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_framebuffer_legacy_sandybridge() self.gpu_accel_legacy_sandybridge_master()
if self.ivy_gpu is True: elif self.ivy_gpu is True:
print("- Installing Ivy Bridge Patches") print("- Installing Ivy Bridge Patches")
self.gpu_framebuffer_ivybridge_big_sur() if self.constants.detected_os == self.constants.monterey:
print("- Detected supported OS, installing Acceleration Patches")
else:
print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_framebuffer_ivybridge_master()
if self.amd_ts2 is True: if self.amd_ts2 is True and self.constants.detected_os in self.constants.legacy_accel_support:
# TeraScale 2 patches must be installed after Intel HD3000 # TeraScale 2 patches must be installed after Intel HD3000
self.add_new_binaries(SysPatchArray.AddAMDAccel11TS2, self.constants.legacy_amd_path_ts2) self.add_new_binaries(SysPatchArray.AddAMDAccel11TS2, self.constants.legacy_amd_path_ts2)
if self.added_kexts is True: if self.added_legacy_kexts is True and self.constants.detected_os in self.constants.legacy_accel_support:
self.gpu_accel_legacy_extended() self.gpu_accel_legacy_extended()
if self.amd_ts2 is True: if self.amd_ts2 is True:
self.gpu_accel_legacy_extended_ts2() self.gpu_accel_legacy_extended_ts2()
@@ -370,6 +434,7 @@ set million colour before rebooting""")
print("- Download failed, please verify the below link works:") print("- Download failed, please verify the below link works:")
print(link) print(link)
input("Press [ENTER] to continue") input("Press [ENTER] to continue")
def detect_gpus(self): def detect_gpus(self):
dgpu = self.constants.computer.dgpu dgpu = self.constants.computer.dgpu
igpu = self.constants.computer.igpu igpu = self.constants.computer.igpu
@@ -457,7 +522,9 @@ set million colour before rebooting""")
if sip == self.constants.root_patch_sip_mojave: if sip == self.constants.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" sip_value = "For Hackintoshes, please set csr-active-config to '03060000' (0x603)\nFor non-OpenCore Macs, please run 'csrutil disable' in RecoveryOS"
else: else:
sip_value = "For Hackintoshes, please set csr-active-config to '030A0000' (0xA03)\nFor non-OpenCore Macs, please run 'csrutil disable' and \n'csrutil authenticated-root disable' in RecoveryOS" sip_value = (
"For Hackintoshes, please set csr-active-config to '030A0000' (0xA03)\nFor non-OpenCore Macs, please run 'csrutil disable' and \n'csrutil authenticated-root disable' in RecoveryOS"
)
self.sip_enabled, self.sbm_enabled, self.amfi_enabled, self.fv_enabled = Utilities.patching_status(sip) self.sip_enabled, self.sbm_enabled, self.amfi_enabled, self.fv_enabled = Utilities.patching_status(sip)
if self.sip_enabled is True: if self.sip_enabled is True:
print("\nCannot patch! Please disable System Integrity Protection (SIP).") print("\nCannot patch! Please disable System Integrity Protection (SIP).")
@@ -481,6 +548,7 @@ set million colour before rebooting""")
if self.check_board_id is True and self.computer.reported_board_id not in self.constants.sandy_board_id: if self.check_board_id is True and self.computer.reported_board_id not in self.constants.sandy_board_id:
print("\nCannot patch! Board ID not supported by AppleIntelSNBGraphicsFB") print("\nCannot patch! Board ID not supported by AppleIntelSNBGraphicsFB")
print(f"Detected Board ID: {self.computer.reported_board_id}")
print("Please ensure your Board ID is listed below:") print("Please ensure your Board ID is listed below:")
print("\n".join(self.constants.sandy_board_id)) print("\n".join(self.constants.sandy_board_id))
self.bad_board_id = True self.bad_board_id = True

View File

@@ -140,6 +140,7 @@ AddAMDBrightness = [
AddAMDAccel11TS2 = [ AddAMDAccel11TS2 = [
"IOSurface.kext", "IOSurface.kext",
"IOAcceleratorFamily2.kext",
] ]
AddIntelGen1Accel = [ AddIntelGen1Accel = [
@@ -190,3 +191,57 @@ DeleteVolumeControl = [
"ApplePVPanic.kext", "ApplePVPanic.kext",
"AppleVirtIOStorage.kext", "AppleVirtIOStorage.kext",
] ]
AddNvidiaAccelLegacy = [
"GeForceGA.bundle",
"GeForceTesla.kext",
"GeForceTeslaGLDriver.bundle",
"GeForceTeslaVADriver.bundle",
"NVDANV50HalTesla.kext",
"NVDAResmanTesla.kext",
]
AddAMDAccelLegacy = [
"AMD2400Controller.kext",
"AMD2600Controller.kext",
"AMD3800Controller.kext",
"AMD4600Controller.kext",
"AMD4800Controller.kext",
"AMD5000Controller.kext",
"AMD6000Controller.kext",
"AMDFramebuffer.kext",
"AMDLegacyFramebuffer.kext",
"AMDLegacySupport.kext",
"AMDRadeonVADriver.bundle",
"AMDRadeonVADriver2.bundle",
"AMDRadeonX3000.kext",
"AMDRadeonX3000GLDriver.bundle",
"AMDRadeonX4000HWServices.kext",
"AMDRadeonX4000.kext",
"AMDRadeonX4000GLDriver.bundle",
"AMDShared.bundle",
"AMDSupport.kext",
"ATIRadeonX2000.kext",
"ATIRadeonX2000GA.plugin",
"ATIRadeonX2000GLDriver.bundle",
"ATIRadeonX2000VADriver.bundle",
]
AddGeneralAccelCatalina = [
"AppleGraphicsControl.kext",
"AppleGraphicsPowerManagement.kext",
"AppleMCCSControl.kext",
"IOGraphicsFamily.kext",
"IONDRVSupport.kext",
"IOSurface.kext",
]
AddGeneralAccelMojave = [
"IONDRVSupport.kext",
"AppleGraphicsControl.kext",
"AppleGraphicsPowerManagement.kext",
"AppleMCCSControl.kext",
"IOAccelerator2D.plugin",
"IOAcceleratorFamily2.kext",
"IOGraphicsFamily.kext",
]