Adjust patcher settings

This commit is contained in:
Mykola Grymalyuk
2021-09-05 10:48:46 -06:00
parent d4836514fd
commit 372ad31d83
5 changed files with 65 additions and 21 deletions

View File

@@ -22,6 +22,8 @@
- Allow iGPU/dGPU switching in Windows - Allow iGPU/dGPU switching in Windows
- Applicable to MacBook Pros with Intel iGPU and Nvidia/AMD dGPU - Applicable to MacBook Pros with Intel iGPU and Nvidia/AMD dGPU
- Clean up Patcher Settings - Clean up Patcher Settings
- Allow disabling of TeraScale 2 Acceleration during root volume patch
- Use for MacBookPro8,x with heavily degraded dGPUs
## 0.2.4 ## 0.2.4

View File

@@ -119,6 +119,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
["SMBIOS Settings", self.patcher_settings_smbios], ["SMBIOS Settings", self.patcher_settings_smbios],
["Boot Volume Settings", self.patcher_settings_boot], ["Boot Volume Settings", self.patcher_settings_boot],
["Miscellaneous Settings", self.patcher_settings_misc], ["Miscellaneous Settings", self.patcher_settings_misc],
["Dump detected hardware", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).dump_hardware],
[ [
f"Allow Accel on Mojave/Catalina:\tCurrently {self.constants.moj_cat_accel}", f"Allow Accel on Mojave/Catalina:\tCurrently {self.constants.moj_cat_accel}",
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_moj_cat_patch, CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_moj_cat_patch,
@@ -208,8 +209,8 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
title = ["Adjust Bootable Volume Settings"] title = ["Adjust Bootable Volume Settings"]
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True) menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
options = [ options = [
[f"Allow FireWire Boot:\tCurrently {self.constants.firewire_boot}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_firewire], [f"Set FireWire Boot:\tCurrently {self.constants.firewire_boot}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_firewire],
[f"Allow NVMe Boot:\t\tCurrently {self.constants.nvme_boot}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_nvme], [f"Set NVMe Boot:\tCurrently {self.constants.nvme_boot}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_nvme],
] ]
for option in options: for option in options:
@@ -224,8 +225,9 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True) menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
options = [ options = [
[f"Set ShowPicker Mode:\tCurrently {self.constants.showpicker}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_showpicker], [f"Set ShowPicker Mode:\tCurrently {self.constants.showpicker}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_showpicker],
[f"Allow Wake on WLAN:\t\tCurrently {self.constants.enable_wake_on_wlan}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_wowl], [f"Set Wake on WLAN:\t\tCurrently {self.constants.enable_wake_on_wlan}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_wowl],
[f"Allow Ivy iMac iGPU:\tCurrently {self.constants.allow_ivy_igpu}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_ivy], [f"Set Ivy iMac iGPU:\t\tCurrently {self.constants.allow_ivy_igpu}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_ivy],
[f"Set TeraScale 2 Accel:\tCurrently {self.constants.allow_ts2_accel}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).terascale_2_accel],
[ [
f"Disable Thunderbolt:\tCurrently {self.constants.disable_thunderbolt}", f"Disable Thunderbolt:\tCurrently {self.constants.disable_thunderbolt}",
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).disable_thunderbolt, CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).disable_thunderbolt,
@@ -243,8 +245,8 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
title = ["Adjust Advanced Patcher Settings, for developers ONLY"] title = ["Adjust Advanced Patcher Settings, for developers ONLY"]
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True) menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
options = [ options = [
[f"Assume Metal GPU Always:\t\tCurrently {self.constants.imac_vendor}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_metal], [f"Set Metal GPU Status:\t\tCurrently {self.constants.imac_vendor}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_metal],
[f"DRM Preferences:\t\t\tCurrently {self.constants.drm_support}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).drm_setting], [f"Set DRM Preferences:\t\tCurrently {self.constants.drm_support}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).drm_setting],
[f"Set Generic Bootstrap:\t\tCurrently {self.constants.boot_efi}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).bootstrap_setting], [f"Set Generic Bootstrap:\t\tCurrently {self.constants.boot_efi}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).bootstrap_setting],
[ [
f"Disable CPU Friend:\t\t\tCurrently {self.constants.disallow_cpufriend}", f"Disable CPU Friend:\t\t\tCurrently {self.constants.disallow_cpufriend}",

View File

@@ -546,7 +546,6 @@ Q. Return to previous menu
else: else:
self.latebloom_settings() self.latebloom_settings()
def allow_moj_cat_patch(self): def allow_moj_cat_patch(self):
Utilities.cls() Utilities.cls()
Utilities.header(["Allow Root Patching on Mojave/Catalina"]) Utilities.header(["Allow Root Patching on Mojave/Catalina"])
@@ -600,3 +599,35 @@ other devices that benefit from this fix.
print("Returning to previous menu") print("Returning to previous menu")
else: else:
self.disable_thunderbolt() self.disable_thunderbolt()
def terascale_2_accel(self):
Utilities.cls()
Utilities.header(["Set TeraScale 2 Acceleration"])
print(
"""
By default this patcher will install TeraScale 2 acceleration, however
for some laptops this may be undesired due to how degraded their dGPU
is.
Disabling TeraScale 2 acceleration will instead install basic framebuffer
support allowing for basic brightness control and let the HD3000 iGPU
handle acceleration tasks.
"""
)
change_menu = input("Allow TeraScale 2 Acceleration?(y/n/q): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.allow_ts2_accel = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.allow_ts2_accel = False
elif change_menu in {"q", "Q", "Quit", "quit"}:
print("Returning to previous menu")
else:
self.terascale_2_accel()
def dump_hardware(self):
Utilities.cls()
Utilities.header(["Dumping detected hardware"])
print("")
print(self.constants.computer)
input("\nPress [ENTER] to exit: ")

View File

@@ -97,6 +97,7 @@ class Constants:
self.latebloom_debug = 0 self.latebloom_debug = 0
self.validate = False self.validate = False
self.disable_thunderbolt = False self.disable_thunderbolt = False
self.allow_ts2_accel = True
# OS Versions # OS Versions
self.tiger = 8 self.tiger = 8

View File

@@ -24,6 +24,7 @@ class PatchSysVolume:
self.sbm_enabled = True self.sbm_enabled = True
self.amfi_enabled = True self.amfi_enabled = True
self.fv_enabled = True self.fv_enabled = True
self.dosdude_patched = True
self.nvidia_legacy = False self.nvidia_legacy = False
self.amd_ts1 = False self.amd_ts1 = False
self.amd_ts2 = False self.amd_ts2 = False
@@ -37,8 +38,12 @@ class PatchSysVolume:
self.check_board_id = False self.check_board_id = False
self.bad_board_id = False self.bad_board_id = False
self.no_patch = True self.no_patch = True
self.validate = False
if self.constants.detected_os > self.constants.catalina: if (Path.home() / "Desktop/OCLP-Test/").exists:
self.mount_location = Path.home() / "Desktop/OCLP-Test"
self.validate = True
elif self.constants.detected_os > self.constants.catalina:
# 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:
@@ -57,7 +62,7 @@ class PatchSysVolume:
def find_mount_root_vol(self, patch): def find_mount_root_vol(self, patch):
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 and self.validate is False:
print("- Mounting Catalina Root Volume as writable") print("- Mounting Catalina Root Volume as writable")
self.elevated(["mount", "-uw", f"{self.mount_location}/"], 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}")
@@ -180,6 +185,7 @@ class PatchSysVolume:
else: else:
print(f"- Failed to find {location_zip}, unable to unpatch") print(f"- Failed to find {location_zip}, unable to unpatch")
if self.validate is False:
self.rebuild_snapshot() self.rebuild_snapshot()
else: else:
print("- Could not find Extensions.zip, cannot manually unpatch root volume") print("- Could not find Extensions.zip, cannot manually unpatch root volume")
@@ -328,11 +334,11 @@ set million colour before rebooting"""
self.add_new_binaries(SysPatchArray.AddAMDBrightness, self.constants.legacy_amd_path) self.add_new_binaries(SysPatchArray.AddAMDBrightness, self.constants.legacy_amd_path)
def gpu_accel_legacy_ts2_master(self): def gpu_accel_legacy_ts2_master(self):
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]: if self.constants.detected_os in [self.constants.mojave, self.constants.catalina] and self.constants.allow_ts2_accel is True:
print("- Installing TeraScale 2 Acceleration Kext patches for Mojave/Catalina") print("- Installing TeraScale 2 Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy() self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddAMDAccelLegacy, 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: elif self.constants.detected_os == self.constants.big_sur and self.constants.allow_ts2_accel is True:
print("- Installing TeraScale 2 Acceleration Kext patches for Big Sur") print("- Installing TeraScale 2 Acceleration Kext patches for Big Sur")
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11) self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11)
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11TS2) self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11TS2)
@@ -375,6 +381,7 @@ set million colour before rebooting"""
if self.constants.detected_os == self.constants.monterey: if self.constants.detected_os == self.constants.monterey:
print("- Installing IvyBridge Acceleration Kext patches for Monterey") print("- Installing IvyBridge Acceleration Kext patches for Monterey")
self.add_new_binaries(SysPatchArray.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path) self.add_new_binaries(SysPatchArray.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
if self.validate is False:
print("- Fixing Acceleration in CoreMedia") print("- Fixing Acceleration in CoreMedia")
Utilities.process_status(subprocess.run(["defaults", "write", "com.apple.coremedia", "hardwareVideoDecoder", "-string", "enable"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)) Utilities.process_status(subprocess.run(["defaults", "write", "com.apple.coremedia", "hardwareVideoDecoder", "-string", "enable"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
print("- Merging Ivy Bridge Frameworks") print("- Merging Ivy Bridge Frameworks")
@@ -405,6 +412,7 @@ set million colour before rebooting"""
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) self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_accel_ts2}/", self.mount_private_frameworks], stdout=subprocess.PIPE)
if self.validate is False:
print("- Fixing Acceleration in CMIO") print("- Fixing Acceleration in CMIO")
Utilities.process_status(subprocess.run(["defaults", "write", "com.apple.cmio", "CMIO_Unit_Input_ASC.DoNotUseOpenCL", "-bool", "true"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)) Utilities.process_status(subprocess.run(["defaults", "write", "com.apple.cmio", "CMIO_Unit_Input_ASC.DoNotUseOpenCL", "-bool", "true"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
@@ -464,13 +472,13 @@ set million colour before rebooting"""
print("- Detected unsupported OS, installing Basic Framebuffer") print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_framebuffer_ivybridge_master() self.gpu_framebuffer_ivybridge_master()
if self.amd_ts2 is True and self.constants.detected_os in self.constants.legacy_accel_support: if self.amd_ts2 is True and self.constants.detected_os in self.constants.legacy_accel_support and self.constants.allow_ts2_accel is True:
# 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_legacy_kexts is True and self.constants.detected_os in self.constants.legacy_accel_support: 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 and self.constants.allow_ts2_accel is True:
self.gpu_accel_legacy_extended_ts2() self.gpu_accel_legacy_extended_ts2()
# Misc patches # Misc patches
@@ -481,7 +489,7 @@ set million colour before rebooting"""
if self.legacy_audio is True: if self.legacy_audio is True:
print("- Fixing Volume Control Support") print("- Fixing Volume Control Support")
self.add_audio_patch() self.add_audio_patch()
if self.validate is False:
self.rebuild_snapshot() self.rebuild_snapshot()
def check_files(self): def check_files(self):