Fix formatting

This commit is contained in:
Mykola Grymalyuk
2021-10-09 11:19:39 -06:00
parent 12998bc7e1
commit 06e0e9a2c0
21 changed files with 469 additions and 324 deletions
+27 -2
View File
@@ -1,6 +1,7 @@
from data import smbios_data, os_data
from resources import utilities
def set_smbios_model_spoof(model):
try:
smbios_data.smbios_dictionary[model]["Screen Size"]
@@ -53,6 +54,7 @@ def set_smbios_model_spoof(model):
# Unknown Model
raise Exception(f"Unknown SMBIOS for spoofing: {model}")
def update_firmware_features(firmwarefeature):
# Adjust FirmwareFeature to support everything macOS requires
# APFS Bit (19/20): 10.13+ (OSInstall)
@@ -62,7 +64,8 @@ def update_firmware_features(firmwarefeature):
firmwarefeature |= 2 ** 20 # FW_FEATURE_SUPPORTS_APFS_EXTRA
firmwarefeature |= 2 ** 35 # FW_FEATURE_SUPPORTS_LARGE_BASESYSTEM
return firmwarefeature
def generate_fw_features(model, custom):
if not custom:
firmwarefeature = utilities.get_rom("firmware-features")
@@ -72,4 +75,26 @@ def generate_fw_features(model, custom):
else:
firmwarefeature = int(smbios_data.smbios_dictionary[model]["FirmwareFeatures"], 16)
firmwarefeature = update_firmware_features(firmwarefeature)
return firmwarefeature
return firmwarefeature
def find_model_off_board(board):
# Find model based off Board ID provided
# Return none if unknown
# Strip extra data from Target Types (ap, uppercase)
if not (board.startswith("Mac-") or board.startswith("VMM-")):
if board.lower().endswith("ap"):
board = board[:-2]
board = board.lower()
for key in smbios_data.smbios_dictionary:
if board in [smbios_data.smbios_dictionary[key]["Board ID"], smbios_data.smbios_dictionary[key]["SecureBootModel"]]:
if key.endswith("_v2") or key.endswith("_v3") or key.endswith("_v4"):
# smbios_data has duplicate SMBIOS to handle multiple board IDs
key = key[:-3]
if key == "MacPro4,1":
# 4,1 and 5,1 have the same board ID, best to return the newer ID
key = "MacPro5,1"
return key
return None