mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-14 04:38:20 +10:00
Add user-configurable Wifi and GPU patches
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
## 0.0.15
|
||||
- Add user-configurable OpenCore DEBUG builds
|
||||
- Add user-configurable Wifi and GPU patches
|
||||
|
||||
## 0.0.14
|
||||
- Enable ThirdPartyDrives to aid with hibernation on 3rd party SATA drives
|
||||
|
||||
@@ -35,8 +35,10 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
|
||||
""")
|
||||
self.constants.custom_model = input("Please enter the model identifier of the target machine: ").strip()
|
||||
if self.constants.custom_model not in ModelArray.SupportedSMBIOS:
|
||||
print(f"{self.constants.custom_model} is not a valid SMBIOS Identifier!")
|
||||
print_models = input("Print list of valid options? (y/n)")
|
||||
print(f"""
|
||||
{self.constants.custom_model} is not a valid SMBIOS Identifier for macOS {self.constants.os_support}!
|
||||
""")
|
||||
print_models = input(f"Print list of valid options for macOS {self.constants.os_support}? (y/n)")
|
||||
if print_models in {"y", "Y", "yes", "Yes"}:
|
||||
print("\n".join(ModelArray.SupportedSMBIOS))
|
||||
input("Press any key to continue...")
|
||||
@@ -54,6 +56,10 @@ Current target:\t{self.constants.os_support}
|
||||
print("Unsupported entry")
|
||||
else:
|
||||
self.constants.os_support = temp_os_support
|
||||
if temp_os_support == 11.0:
|
||||
ModelArray.SupportedSMBIOS = ModelArray.SupportedSMBIOS11
|
||||
elif temp_os_support == 12.0:
|
||||
ModelArray.SupportedSMBIOS = ModelArray.SupportedSMBIOS12
|
||||
|
||||
def change_verbose(self):
|
||||
utilities.cls()
|
||||
@@ -88,6 +94,39 @@ Current target:\t{self.constants.os_support}
|
||||
self.constants.kext_debug = False
|
||||
else:
|
||||
print("Invalid option")
|
||||
|
||||
def change_metal(self):
|
||||
utilities.cls()
|
||||
utilities.header(["Assume Metal GPU Always in iMac"])
|
||||
print("""This is for iMacs that have upgraded Metal GPUs, otherwise
|
||||
Patcher assumes based on stock configuration (ie. iMac10,x-12,x)
|
||||
|
||||
Note: Patcher will detect whether hardware has been upgraded regardless, this
|
||||
option is for those patching on a different machine.
|
||||
""")
|
||||
change_kext_menu = input("Enable Metal GPU build algorithm?(y/n): ")
|
||||
if change_kext_menu in {"y", "Y", "yes", "Yes"}:
|
||||
self.constants.metal_build = True
|
||||
elif change_kext_menu in {"n", "N", "no", "No"}:
|
||||
self.constants.metal_build = False
|
||||
else:
|
||||
print("Invalid option")
|
||||
|
||||
def change_wifi(self):
|
||||
utilities.cls()
|
||||
utilities.header(["Assume Upgraded Wifi Always"])
|
||||
print("""This is for Macs with upgraded wifi cards(ie. BCM94360/2)
|
||||
|
||||
Note: Patcher will detect whether hardware has been upgraded regardless, this
|
||||
option is for those patching on a different machine.
|
||||
""")
|
||||
change_kext_menu = input("Enable Upgraded Wifi build algorithm?(y/n): ")
|
||||
if change_kext_menu in {"y", "Y", "yes", "Yes"}:
|
||||
self.constants.wifi_build = True
|
||||
elif change_kext_menu in {"n", "N", "no", "No"}:
|
||||
self.constants.wifi_build = False
|
||||
else:
|
||||
print("Invalid option")
|
||||
|
||||
def patcher_settings(self):
|
||||
response = None
|
||||
@@ -98,10 +137,12 @@ Current target:\t{self.constants.os_support}
|
||||
menu = utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
# TODO: Enable setting OS target when more OSes become supported by the patcher
|
||||
#[f"Change OS version:\t\tCurrently macOS {self.constants.os_support}", self.change_os],
|
||||
[f"Enable Verbose Mode:\tCurrently {self.constants.verbose_debug}", self.change_verbose],
|
||||
[f"Enable OpenCore DEBUG:\tCurrently {self.constants.opencore_debug}", self.change_oc],
|
||||
[f"Enable Kext DEBUG:\t\tCurrently {self.constants.kext_debug}", self.change_kext]
|
||||
#[f"Change OS version:\t\t\tCurrently macOS {self.constants.os_support}", self.change_os],
|
||||
[f"Enable Verbose Mode:\t\tCurrently {self.constants.verbose_debug}", self.change_verbose],
|
||||
[f"Enable OpenCore DEBUG:\t\tCurrently {self.constants.opencore_debug}", self.change_oc],
|
||||
[f"Enable Kext DEBUG:\t\t\tCurrently {self.constants.kext_debug}", self.change_kext],
|
||||
[f"Assume Metal GPU Always:\t\tCurrently {self.constants.kext_debug}", self.change_metal],
|
||||
[f"Assume Upgraded Wifi Always:\tCurrently {self.constants.kext_debug}", self.change_wifi],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
@@ -125,10 +166,12 @@ Current target:\t{self.constants.os_support}
|
||||
|
||||
def main_menu(self):
|
||||
response = None
|
||||
ModelArray.SupportedSMBIOS = ModelArray.SupportedSMBIOS11
|
||||
while not (response and response == -1):
|
||||
title = [
|
||||
f"OpenCore Legacy Patcher v{self.constants.patcher_version}",
|
||||
f"Selected Model: {self.constants.custom_model or self.current_model}"
|
||||
f"Selected Model: {self.constants.custom_model or self.current_model}",
|
||||
f"Target OS: macOS {self.constants.os_support}"
|
||||
]
|
||||
|
||||
if (self.constants.custom_model or self.current_model) not in ModelArray.SupportedSMBIOS:
|
||||
|
||||
@@ -46,6 +46,8 @@ class Constants:
|
||||
self.os_support = 11.0
|
||||
self.min_os_support = 11.0
|
||||
self.max_os_support = 11.0
|
||||
self.metal_build = False
|
||||
self.wifi_build = False
|
||||
|
||||
# Payload Location
|
||||
# OpenCore
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Lists all models and required patches
|
||||
|
||||
SupportedSMBIOS = [
|
||||
SupportedSMBIOS11 = [
|
||||
# MacBook
|
||||
"MacBook5,1",
|
||||
"MacBook5,2",
|
||||
@@ -60,7 +60,11 @@ SupportedSMBIOS = [
|
||||
"MacPro5,1",
|
||||
# Xserve
|
||||
"Xserve3,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
SupportedSMBIOS12 = [
|
||||
|
||||
]
|
||||
|
||||
## CPU patches
|
||||
@@ -87,12 +91,12 @@ MissingSSE42 = [
|
||||
"iMac9,1",
|
||||
"iMac10,1",
|
||||
"MacPro3,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
SSEEmulator = [
|
||||
"MacPro3,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
DualSocket = [
|
||||
@@ -100,7 +104,7 @@ DualSocket = [
|
||||
"MacPro4,1",
|
||||
"MacPro5,1",
|
||||
"Xserve3,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
pciSSDT = [
|
||||
@@ -109,7 +113,7 @@ pciSSDT = [
|
||||
"iMac11,1",
|
||||
"iMac11,2",
|
||||
"iMac11,3",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
## Ethernet patches
|
||||
@@ -129,13 +133,13 @@ EthernetNvidia = [
|
||||
"Macmini4,1",
|
||||
"iMac9,1",
|
||||
"iMac10,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
EthernetMarvell = [
|
||||
"MacBookPro4,1",
|
||||
"iMac7,1",
|
||||
"iMac8,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
EthernetBroadcom = [
|
||||
"MacBookPro6,1",
|
||||
@@ -151,7 +155,7 @@ EthernetBroadcom = [
|
||||
"iMac11,3",
|
||||
"iMac12,1",
|
||||
"iMac12,2",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
## Wifi patches
|
||||
@@ -165,7 +169,7 @@ WifiAtheros = [
|
||||
"iMac12,2",
|
||||
"MacPro3,1",
|
||||
"MacPro4,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
WifiBCM94328 = [
|
||||
@@ -173,7 +177,7 @@ WifiBCM94328 = [
|
||||
"MacBookPro4,1",
|
||||
"iMac7,1",
|
||||
"iMac8,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
WifiBCM94322 = [
|
||||
@@ -191,7 +195,7 @@ WifiBCM94322 = [
|
||||
"MacBookPro5,4",
|
||||
"MacBookPro5,5",
|
||||
"MacBookPro7,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
WifiBCM943224 = [
|
||||
@@ -201,7 +205,7 @@ WifiBCM943224 = [
|
||||
"MacBookPro6,2",
|
||||
"Macmini3,1",
|
||||
"Macmini4,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
WifiBCM94331 = [
|
||||
@@ -241,7 +245,7 @@ WifiBCM94331 = [
|
||||
"iMac13,1", # PciRoot(0x0)/Pci(0x1C,0x3)/Pci(0x0,0x0)
|
||||
"iMac13,2", # PciRoot(0x0)/Pci(0x1C,0x3)/Pci(0x0,0x0)
|
||||
"MacPro5,1", # PciRoot(0x0)/Pci(0x1C,0x5)/Pci(0x0,0x0)
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
## Audio
|
||||
@@ -283,7 +287,7 @@ LegacyAudio = [
|
||||
"iMac12,1",
|
||||
"iMac12,2",
|
||||
"MacPro3,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
## GPU
|
||||
@@ -324,7 +328,7 @@ LegacyGPU = [
|
||||
"iMac11,3",
|
||||
"iMac12,1",
|
||||
"iMac12,2",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
LegacyHID = [
|
||||
@@ -348,14 +352,14 @@ LegacyHID = [
|
||||
"iMac9,1",
|
||||
"iMac10,1",
|
||||
"MacPro3,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
NVMePatch = [
|
||||
"MacPro3,1",
|
||||
"MacPro4,1",
|
||||
"Xserve3,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
SidecarPatch = [
|
||||
@@ -372,7 +376,7 @@ SidecarPatch = [
|
||||
"iMac14,1",
|
||||
"iMac14,2",
|
||||
"iMac14,3",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
DualGPUPatch = [
|
||||
@@ -393,18 +397,18 @@ DualGPUPatch = [
|
||||
"iMac13,2",
|
||||
"iMac14,2",
|
||||
"iMac14,3",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
HiDPIpicker = [
|
||||
"MacBookPro10,1",
|
||||
"MacBookPro10,2",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
IDEPatch = [
|
||||
"MacPro3,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
# 11" Air
|
||||
@@ -491,7 +495,7 @@ MacPro71 = [
|
||||
"MacPro4,1",
|
||||
"MacPro5,1",
|
||||
"Xserve3,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
# Maps
|
||||
@@ -724,7 +728,7 @@ upgradableMXMGPUs = [
|
||||
"iMac12,1",
|
||||
"iMac12,2",
|
||||
"Xserve3,1",
|
||||
"iMacProMax1,1"
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
# Reference: https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/
|
||||
|
||||
@@ -95,7 +95,9 @@ class BuildOpenCore:
|
||||
# WiFi patches
|
||||
wifi_devices = plistlib.loads(subprocess.run("ioreg -c IOPCIDevice -r -d2 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||
wifi_devices = [i for i in wifi_devices if i["vendor-id"] == binascii.unhexlify("E4140000") and i["class-code"] == binascii.unhexlify("00800200")]
|
||||
if not self.constants.custom_model and wifi_devices and self.hexswap(binascii.hexlify(wifi_devices[0]["device-id"]).decode()[:4]) in ModelArray.nativeWifi:
|
||||
if self.constants.wifi_build == True:
|
||||
print("- Skipping Wifi patches on request")
|
||||
elif not self.constants.custom_model and wifi_devices and self.hexswap(binascii.hexlify(wifi_devices[0]["device-id"]).decode()[:4]) in ModelArray.nativeWifi:
|
||||
print("- Found supported WiFi card, skipping wifi patches")
|
||||
else:
|
||||
if self.model in ModelArray.WifiAtheros:
|
||||
@@ -161,7 +163,9 @@ class BuildOpenCore:
|
||||
self.config["NVRAM"]["Add"]["4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14"]["UIScale"] = binascii.unhexlify("02")
|
||||
|
||||
# Check GPU Vendor
|
||||
if self.constants.custom_model == "None":
|
||||
if self.constants.metal_build == True:
|
||||
print("- Adding Metal GPU patches on request")
|
||||
elif self.constants.custom_model == "None":
|
||||
current_gpu: str = subprocess.run("system_profiler SPDisplaysDataType".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
|
||||
self.constants.current_gpuv = [line.strip().split(": ", 1)[1] for line in current_gpu.split("\n") if line.strip().startswith(("Vendor"))][0]
|
||||
self.constants.current_gpud = [line.strip().split(": ", 1)[1] for line in current_gpu.split("\n") if line.strip().startswith(("Device ID"))][0]
|
||||
@@ -235,7 +239,11 @@ class BuildOpenCore:
|
||||
spoofed_board = "Mac-35C5E08120C7EEAF"
|
||||
elif self.model in ModelArray.iMac151:
|
||||
# Check for upgraded GPUs on iMacs
|
||||
if (self.constants.current_gpuv == "AMD (0x1002)") & (self.constants.current_gpud in ModelArray.AMDMXMGPUs) & (self.constants.custom_model == "None"):
|
||||
if self.constants.metal_build == True:
|
||||
print("- Spoofing to iMacPro1,1")
|
||||
spoofed_model = "iMacPro1,1"
|
||||
spoofed_board = "Mac-7BA5B2D9E42DDD94"
|
||||
elif (self.constants.current_gpuv == "AMD (0x1002)") & (self.constants.current_gpud in ModelArray.AMDMXMGPUs) & (self.constants.custom_model == "None"):
|
||||
print("- Spoofing to iMacPro1,1")
|
||||
spoofed_model = "iMacPro1,1"
|
||||
spoofed_board = "Mac-7BA5B2D9E42DDD94"
|
||||
|
||||
Reference in New Issue
Block a user