Skip to content

Commit

Permalink
Fix crash on iMacs with Metal GPUs
Browse files Browse the repository at this point in the history
  • Loading branch information
khronokernel committed Apr 17, 2021
1 parent 9720d90 commit 03ed8ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# OpenCore Legacy Patcher changelog

## 0.1.0
- Fix crash on iMacs with Metal GPUs

## 0.0.23
- Fix MacBookPro4,1 15" and 17" audio support
Expand Down Expand Up @@ -33,7 +34,7 @@
## 0.0.21
- Fix botched images in OpenCanopy
- Add support for 3rd party OpenCore usage detection during building
- Mainly for users transtioning from Ausdauersportler's OpenCore configuration
- Mainly for users transitioning from Ausdauersportler's OpenCore configuration

## 0.0.20
- Fix CPU Calculation on early MCP79 chipsets (ie. iMac9,1, MacBook5,x)
Expand Down
2 changes: 1 addition & 1 deletion OpenCore-Patcher.command
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class OpenCoreLegacyPatcher():
self.constants.serial_settings = "Moderate"
if self.current_model in ModelArray.LegacyGPU:
Build.BuildOpenCore(self.constants.custom_model or self.current_model, self.constants).check_pciid(False)
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):
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):
self.constants.sip_status = False
self.constants.secure_status = False

Expand Down
12 changes: 6 additions & 6 deletions Resources/Build.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def hexswap(self, input_hex: str):
def check_pciid(self, print_status):
try:
self.constants.igpu_devices = plistlib.loads(subprocess.run("ioreg -r -n IGPU -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
self.constants.igpu_devices = [i for i in self.constants.igpu_devices if i["class-code"] == binascii.unhexlify("00000300")]
#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")]
self.constants.igpu_vendor = self.hexswap(binascii.hexlify(self.constants.igpu_devices[0]["vendor-id"]).decode()[:4])
self.constants.igpu_device = self.hexswap(binascii.hexlify(self.constants.igpu_devices[0]["device-id"]).decode()[:4])
if print_status is True:
Expand All @@ -58,7 +58,7 @@ def check_pciid(self, print_status):

try:
self.constants.dgpu_devices = plistlib.loads(subprocess.run("ioreg -r -n GFX0 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
self.constants.dgpu_devices = [i for i in self.constants.dgpu_devices if i["class-code"] == binascii.unhexlify("00000300")]
#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")]
self.constants.dgpu_vendor = self.hexswap(binascii.hexlify(self.constants.dgpu_devices[0]["vendor-id"]).decode()[:4])
self.constants.dgpu_device = self.hexswap(binascii.hexlify(self.constants.dgpu_devices[0]["device-id"]).decode()[:4])
if print_status is True:
Expand Down Expand Up @@ -313,13 +313,13 @@ def amd_patch(self):
nvidia_patch(self)
else:
print("- Failed to find vendor")
elif self.constants.custom_model == "None":
elif not self.constants.custom_model:
self.check_pciid(True)
if self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_amd_ati and self.constants.dgpu_device in ModelArray.AMDMXMGPUs:
amd_patch(self)
elif self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_nvidia and self.constants.dgpu_device in ModelArray.NVIDIAMXMGPUs:
nvidia_patch(self)
elif self.model in ModelArray.MacPro71:
if self.model in ModelArray.MacPro71:
print("- Adding Mac Pro, Xserve DRM patches")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1 -wegtree"

Expand Down Expand Up @@ -409,11 +409,11 @@ def set_smbios(self):
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"):
elif self.constants.dgpu_vendor == self.constants.pci_amd_ati and self.constants.dgpu_device in ModelArray.AMDMXMGPUs and not self.constants.custom_model:
print("- Spoofing to iMacPro1,1")
spoofed_model = "iMacPro1,1"
spoofed_board = "Mac-7BA5B2D9E42DDD94"
elif (self.constants.current_gpuv == "NVIDIA (0x10de)") & (self.constants.current_gpud in ModelArray.NVIDIAMXMGPUs) & (self.constants.custom_model == "None"):
elif self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_nvidia and self.constants.dgpu_device in ModelArray.NVIDIAMXMGPUs:
print("- Spoofing to iMacPro1,1")
spoofed_model = "iMacPro1,1"
spoofed_board = "Mac-7BA5B2D9E42DDD94"
Expand Down

0 comments on commit 03ed8ed

Please sign in to comment.