@@ -17,52 +17,47 @@ class OpenCoreLegacyPatcher():
1717 self .current_model : str = None
1818 self .current_model = DeviceProbe .smbios_probe ().model_detect (False )
1919 self .constants .detected_os = int (platform .uname ().release .partition ("." )[0 ])
20- if self .current_model in ModelArray .LegacyGPU :
21- dgpu_vendor ,dgpu_device ,dgpu_acpi = DeviceProbe .pci_probe ().gpu_probe ("GFX0" )
22-
23- if (dgpu_vendor == self .constants .pci_amd_ati and (dgpu_device in PCIIDArray .amd_ids ().polaris_ids or dgpu_device in PCIIDArray .amd_ids ().vega_ids or dgpu_device in PCIIDArray .amd_ids ().navi_ids or dgpu_device in PCIIDArray .amd_ids ().legacy_gcn_ids )) or (dgpu_vendor == self .constants .pci_nvidia and dgpu_device in PCIIDArray .nvidia_ids ().kepler_ids ):
24- self .constants .sip_status = True
25- self .constants .secure_status = False
26- self .constants .disable_amfi = False
27- else :
28- self .constants .sip_status = False
29- self .constants .secure_status = False
30- self .constants .disable_amfi = True
31- if self .current_model in ModelArray .ModernGPU :
32- if self .current_model in ["iMac13,1" , "iMac13,3" ]:
33- dgpu_vendor ,dgpu_device ,dgpu_acpi = DeviceProbe .pci_probe ().gpu_probe ("GFX0" )
34- if not dgpu_vendor :
35- self .constants .sip_status = False
36- self .constants .secure_status = False
37- else :
38- self .constants .sip_status = False
39- self .constants .secure_status = False
40-
41- # Logic for when user runs custom OpenCore build and do not expose it
42- # Note: This logic currently only applies for iMacPro1,1 users, see below threads on the culprits:
43- # - https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/post-17425857
44- # - https://forums.macrumors.com/threads/opencore-on-the-mac-pro.2207814/
45- # PLEASE FOR THE LOVE OF GOD JUST SET ExposeSensitiveData CORRECTLY!!!
46- if self .current_model == "iMacPro1,1" :
47- serial : str = subprocess .run ("system_profiler SPHardwareDataType | grep Serial" .split (), stdout = subprocess .PIPE , stderr = subprocess .STDOUT ).stdout .decode ()
48- serial = [line .strip ().split ("Number (system): " , 1 )[1 ] for line in serial .split ("\n " ) if line .strip ().startswith ("Serial" )][0 ]
49- true_model = subprocess .run ([str (self .constants .macserial_path ), "--info" , str (serial )], stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
50- true_model = [i .partition (" - " )[2 ] for i in true_model .stdout .decode ().split ("\n " ) if "Model: " in i ][0 ]
51- print (f"True Model: { true_model } " )
52- if not true_model .startswith ("Unknown" ):
53- self .current_model = true_model
20+ self .check_default_settings (self .current_model , False )
5421
5522 custom_cpu_model_value : str = subprocess .run ("nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:revcpuname" .split (), stdout = subprocess .PIPE , stderr = subprocess .STDOUT ).stdout .decode ()
56-
5723 if not custom_cpu_model_value .startswith ("nvram: Error getting variable" ):
5824 custom_cpu_model_value = [line .strip ().split (":revcpuname " , 1 )[1 ] for line in custom_cpu_model_value .split ("\n " ) if line .strip ().startswith ("4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:" )][0 ]
5925 if custom_cpu_model_value .split ("%00" )[0 ] != "" :
6026 self .constants .custom_cpu_model = 1
6127 self .constants .custom_cpu_model_value = custom_cpu_model_value .split ("%00" )[0 ]
6228
29+ if "-v" in Utilities .get_nvram ("boot-args" , decode = False ):
30+ self .constants .verbose_debug = True
31+
6332 # Check if running in RecoveryOS
6433 self .check_recovery ()
6534
35+ def check_default_settings (self , model , custom ):
36+ self .constants .sip_status = True
37+ self .constants .disable_amfi = False
38+ if model in ModelArray .LegacyGPU :
39+ if custom is False :
40+ dgpu_vendor ,dgpu_device ,dgpu_acpi = DeviceProbe .pci_probe ().gpu_probe ("GFX0" )
41+ if (dgpu_vendor == self .constants .pci_amd_ati and (dgpu_device in PCIIDArray .amd_ids ().polaris_ids or dgpu_device in PCIIDArray .amd_ids ().vega_ids or dgpu_device in PCIIDArray .amd_ids ().navi_ids or dgpu_device in PCIIDArray .amd_ids ().legacy_gcn_ids )) or (dgpu_vendor == self .constants .pci_nvidia and dgpu_device in PCIIDArray .nvidia_ids ().kepler_ids ):
42+ self .constants .sip_status = True
43+ self .constants .secure_status = False
44+ self .constants .disable_amfi = False
45+ else :
46+ self .constants .sip_status = False
47+ self .constants .secure_status = False
48+ self .constants .disable_amfi = True
49+ if model in ModelArray .ModernGPU :
50+ if model in ["iMac13,1" , "iMac13,3" ]:
51+
52+ if custom is False :
53+ dgpu_vendor ,dgpu_device ,dgpu_acpi = DeviceProbe .pci_probe ().gpu_probe ("GFX0" )
54+ if not dgpu_vendor :
55+ self .constants .sip_status = False
56+ self .constants .secure_status = False
57+ else :
58+ self .constants .sip_status = False
59+ self .constants .secure_status = False
60+
6661 def check_recovery (self ):
6762 root_partition_info = plistlib .loads (subprocess .run ("diskutil info -plist /" .split (), stdout = subprocess .PIPE ).stdout .decode ().strip ().encode ())
6863 if root_partition_info ["VolumeName" ] == "macOS Base System" and \
@@ -95,6 +90,8 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
9590 if print_models in {"y" , "Y" , "yes" , "Yes" }:
9691 print ("\n " .join (ModelArray .SupportedSMBIOS ))
9792 input ("\n Press [ENTER] to continue" )
93+ else :
94+ self .check_default_settings (self .constants .custom_model , True )
9895
9996 def patcher_settings (self ):
10097 response = None
@@ -230,7 +227,6 @@ B. Exit
230227
231228 def main_menu (self ):
232229 response = None
233- ModelArray .SupportedSMBIOS = ModelArray .SupportedSMBIOS12
234230 while not (response and response == - 1 ):
235231 title = [
236232 f"OpenCore Legacy Patcher v{ self .constants .patcher_version } " ,
0 commit comments