mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-18 21:30:00 +10:00
Settings: Add additional safe guards
This commit is contained in:
@@ -22,7 +22,8 @@ from data import (
|
|||||||
model_array,
|
model_array,
|
||||||
sip_data,
|
sip_data,
|
||||||
smbios_data,
|
smbios_data,
|
||||||
os_data
|
os_data,
|
||||||
|
cpu_data
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -238,7 +239,7 @@ class SettingsFrame(wx.Frame):
|
|||||||
"Enable booting macOS from",
|
"Enable booting macOS from",
|
||||||
"FireWire drives.",
|
"FireWire drives.",
|
||||||
],
|
],
|
||||||
"condition": not bool(generate_smbios.check_firewire(self.constants.computer.real_model) is False and not self.constants.custom_model)
|
"condition": not (generate_smbios.check_firewire(self.constants.custom_model or self.constants.computer.real_model) is False)
|
||||||
},
|
},
|
||||||
"XHCI Booting": {
|
"XHCI Booting": {
|
||||||
"type": "checkbox",
|
"type": "checkbox",
|
||||||
@@ -249,6 +250,7 @@ class SettingsFrame(wx.Frame):
|
|||||||
"USB 3.0 expansion cards on systems",
|
"USB 3.0 expansion cards on systems",
|
||||||
"without native support.",
|
"without native support.",
|
||||||
],
|
],
|
||||||
|
"condition": not gui_support.CheckProperties(self.constants).host_has_cpu_gen(cpu_data.cpu_data.ivy_bridge) # Sandy Bridge and older do not natively support XHCI booting
|
||||||
},
|
},
|
||||||
"NVMe Booting": {
|
"NVMe Booting": {
|
||||||
"type": "checkbox",
|
"type": "checkbox",
|
||||||
@@ -261,6 +263,7 @@ class SettingsFrame(wx.Frame):
|
|||||||
"Note: Requires Firmware support",
|
"Note: Requires Firmware support",
|
||||||
"for OpenCore to load from NVMe.",
|
"for OpenCore to load from NVMe.",
|
||||||
],
|
],
|
||||||
|
"condition": not gui_support.CheckProperties(self.constants).host_has_cpu_gen(cpu_data.cpu_data.ivy_bridge) # Sandy Bridge and older do not natively support NVMe booting
|
||||||
},
|
},
|
||||||
"wrap_around 2": {
|
"wrap_around 2": {
|
||||||
"type": "wrap_around",
|
"type": "wrap_around",
|
||||||
@@ -453,7 +456,7 @@ class SettingsFrame(wx.Frame):
|
|||||||
"'gpu-power-prefs'.",
|
"'gpu-power-prefs'.",
|
||||||
],
|
],
|
||||||
"warning": "This settings requires 'gpu-power-prefs' NVRAM argument to be set to '1'.\n\nIf missing and this option is toggled, the system will not boot\n\nFull command:\nnvram FA4CE28D-B62F-4C99-9CC3-6815686E30F9:gpu-power-prefs=%01%00%00%00",
|
"warning": "This settings requires 'gpu-power-prefs' NVRAM argument to be set to '1'.\n\nIf missing and this option is toggled, the system will not boot\n\nFull command:\nnvram FA4CE28D-B62F-4C99-9CC3-6815686E30F9:gpu-power-prefs=%01%00%00%00",
|
||||||
"condition": not bool(not self.constants.custom_model and self.constants.computer.real_model not in ["MacBookPro8,2", "MacBookPro8,3"])
|
"condition": not bool((not self.constants.custom_model and self.constants.computer.real_model not in ["MacBookPro8,2", "MacBookPro8,3"]) or (self.constants.custom_model and self.constants.custom_model not in ["MacBookPro8,2", "MacBookPro8,3"]))
|
||||||
},
|
},
|
||||||
"wrap_around 1": {
|
"wrap_around 1": {
|
||||||
"type": "wrap_around",
|
"type": "wrap_around",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import applescript
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from resources import constants
|
from resources import constants
|
||||||
from data import model_array, os_data
|
from data import model_array, os_data, cpu_data, smbios_data
|
||||||
|
|
||||||
|
|
||||||
class AutoUpdateStages:
|
class AutoUpdateStages:
|
||||||
@@ -122,6 +122,16 @@ class CheckProperties:
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def host_has_cpu_gen(self, gen: int) -> bool:
|
||||||
|
"""
|
||||||
|
Check if host has a CPU generation equal to or greater than the specified generation
|
||||||
|
"""
|
||||||
|
model = self.constants.custom_model if self.constants.custom_model else self.constants.computer.real_model
|
||||||
|
if model in smbios_data.smbios_dictionary:
|
||||||
|
if smbios_data.smbios_dictionary[model]["CPU Generation"] >= gen:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
class PayloadMount:
|
class PayloadMount:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user