@@ -12,7 +12,6 @@ PATCHER_VERSION = "0.0.11"
1212class 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
3736system_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 ]
0 commit comments