Add configuration option for users

This commit is contained in:
Mykola Grymalyuk
2021-08-10 10:06:45 -06:00
parent cf884532d7
commit fc59cfffa1
5 changed files with 32 additions and 2 deletions

View File

@@ -51,6 +51,7 @@ class OpenCoreLegacyPatcher:
parser.add_argument("--disable_amfi", help="Disable AMFI", action="store_true", required=False)
parser.add_argument("--moderate_smbios", help="Moderate SMBIOS Patching", action="store_true", required=False)
parser.add_argument("--moj_cat_accel", help="Allow Root Patching on Mojave and Catalina", action="store_true", required=False)
parser.add_argument("--disable_thunderbolt", help="Disable Thunderbolt on 2013-2014 MacBook Pros", action="store_true", required=False)
# Building args requiring value values (ie. --model iMac12,2)
parser.add_argument("--model", action="store", help="Set custom model", required=False)
@@ -120,6 +121,9 @@ class OpenCoreLegacyPatcher:
if args.wlan:
print("- Set Wake on WLAN configuration")
self.constants.enable_wake_on_wlan = True
if args.disable_thunderbolt:
print("- Set Disable Thunderbolt configuration")
self.constants.disable_thunderbolt = True
if args.moderate_smbios:
print("- Set Moderate SMBIOS Patching configuration")
self.constants.serial_settings = "Moderate"

View File

@@ -124,6 +124,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
[f"Allow Wake on WLAN:\t\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:\t\tCurrently {self.constants.allow_ivy_igpu}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_ivy],
[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],
[f"Disable Thunderbolt:\t\tCurrently {self.constants.disable_thunderbolt}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).disable_thunderbolt],
[f"Disable AMFI:\t\t\tCurrently {self.constants.disable_amfi}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).set_amfi],
[
f"Set SIP and SecureBootModel:\tSIP: {self.constants.sip_status} SBM: {self.constants.secure_status}",

View File

@@ -574,7 +574,7 @@ 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 self.model in ["MacBookPro11,1", "MacBookPro11,2", "MacBookPro11,3", "MacBookPro11,4", "MacBookPro11,5"]:
if self.constants.disable_thunderbolt 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"]:
# 15" dGPU models: IOACPIPlane:/_SB/PCI0@0/PEG1@10001/UPSB@0/DSB0@0/NHI0@0

View File

@@ -591,4 +591,28 @@ Note: for the average user, we recommend using dosdude1's legacy patcher:
elif change_menu in {"n", "N", "no", "No"}:
self.constants.moj_cat_accel = False
else:
print("Invalid option")
print("Invalid option")
def disable_thunderbolt(self):
Utilities.cls()
Utilities.header(["Disable Thunderbolt on 2013-14 MacBook Pros"])
print(
"""
Some 2013-14 MacBook Pro's have issues with the built-in thunderbolt,
resulting in kernel panics and random shutdowns.
To alliviate, you can disable the thunderbolt controller on MacBookPro11,x
machines with this option.
Note: This option only works on MacBookPro11,x, file an issue if you know of
other devices that benefit from this fix.
"""
)
change_menu = input("Disable Thunderbolt?(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.disable_thunderbolt = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.disable_thunderbolt = False
else:
print("Invalid option")

View File

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