Skip to content

Commit 83df3e3

Browse files
committed
Add upgraded GPU checks
1 parent 9ce2e2a commit 83df3e3

File tree

5 files changed

+91
-12
lines changed

5 files changed

+91
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
- Increment binaries
88
- OpenCore cbd2fa3(0.6.7 release)
99
- WhateverGreen 2e19d1b(1.4.8 release)
10+
- Rework SMBIOS allowing both original and custom serials(Should resolve all iMessage issues)
11+
- Support upgraded GPU detection in iMac10,x-12,x
1012

1113
## 0.0.10
1214
- Increment binaries

OpenCore-Patcher.command

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ PATCHER_VERSION = "0.0.11"
1212
class OpenCoreLegacyPatcher():
1313
def __init__(self):
1414
self.constants = Constants.Constants()
15-
self.custom_model: str = None
1615
self.current_model: str = None
1716
opencore_model: str = subprocess.run("nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oem-product".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
1817
if not opencore_model.startswith("nvram: Error getting variable"):
@@ -23,10 +22,10 @@ class OpenCoreLegacyPatcher():
2322
self.current_model = [line.strip().split(": ", 1)[1] for line in self.current_model.stdout.decode().split("\n") if line.strip().startswith("Model Identifier")][0]
2423

2524
def build_opencore(self):
26-
build.BuildOpenCore(self.custom_model or self.current_model, self.constants).build_opencore()
25+
build.BuildOpenCore(self.constants.custom_model or self.current_model, self.constants).build_opencore()
2726

2827
def install_opencore(self):
29-
build.BuildOpenCore(self.custom_model or self.current_model, self.constants).copy_efi()
28+
build.BuildOpenCore(self.constants.custom_model or self.current_model, self.constants).copy_efi()
3029

3130
def change_model(self):
3231
utilities.cls()
@@ -36,7 +35,7 @@ Tip: Run the following command on the target machine to find the model identifie
3635
3736
system_profiler SPHardwareDataType | grep 'Model Identifier'
3837
""")
39-
self.custom_model = input("Please enter the model identifier of the target machine: ").strip()
38+
self.constants.custom_model = input("Please enter the model identifier of the target machine: ").strip()
4039

4140
def credits(self):
4241
utilities.TUIOnlyPrint(["Credits"], "Press [Enter] to go back.\n",
@@ -53,23 +52,23 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
5352
while not (response and response == -1):
5453
title = [
5554
f"OpenCore Legacy Patcher v{self.constants.patcher_version}",
56-
f"Selected Model: {self.custom_model or self.current_model}"
55+
f"Selected Model: {self.constants.custom_model or self.current_model}"
5756
]
5857

59-
if (self.custom_model or self.current_model) not in ModelArray.SupportedSMBIOS:
58+
if (self.constants.custom_model or self.current_model) not in ModelArray.SupportedSMBIOS:
6059
in_between = [
6160
'Your model is not supported by this patcher!',
6261
'',
6362
'If you plan to create the USB for another machine, please select the "Change Model" option in the menu.'
6463
]
65-
elif not self.custom_model and self.current_model in ("MacPro3,1", "iMac7,1") and \
64+
elif not self.constants.custom_model and self.current_model in ("MacPro3,1", "iMac7,1") and \
6665
"SSE4.1" not in subprocess.run("sysctl machdep.cpu.features".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode():
6766
in_between = [
6867
'Your model requires a CPU upgrade to a CPU supporting SSE4.1+ to be supported by this patcher!',
6968
'',
7069
f'If you plan to create the USB for another {self.current_model} with SSE4.1+, please select the "Change Model" option in the menu.'
7170
]
72-
elif self.custom_model in ("MacPro3,1", "iMac7,1"):
71+
elif self.constants.custom_model in ("MacPro3,1", "iMac7,1"):
7372
in_between = ["This model is supported",
7473
"However please ensure the CPU has been upgraded to support SSE4.1+"
7574
]
@@ -78,7 +77,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
7877

7978
menu = utilities.TUIMenu(title, "Please select an option: ", in_between=in_between, auto_number=True, top_level=True)
8079

81-
options = ([["Build OpenCore", self.build_opencore]] if ((self.custom_model or self.current_model) in ModelArray.SupportedSMBIOS) else []) + [
80+
options = ([["Build OpenCore", self.build_opencore]] if ((self.constants.custom_model or self.current_model) in ModelArray.SupportedSMBIOS) else []) + [
8281
["Install OpenCore to USB/internal drive", self.install_opencore],
8382
["Change Model", self.change_model],
8483
["Credits", self.credits]

Resources/Constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ def __init__(self):
3030
self.current_path = Path(__file__).parent.parent.resolve()
3131
self.payload_path = self.current_path / Path("payloads")
3232

33+
self.custom_model: str = None
34+
self.custom_mxm_gpu: str = None
3335
# Payload Location
3436
# OpenCore
3537
@property

Resources/ModelArray.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,4 +710,52 @@
710710

711711
IH = [
712712
"MacPro6,1"
713+
]
714+
715+
upgradableMXMGPUs = [
716+
"iMac10,1"
717+
"iMac11,1",
718+
"iMac11,2",
719+
"iMac11,3",
720+
"iMac12,1",
721+
"iMac12,2",
722+
"Xserve3,1",
723+
]
724+
725+
# Reference: https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/
726+
NVIDIAMXMGPUs = [
727+
"0x12b9",#Quadro K610M
728+
"0x0ff6",#Quadro K1100M
729+
"0x11fc",#Quadro K2100M
730+
"0x0ffc",#Quadro K1000M
731+
"0x0ffb",#Quadro K2000M
732+
"0x11b6",#Quadro K3100M
733+
"0x11b7",#Quadro K4100M
734+
"0x11bc",#Quadro K5000M
735+
"0x11b8",#Quadro K5100M
736+
"0x11e1",#GTX 765M
737+
"0x11e2",#GTX 765M
738+
"0x11e0",#GTX 770M
739+
"0x119e",#GTX 780M Mac Edition
740+
"0x119e",#GTX 780M
741+
"0x119f",#GTX 880M
742+
"0x119a",#GTX 860M
743+
"0x1392",#GTX 860M
744+
"0x1199",#GTX 870M
745+
"0x11a9",#GTX 870M
746+
"0x731f",
747+
]
748+
749+
AMDMXMGPUs = [
750+
"0x67EF",#AMD RX 460
751+
"0x67e8",#AMD WX 4130/WX 4150
752+
"0x67e0",#AMD WX 4170
753+
"0x67c0",#AMD WX 7100
754+
"0x731f",
755+
]
756+
757+
nativeWifi = [
758+
"0x43ba",#BCM43602
759+
"0x43a3",#BCM4350
760+
"0x43a0",#BCM4360
713761
]

Resources/build.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,28 @@ def build_efi(self):
137137
if self.model in ModelArray.HiDPIpicker:
138138
print("- Setting HiDPI picker")
139139
self.config["NVRAM"]["Add"]["4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14"]["UIScale"] = binascii.unhexlify("02")
140+
141+
# Check GPU Vendor
142+
if self.constants.custom_model != "None":
143+
#current_gpu: str = subprocess.run("system_profiler SPDisplaysDataType".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
144+
#current_gpuv = [line.strip().split(": ", 1)[1] for line in current_gpu.split("\n") if line.strip().startswith(("Vendor"))][0]
145+
#current_gpud = [line.strip().split(": ", 1)[1] for line in current_gpu.split("\n") if line.strip().startswith(("Device ID"))][0]
146+
current_gpuv = "NVIDIA (0x10de)"
147+
current_gpud = "0x11a9"
148+
print(f"- Detected GPU: {current_gpuv} {current_gpud}")
149+
if (current_gpuv == "AMD (0x1002)") & (current_gpud in ModelArray.AMDMXMGPUs):
150+
self.constants.custom_mxm_gpu = True
151+
print("- Adding AMD DRM patches")
152+
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=80 unfairgva=1"
153+
elif (current_gpuv == "NVIDIA (0x10de)") & (current_gpud in ModelArray.NVIDIAMXMGPUs):
154+
self.constants.custom_mxm_gpu = True
155+
print("- Adding Brightness Control patches")
156+
if self.model in ["iMac11,1", "iMac11,2", "iMac11,3"]:
157+
backlight_path = "PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)"
158+
self.config["DeviceProperties"]["Add"][backlight_path] = {"@0,backlight-control": binascii.unhexlify("01000000"), "@0,built-in": binascii.unhexlify("01000000")}
159+
elif self.model in ["iMac12,1", "iMac12,2"]:
160+
backlight_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
161+
self.config["DeviceProperties"]["Add"][backlight_path] = {"@0,backlight-control": binascii.unhexlify("01000000"), "@0,built-in": binascii.unhexlify("01000000")}
140162

141163
# Add OpenCanopy
142164
print("- Adding OpenCanopy GUI")
@@ -168,9 +190,14 @@ def set_smbios(self):
168190
spoofed_model = "Macmini7,1"
169191
spoofed_board = "Mac-35C5E08120C7EEAF"
170192
elif self.model in ModelArray.iMac151:
171-
print("- Spoofing to iMac15,1")
172-
spoofed_model = "iMac15,1"
173-
spoofed_board = "Mac-42FD25EABCABB274"
193+
if self.constants.custom_mxm_gpu == True:
194+
print("- Spoofing to iMacPro1,1")
195+
spoofed_model = "iMacPro1,1"
196+
spoofed_board = "Mac-7BA5B2D9E42DDD94"
197+
else:
198+
print("- Spoofing to iMac15,1")
199+
spoofed_model = "iMac15,1"
200+
spoofed_board = "Mac-42FD25EABCABB274"
174201
elif self.model in ModelArray.iMac144:
175202
print("- Spoofing to iMac14,4")
176203
spoofed_model = "iMac14,4"
@@ -198,6 +225,7 @@ def set_smbios(self):
198225
self.config["PlatformInfo"]["Automatic"] = True
199226
self.config["PlatformInfo"]["UpdateDataHub"] = True
200227
self.config["PlatformInfo"]["UpdateNVRAM"] = True
228+
self.config["UEFI"]["ProtocolOverrides"]["DataHub"] = True
201229
self.config["PlatformInfo"]["Generic"]["SystemProductName"] = spoofed_model
202230
self.config["PlatformInfo"]["Generic"]["SystemSerialNumber"] = macserial_output[0]
203231
self.config["PlatformInfo"]["Generic"]["MLB"] = macserial_output[1]

0 commit comments

Comments
 (0)