mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-23 19:40:15 +10:00
graphics_audio: avoid excessive try except usage
This commit is contained in:
@@ -219,10 +219,9 @@ class build_graphics_audio:
|
|||||||
# Xserves and MacPro4,1 are exceptions
|
# Xserves and MacPro4,1 are exceptions
|
||||||
# iMac7,1 and iMac8,1 require AppleHDA/IOAudioFamily downgrade
|
# iMac7,1 and iMac8,1 require AppleHDA/IOAudioFamily downgrade
|
||||||
if not (self.model.startswith("Xserve") or self.model in ["MacPro4,1", "iMac7,1", "iMac8,1"]):
|
if not (self.model.startswith("Xserve") or self.model in ["MacPro4,1", "iMac7,1", "iMac8,1"]):
|
||||||
try:
|
if "nForce Chipset" in smbios_data.smbios_dictionary[self.model]:
|
||||||
smbios_data.smbios_dictionary[self.model]["nForce Chipset"]
|
|
||||||
hdef_path = "PciRoot(0x0)/Pci(0x8,0x0)"
|
hdef_path = "PciRoot(0x0)/Pci(0x8,0x0)"
|
||||||
except KeyError:
|
else:
|
||||||
hdef_path = "PciRoot(0x0)/Pci(0x1b,0x0)"
|
hdef_path = "PciRoot(0x0)/Pci(0x1b,0x0)"
|
||||||
# In AppleALC, MacPro3,1's original layout is already in use, forcing layout 13 instead
|
# In AppleALC, MacPro3,1's original layout is already in use, forcing layout 13 instead
|
||||||
if self.model == "MacPro3,1":
|
if self.model == "MacPro3,1":
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ class build_smbios:
|
|||||||
|
|
||||||
def set_smbios(self):
|
def set_smbios(self):
|
||||||
spoofed_model = self.model
|
spoofed_model = self.model
|
||||||
|
|
||||||
if self.constants.override_smbios == "Default":
|
if self.constants.override_smbios == "Default":
|
||||||
if self.constants.serial_settings != "None":
|
if self.constants.serial_settings != "None":
|
||||||
print("- Setting macOS Monterey Supported SMBIOS")
|
print("- Setting macOS Monterey Supported SMBIOS")
|
||||||
@@ -54,13 +55,16 @@ class build_smbios:
|
|||||||
else:
|
else:
|
||||||
spoofed_model = self.constants.override_smbios
|
spoofed_model = self.constants.override_smbios
|
||||||
print(f"- Using Model ID: {spoofed_model}")
|
print(f"- Using Model ID: {spoofed_model}")
|
||||||
try:
|
|
||||||
spoofed_board = smbios_data.smbios_dictionary[spoofed_model]["Board ID"]
|
spoofed_board = ""
|
||||||
print(f"- Using Board ID: {spoofed_board}")
|
if spoofed_model in smbios_data.smbios_dictionary:
|
||||||
except KeyError:
|
if "Board ID" in smbios_data.smbios_dictionary[spoofed_model]:
|
||||||
spoofed_board = ""
|
spoofed_board = smbios_data.smbios_dictionary[spoofed_model]["Board ID"]
|
||||||
|
print(f"- Using Board ID: {spoofed_board}")
|
||||||
|
|
||||||
self.spoofed_model = spoofed_model
|
self.spoofed_model = spoofed_model
|
||||||
self.spoofed_board = spoofed_board
|
self.spoofed_board = spoofed_board
|
||||||
|
|
||||||
if self.constants.allow_oc_everywhere is False or self.constants.allow_native_spoofs is True:
|
if self.constants.allow_oc_everywhere is False or self.constants.allow_native_spoofs is True:
|
||||||
self.config["#Revision"]["Spoofed-Model"] = f"{self.spoofed_model} - {self.constants.serial_settings}"
|
self.config["#Revision"]["Spoofed-Model"] = f"{self.spoofed_model} - {self.constants.serial_settings}"
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ class build_support:
|
|||||||
# Check failed
|
# Check failed
|
||||||
return
|
return
|
||||||
|
|
||||||
# Is the kext already enabled?
|
|
||||||
if kext["Enabled"] is True:
|
if kext["Enabled"] is True:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user