Skip to content

Commit 03ed8ed

Browse files
committed
Fix crash on iMacs with Metal GPUs
1 parent 9720d90 commit 03ed8ed

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# OpenCore Legacy Patcher changelog
22

33
## 0.1.0
4+
- Fix crash on iMacs with Metal GPUs
45

56
## 0.0.23
67
- Fix MacBookPro4,1 15" and 17" audio support
@@ -33,7 +34,7 @@
3334
## 0.0.21
3435
- Fix botched images in OpenCanopy
3536
- Add support for 3rd party OpenCore usage detection during building
36-
- Mainly for users transtioning from Ausdauersportler's OpenCore configuration
37+
- Mainly for users transitioning from Ausdauersportler's OpenCore configuration
3738

3839
## 0.0.20
3940
- Fix CPU Calculation on early MCP79 chipsets (ie. iMac9,1, MacBook5,x)

OpenCore-Patcher.command

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class OpenCoreLegacyPatcher():
2727
self.constants.serial_settings = "Moderate"
2828
if self.current_model in ModelArray.LegacyGPU:
2929
Build.BuildOpenCore(self.constants.custom_model or self.current_model, self.constants).check_pciid(False)
30-
if not (self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_amd_ati and self.constants.dgpu_device in ModelArray.AMDMXMGPUs) or not (self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_nvidia and self.constants.dgpu_device in ModelArray.NVIDIAMXMGPUs):
30+
if not (self.constants.dgpu_vendor == self.constants.pci_amd_ati and self.constants.dgpu_device in ModelArray.AMDMXMGPUs) or not (self.constants.dgpu_vendor == self.constants.pci_nvidia and self.constants.dgpu_device in ModelArray.NVIDIAMXMGPUs):
3131
self.constants.sip_status = False
3232
self.constants.secure_status = False
3333

Resources/Build.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def hexswap(self, input_hex: str):
4646
def check_pciid(self, print_status):
4747
try:
4848
self.constants.igpu_devices = plistlib.loads(subprocess.run("ioreg -r -n IGPU -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
49-
self.constants.igpu_devices = [i for i in self.constants.igpu_devices if i["class-code"] == binascii.unhexlify("00000300")]
49+
#self.constants.igpu_devices = [i for i in self.constants.igpu_devices if i["class-code"] == binascii.unhexlify("00000300") or i["class-code"] == binascii.unhexlify("00800300")]
5050
self.constants.igpu_vendor = self.hexswap(binascii.hexlify(self.constants.igpu_devices[0]["vendor-id"]).decode()[:4])
5151
self.constants.igpu_device = self.hexswap(binascii.hexlify(self.constants.igpu_devices[0]["device-id"]).decode()[:4])
5252
if print_status is True:
@@ -58,7 +58,7 @@ def check_pciid(self, print_status):
5858

5959
try:
6060
self.constants.dgpu_devices = plistlib.loads(subprocess.run("ioreg -r -n GFX0 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
61-
self.constants.dgpu_devices = [i for i in self.constants.dgpu_devices if i["class-code"] == binascii.unhexlify("00000300")]
61+
#self.constants.dgpu_devices = [i for i in self.constants.dgpu_devices if i["class-code"] == binascii.unhexlify("00000300") or i["class-code"] == binascii.unhexlify("00800300")]
6262
self.constants.dgpu_vendor = self.hexswap(binascii.hexlify(self.constants.dgpu_devices[0]["vendor-id"]).decode()[:4])
6363
self.constants.dgpu_device = self.hexswap(binascii.hexlify(self.constants.dgpu_devices[0]["device-id"]).decode()[:4])
6464
if print_status is True:
@@ -313,13 +313,13 @@ def amd_patch(self):
313313
nvidia_patch(self)
314314
else:
315315
print("- Failed to find vendor")
316-
elif self.constants.custom_model == "None":
316+
elif not self.constants.custom_model:
317317
self.check_pciid(True)
318318
if self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_amd_ati and self.constants.dgpu_device in ModelArray.AMDMXMGPUs:
319319
amd_patch(self)
320320
elif self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_nvidia and self.constants.dgpu_device in ModelArray.NVIDIAMXMGPUs:
321321
nvidia_patch(self)
322-
elif self.model in ModelArray.MacPro71:
322+
if self.model in ModelArray.MacPro71:
323323
print("- Adding Mac Pro, Xserve DRM patches")
324324
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1 -wegtree"
325325

@@ -409,11 +409,11 @@ def set_smbios(self):
409409
print("- Spoofing to iMacPro1,1")
410410
spoofed_model = "iMacPro1,1"
411411
spoofed_board = "Mac-7BA5B2D9E42DDD94"
412-
elif (self.constants.current_gpuv == "AMD (0x1002)") & (self.constants.current_gpud in ModelArray.AMDMXMGPUs) & (self.constants.custom_model == "None"):
412+
elif self.constants.dgpu_vendor == self.constants.pci_amd_ati and self.constants.dgpu_device in ModelArray.AMDMXMGPUs and not self.constants.custom_model:
413413
print("- Spoofing to iMacPro1,1")
414414
spoofed_model = "iMacPro1,1"
415415
spoofed_board = "Mac-7BA5B2D9E42DDD94"
416-
elif (self.constants.current_gpuv == "NVIDIA (0x10de)") & (self.constants.current_gpud in ModelArray.NVIDIAMXMGPUs) & (self.constants.custom_model == "None"):
416+
elif self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_nvidia and self.constants.dgpu_device in ModelArray.NVIDIAMXMGPUs:
417417
print("- Spoofing to iMacPro1,1")
418418
spoofed_model = "iMacPro1,1"
419419
spoofed_board = "Mac-7BA5B2D9E42DDD94"

0 commit comments

Comments
 (0)