diff --git a/OpCore-Simplify.py b/OpCore-Simplify.py index 477e68b..badada1 100644 --- a/OpCore-Simplify.py +++ b/OpCore-Simplify.py @@ -102,13 +102,13 @@ class OCPE: while True: self.u.head("Select macOS Version") print("") - for index, macos_version_name in enumerate(os_data.get_macos_names(min_version, max_version), start=min_version[0]): + for index, macos_version_name in enumerate(os_data.get_macos_names(min_version, max_version), start=int(min_version[:2])): print("{}. {}".format(index, macos_version_name)) print("") print("Please enter the macOS version you want to select:") print("- To select a major version, enter the number (e.g., 19).") print("- To specify a full version, use the Darwin version format (e.g., 22.4.6).") - print("- The version must be in the range from {} to {}.".format(".".join(str(item) for item in min_version), ".".join(str(item) for item in max_version))) + print("- The version must be in the range from {} to {}.".format(min_version, max_version)) print("") print("Q. Quit") print("") @@ -118,9 +118,9 @@ class OCPE: match = version_pattern.match(option) if match: - target_version = (int(match.group(1)), int(match.group(2)) if match.group(2) else 99, int(match.group(3)) if match.group(3) else 99) + target_version = "{}.{}.{}".format(match.group(1), match.group(2) if match.group(2) else 99, match.group(3) if match.group(3) else 99) - if min_version <= target_version <= max_version: + if self.u.parse_darwin_version(min_version) <= self.u.parse_darwin_version(target_version) <= self.u.parse_darwin_version(max_version): self.macos_version = target_version return diff --git a/Scripts/acpi_guru.py b/Scripts/acpi_guru.py index 47851ee..ed38d38 100644 --- a/Scripts/acpi_guru.py +++ b/Scripts/acpi_guru.py @@ -2219,7 +2219,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "RTCAWAC", 0x00000000) }) def fix_system_clock_hedt(self, motherboard_chipset, macos_version): - if macos_version < (20, 0, 0) or not self.utils.contains_any(["X99", "X299"], motherboard_chipset): + if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("20.0.0") or not self.utils.contains_any(["X99", "X299"], motherboard_chipset): return if not self.lpc_bus_device: @@ -2455,7 +2455,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "_PRW", 0x00000000) }) def fix_uncore_bridge(self, motherboard_chipset, macos_version): - if macos_version < (20, 0, 0) or not self.utils.contains_any(["X79", "C602", "Patsburg", "C612", "X99", "Wellsburg"], motherboard_chipset): + if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("20.0.0") or not self.utils.contains_any(["X79", "C602", "Patsburg", "C612", "X99", "Wellsburg"], motherboard_chipset): return unc0_device = self.acpi.get_device_paths("UNC0") diff --git a/Scripts/compatibility_checker.py b/Scripts/compatibility_checker.py index 20972a5..51d6b40 100644 --- a/Scripts/compatibility_checker.py +++ b/Scripts/compatibility_checker.py @@ -51,14 +51,14 @@ class CompatibilityChecker: self.max_supported_macos_version = max((22, 99, 99), self.max_supported_macos_version if is_supported_discrete_gpu else (-1, -1, -1)) elif "Amber Lake" in gpu_codename or "Whiskey Lake" in gpu_codename: self.min_supported_macos_version = max((17, 0, 0), self.min_supported_macos_version if is_supported_discrete_gpu else (-1, -1, -1)) - self.max_supported_macos_version = os_data.get_latest_darwin_version() + self.max_supported_macos_version = self.utils.parse_darwin_version(os_data.get_latest_darwin_version()) elif not is_supported_discrete_gpu and "Comet Lake" in gpu_codename and self.utils.contains_any(chipset_data.IntelChipsets, motherboard_chipset, start=110, end=122): self.max_supported_macos_version = self.min_supported_macos_version = (-1, -1, -1) elif "Ice Lake" in gpu_codename: self.min_supported_macos_version = max((19, 4, 0), self.min_supported_macos_version) - self.max_supported_macos_version = os_data.get_latest_darwin_version() + self.max_supported_macos_version = self.utils.parse_darwin_version(os_data.get_latest_darwin_version()) else: - self.max_supported_macos_version = os_data.get_latest_darwin_version() + self.max_supported_macos_version = self.utils.parse_darwin_version(os_data.get_latest_darwin_version()) else: is_supported_gpu = False if not is_supported_discrete_gpu: @@ -66,7 +66,7 @@ class CompatibilityChecker: elif "AMD" in gpu_manufacturer: is_supported_gpu = gpu_codename in ("Picasso", "Raven Ridge", "Barcelo", "Renoir", "Cezanne", "Lucienne") if is_supported_gpu: - self.max_supported_macos_version = os_data.get_latest_darwin_version() + self.max_supported_macos_version = self.utils.parse_darwin_version(os_data.get_latest_darwin_version()) self.min_supported_macos_version = max((19, 0, 0), self.min_supported_macos_version) elif "Discrete GPU" in device_type: if "AMD" in gpu_manufacturer: @@ -182,8 +182,8 @@ class CompatibilityChecker: del hardware["SD Controller"] def check_compatibility(self, hardware): - self.max_supported_macos_version = os_data.get_latest_darwin_version() - self.min_supported_macos_version = os_data.get_lowest_darwin_version() + self.max_supported_macos_version = self.utils.parse_darwin_version(os_data.get_latest_darwin_version()) + self.min_supported_macos_version = self.utils.parse_darwin_version(os_data.get_lowest_darwin_version()) self.unsupported_devices = {} self.check_cpu_compatibility( @@ -207,8 +207,8 @@ class CompatibilityChecker: hardware["Compatibility"] = { "macOS Version": { - "Max Version": self.max_supported_macos_version, - "Min Version": self.min_supported_macos_version + "Max Version": ".".join(str(item) for item in self.max_supported_macos_version), + "Min Version": ".".join(str(item) for item in self.min_supported_macos_version) } if self.max_supported_macos_version != (-1, -1, -1) else None, "Unsupported Devices": self.unsupported_devices } diff --git a/Scripts/config_prodigy.py b/Scripts/config_prodigy.py index e122fd5..f0d17c5 100644 --- a/Scripts/config_prodigy.py +++ b/Scripts/config_prodigy.py @@ -68,7 +68,7 @@ class ConfigProdigy: def block_kext_bundle(self, network, macos_version): kernel_block = [] - if macos_version > (22, 0, 0): + if self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0"): for network_name, network_props in network.items(): if network_props.get("Device ID") in ["14E4-43A0", "14E4-43A3", "14E4-43BA"]: kernel_block.append({ @@ -100,7 +100,7 @@ class ConfigProdigy: elif "Ice Lake" not in cpu_codename and self.utils.contains_any(cpu_data.IntelCPUGenerations, cpu_codename, start=10): if not "Comet Lake" in cpu_codename: return self.cpuids.get("Comet Lake") - if macos_version < (19, 0, 0): + if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("19.0.0"): return self.cpuids.get("Coffee Lake") return None @@ -162,14 +162,14 @@ class ConfigProdigy: if "AMD" in cpu_manufacturer or self.is_intel_hedt_cpu(cpu_codename): boot_args.append("npci=0x2000") - if macos_version > (22, 0, 0): + if self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0"): boot_args.append("revpatch=sbvmm{}".format(",cpuname" if custom_cpu_name else "")) if self.utils.contains_any(cpu_data.IntelCPUGenerations, cpu_codename, start=13) and int(cpu_cores) > 6: boot_args.append("-ctrsmt") if "Intel" in cpu_manufacturer: - if "UHD" in integrated_gpu_name and macos_version > (18, 0, 0): + if "UHD" in integrated_gpu_name and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("19.0.0"): boot_args.append("igfxonln=1") if "Ice Lake" in cpu_codename: @@ -177,7 +177,7 @@ class ConfigProdigy: if "Laptop" in platform: if self.utils.contains_any(cpu_data.IntelCPUGenerations, cpu_codename, start=6): - boot_args.append("-igfxbl{}".format("t" if macos_version > (22, 0, 0) else "r")) + boot_args.append("-igfxbl{}".format("t" if self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0") else "r")) if "Navi" in discrete_gpu_codename and not "Navi 2" in discrete_gpu_codename: boot_args.append("agdpmod=pikera") @@ -203,9 +203,9 @@ class ConfigProdigy: return " ".join(boot_args) def csr_active_config(self, macos_version): - if macos_version > (19, 0, 0): + if self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("20.0.0"): return "03080000" - elif macos_version > (17, 0, 0): + elif self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("18.0.0"): return "FF070000" else: return "FF030000" @@ -295,7 +295,7 @@ class ConfigProdigy: config["Misc"]["Entries"] = [] config["Misc"]["Security"]["AllowSetDefault"] = True config["Misc"]["Security"]["ScanPolicy"] = 0 - config["Misc"]["Security"]["SecureBootModel"] = "Default" if (19, 0, 0) < efi_option.get("macOS Version") < (23, 0, 0) else "Disabled" + config["Misc"]["Security"]["SecureBootModel"] = "Default" if self.utils.parse_darwin_version("20.0.0") <= self.utils.parse_darwin_version(efi_option.get("macOS Version")) < self.utils.parse_darwin_version("23.0.0") else "Disabled" config["Misc"]["Security"]["Vault"] = "Optional" config["Misc"]["Tools"] = [] diff --git a/Scripts/datasets/kext_data.py b/Scripts/datasets/kext_data.py index 1dfad55..0eb3661 100644 --- a/Scripts/datasets/kext_data.py +++ b/Scripts/datasets/kext_data.py @@ -63,7 +63,7 @@ kexts = [ name = "SMCRadeonSensors", description = "Provides temperature readings for AMD GPUs", category = "VirtualSMC Plugins", - min_darwin_version = (18, 0, 0), + min_darwin_version = "18.0.0", requires_kexts = ["VirtualSMC"], github_repo = { "owner": "ChefKissInc", @@ -80,7 +80,7 @@ kexts = [ name = "NootRX", description = "The rDNA 2 dGPU support patch kext", category = "Graphics", - min_darwin_version = (20, 5, 0), + min_darwin_version = "20.5.0", conflict_group_id = "GPU", github_repo = { "owner": "ChefKissInc", @@ -91,7 +91,7 @@ kexts = [ name = "NootedRed", description = "The AMD Vega iGPU support kext", category = "Graphics", - min_darwin_version = (19, 0, 0), + min_darwin_version = "19.0.0", conflict_group_id = "GPU", github_repo = { "owner": "ChefKissInc", @@ -134,7 +134,7 @@ kexts = [ name = "AirportItlwm", description = "Intel Wi-Fi drivers support the native macOS Wi-Fi interface", category = "Wi-Fi", - max_darwin_version = (23, 99, 99), + max_darwin_version = "23.99.99", conflict_group_id = "IntelWiFi", github_repo = { "owner": "OpenIntelWireless", @@ -145,7 +145,7 @@ kexts = [ name = "IO80211FamilyLegacy", description = "Enable legacy native Apple Wireless adapters", category = "Wi-Fi", - min_darwin_version = (23, 0, 0), + min_darwin_version = "23.0.0", requires_kexts = ["IOSkywalkFamily"], download_info = { "id": 817294638, @@ -156,7 +156,7 @@ kexts = [ name = "IOSkywalkFamily", description = "Enable legacy native Apple Wireless adapters", category = "Wi-Fi", - min_darwin_version = (23, 0, 0), + min_darwin_version = "23.0.0", requires_kexts = ["IO80211FamilyLegacy"], download_info = { "id": 926584761, @@ -177,7 +177,7 @@ kexts = [ name = "BlueToolFixup", description = "Patches Bluetooth stack to support third-party cards", category = "Bluetooth", - min_darwin_version = (21, 0, 0), + min_darwin_version = "21.0.0", github_repo = { "owner": "acidanthera", "repo": "BrcmPatchRAM" @@ -187,7 +187,7 @@ kexts = [ name = "BrcmBluetoothInjector", description = "Enables the Broadcom Bluetooth on/off switch on older versions", category = "Bluetooth", - max_darwin_version = (20, 99, 99), + max_darwin_version = "20.99.99", requires_kexts = ["BrcmBluetoothInjector", "BrcmFirmwareData", "BrcmPatchRAM2", "BrcmPatchRAM3"], github_repo = { "owner": "acidanthera", @@ -208,7 +208,7 @@ kexts = [ name = "BrcmPatchRAM2", description = "Applies PatchRAM updates for Broadcom RAMUSB based devices", category = "Bluetooth", - max_darwin_version = (18, 99, 99), + max_darwin_version = "18.99.99", requires_kexts = ["BlueToolFixup", "BrcmBluetoothInjector", "BrcmFirmwareData", "BrcmPatchRAM3"], github_repo = { "owner": "acidanthera", @@ -219,7 +219,7 @@ kexts = [ name = "BrcmPatchRAM3", description = "Applies PatchRAM updates for Broadcom RAMUSB based devices", category = "Bluetooth", - min_darwin_version = (19, 0, 0), + min_darwin_version = "19.0.0", requires_kexts = ["BlueToolFixup", "BrcmBluetoothInjector", "BrcmFirmwareData", "BrcmPatchRAM2"], github_repo = { "owner": "acidanthera", @@ -246,7 +246,7 @@ kexts = [ name = "IntelBluetoothInjector", description = "Enables the Intel Bluetooth on/off switch on older versions", category = "Bluetooth", - max_darwin_version = (20, 99, 99), + max_darwin_version = "20.99.99", requires_kexts = ["BlueToolFixup", "IntelBluetoothFirmware", "IntelBTPatcher"] ), KextInfo( @@ -387,7 +387,7 @@ kexts = [ name = "VoodooSMBus", description = "i2c-i801 + ELAN SMBus Touchpad kext", category = "Input", - min_darwin_version = (18, 0, 0), + min_darwin_version = "18.0.0", github_repo = { "owner": "VoodooSMBus", "repo": "VoodooSMBus" @@ -463,8 +463,8 @@ kexts = [ name = "NVMeFix", description = "Addresses compatibility and performance issues with NVMe SSDs", category = "Storage", - max_darwin_version = (23, 99, 99), - min_darwin_version = (18, 0, 0), + max_darwin_version = "23.99.99", + min_darwin_version = "18.0.0", github_repo = { "owner": "acidanthera", "repo": "NVMeFix" @@ -474,7 +474,7 @@ kexts = [ name = "RealtekCardReader", description = "Realtek PCIe/USB-based SD card reader driver", category = "SD Controller", - min_darwin_version = (18, 0, 0), + min_darwin_version = "18.0.0", requires_kexts = ["RealtekCardReaderFriend"], github_repo = { "owner": "0xFireWolf", @@ -485,8 +485,8 @@ kexts = [ name = "RealtekCardReaderFriend", description = "Makes System Information recognize your Realtek card reader", category = "SD Controller", - min_darwin_version = (18, 0, 0), - max_darwin_version = (22, 99, 99), + min_darwin_version = "18.0.0", + max_darwin_version = "22.99.99", requires_kexts = ["RealtekCardReader"], github_repo = { "owner": "0xFireWolf", @@ -497,7 +497,7 @@ kexts = [ name = "AMFIPass", description = "A replacement for amfi=0x80 boot argument", category = "Extras", - min_darwin_version = (20, 0, 0), + min_darwin_version = "20.0.0", download_info = { "id": 926491527, "url": "https://github.com/dortania/OpenCore-Legacy-Patcher/raw/main/payloads/Kexts/Acidanthera/AMFIPass-v1.4.1-RELEASE.zip" @@ -534,7 +534,7 @@ kexts = [ name = "CryptexFixup", description = "Various patches to install Rosetta cryptex", category = "Extras", - min_darwin_version = (22, 0, 0), + min_darwin_version = "22.0.0", github_repo = { "owner": "acidanthera", "repo": "CryptexFixup" diff --git a/Scripts/datasets/os_data.py b/Scripts/datasets/os_data.py index 574e113..4ecfcd7 100644 --- a/Scripts/datasets/os_data.py +++ b/Scripts/datasets/os_data.py @@ -1,5 +1,3 @@ -from Scripts import utils - class macOSVersionInfo: def __init__(self, name, macos_version, release_status = "final"): self.name = name @@ -18,23 +16,21 @@ macos_versions = [ macOSVersionInfo("Sequoia", "15", "beta") ] -u = utils.Utils() - def get_latest_darwin_version(): - return macos_versions[-1].darwin_version, 99, 99 + return "{}.{}.{}".format(macos_versions[-1].darwin_version, 99, 99) def get_lowest_darwin_version(): - return macos_versions[0].darwin_version, 0, 0 + return "{}.{}.{}".format(macos_versions[0].darwin_version, 0, 0) def get_macos_names(min_darwin, max_darwin): return [ "macOS {} {}{}".format(data.name, data.macos_version, "" if data.release_status == "final" else " (Beta)") for data in macos_versions - if min_darwin[0] <= data.darwin_version <= max_darwin[0] + if int(min_darwin[:2]) <= data.darwin_version <= int(max_darwin[:2]) ] def get_macos_name_by_darwin(darwin_version): for data in macos_versions: - if data.darwin_version == darwin_version[0]: + if data.darwin_version == int(darwin_version[:2]): return "macOS {} {}{}".format(data.name, data.macos_version, "" if data.release_status == "final" else " (Beta)") return None diff --git a/Scripts/efi_builder.py b/Scripts/efi_builder.py index 05448fc..11ec15f 100644 --- a/Scripts/efi_builder.py +++ b/Scripts/efi_builder.py @@ -177,17 +177,17 @@ class builder: return any(cpu_branding in processor_name for cpu_branding in ["Celeron", "Pentium"]) def check_igpu_compatibility(self, cpu_codename, macos_version): - return not (("Sandy Bridge" in cpu_codename and macos_version > (17, 0, 0)) or \ - ("Ivy Bridge" in cpu_codename and macos_version > (20, 0, 0)) or \ - (("Haswell" in cpu_codename or "Broadwell" in cpu_codename) and macos_version > (21, 0, 0)) or \ - (("Skylake" in cpu_codename or "Kaby Lake" in cpu_codename) and macos_version > (22, 0, 0)) or \ - (("Amber Lake" in cpu_codename or "Whiskey Lake" in cpu_codename) and macos_version == (17, 0, 0)) or \ - ("Ice Lake" in cpu_codename and (19, 4, 0) > macos_version)) + return not (("Sandy Bridge" in cpu_codename and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("18.0.0")) or \ + ("Ivy Bridge" in cpu_codename and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("21.0.0")) or \ + (("Haswell" in cpu_codename or "Broadwell" in cpu_codename) and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("22.0.0")) or \ + (("Skylake" in cpu_codename or "Kaby Lake" in cpu_codename) and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0")) or \ + (("Amber Lake" in cpu_codename or "Whiskey Lake" in cpu_codename) and self.utils.parse_darwin_version(macos_version) == self.utils.parse_darwin_version("17.0.0")) or \ + ("Ice Lake" in cpu_codename and self.utils.parse_darwin_version("19.4.0") >= self.utils.parse_darwin_version(macos_version))) def igpu_properties(self, platform, processor_name, gpu_codename, discrete_gpu, integrated_gpu_manufacturer, integrated_gpu_name, macos_version): - if "Skylake".lower() in gpu_codename.lower() and macos_version > (21, 0, 0): + if "Skylake".lower() in gpu_codename.lower() and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("22.0.0"): gpu_codename = "Kaby Lake" - if "Kaby Lake-R".upper() in gpu_codename.upper() and macos_version > (22, 0, 0): + if "Kaby Lake-R".upper() in gpu_codename.upper() and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0"): gpu_codename = "Coffee Lake" gpu_codename = self.utils.contains_any(cpu_data.IntelCPUGenerations, gpu_codename) @@ -258,18 +258,18 @@ class builder: return igpu_properties def system_product_info(self, platform, cpu_manufacturer, processor_name, cpu_codename, cpu_cores, discrete_gpu, igpu_props, macos_version): - product_name = "iMacPro1,1" if macos_version < (19, 0, 0) or self.utils.contains_any(cpu_data.IntelCPUGenerations, cpu_codename, start=12) else "MacPro7,1" + product_name = "iMacPro1,1" if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("20.0.0") or self.utils.contains_any(cpu_data.IntelCPUGenerations, cpu_codename, start=12) else "MacPro7,1" if "AMD" in cpu_manufacturer and not discrete_gpu: product_name = "MacBookPro16,3" if "Laptop" in platform else "iMacPro1,1" if igpu_props: - if "Kaby Lake-R".lower() in cpu_codename.lower() and macos_version > (22, 0, 0): + if "Kaby Lake-R".lower() in cpu_codename.lower() and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0"): cpu_codename = "Coffee Lake" if "Sandy Bridge" in cpu_codename: if "Desktop" in platform: - if macos_version < (18, 0, 0): + if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("18.0.0"): product_name = "iMac12,2" else: product_name = "MacPro6,1" @@ -278,14 +278,14 @@ class builder: else: product_name = "MacBookPro8,1" if int(cpu_cores) < 4 else "MacBookPro8,2" elif "Ivy Bridge" in cpu_codename: - if macos_version == (20, 0, 0): + if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("21.0.0"): if "Desktop" in platform: product_name = "iMac14,4" if not discrete_gpu else "iMac15,1" elif "NUC" in platform: product_name = "Macmini7,1" else: product_name = "MacBookPro11,1" if int(cpu_cores) < 4 else "MacBookPro11,5" - elif macos_version < (20, 0, 0): + elif self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("20.0.0"): if "Desktop" in platform: product_name = "iMac13,1" if not discrete_gpu else "iMac13,2" elif "NUC" in platform: @@ -297,12 +297,12 @@ class builder: elif "Haswell" in cpu_codename: if "Desktop" in platform: product_name = "iMac14,4" if not discrete_gpu else "iMac15,1" - if macos_version == (21, 0, 0): + if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("22.0.0"): product_name = "iMac16,2" if not discrete_gpu else "iMac17,1" elif "NUC" in platform: product_name = "Macmini7,1" else: - product_name = "MacBookPro11,1" if macos_version < (21, 0, 0) and int(cpu_cores) < 4 else "MacBookPro11,5" + product_name = "MacBookPro11,1" if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("21.0.0") and int(cpu_cores) < 4 else "MacBookPro11,5" elif "Broadwell" in cpu_codename: if "Desktop" in platform: product_name = "iMac16,2" if not discrete_gpu else "iMac17,1" @@ -317,7 +317,7 @@ class builder: elif self.utils.contains_any(cpu_data.IntelCPUGenerations, cpu_codename, start=8, end=11): product_name = "Macmini8,1" if "Desktop" in platform: - product_name = "iMac18,3" if macos_version == (17, 0, 0) else "iMac19,1" + product_name = "iMac18,3" if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("18.0.0") else "iMac19,1" if "Comet Lake" in cpu_codename: product_name = "iMac20,1" if int(cpu_cores) < 10 else "iMac20,2" elif "Laptop" in platform: diff --git a/Scripts/kext_maestro.py b/Scripts/kext_maestro.py index 83ad219..40a13d5 100644 --- a/Scripts/kext_maestro.py +++ b/Scripts/kext_maestro.py @@ -587,16 +587,16 @@ class KextMaestro: "USBMap" ] - if macos_version > (22, 0, 0) or custom_cpu_name or "MacPro7,1" in smbios: + if self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0") or custom_cpu_name or "MacPro7,1" in smbios: kexts.append("RestrictEvents") if codec_id in codec_layouts.data: kexts.append("AppleALC") - if "AMD" in cpu_manufacturer and macos_version > (21, 0, 0) or int(cpu_configuration) > 1 and macos_version > (18, 0, 0): + if "AMD" in cpu_manufacturer and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("21.4.0") or int(cpu_configuration) > 1 and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("19.0.0"): kexts.append("AppleMCEReporterDisabler") - if macos_version > (21, 0, 0) and not "AVX2" in simd_features: + if self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("22.0.0") and not "AVX2" in simd_features: kexts.append("CryptexFixup") if self.utils.contains_any(cpu_data.IntelCPUGenerations, cpu_codename, start=13) and int(cpu_cores) > 6: @@ -620,12 +620,12 @@ class KextMaestro: if self.utils.contains_any(pci_data.NetworkIDs, device_id, end=21): wifi_pci = device_id if device_id in ["14E4-43A0", "14E4-43A3", "14E4-43BA"]: - if macos_version > (22, 0, 0): + if self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0"): kexts.extend(["AirportBrcmFixup", "IOSkywalkFamily", "IO80211FamilyLegacy", "AMFIPass"]) elif device_id in pci_data.NetworkIDs: kexts.append("AirportBrcmFixup") elif self.utils.contains_any(pci_data.NetworkIDs, device_id, start=21, end=108): - kexts.append("AirportItlwm" if macos_version < (23, 0, 0) else "itlwm") + kexts.append("AirportItlwm" if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("23.0.0") else "itlwm") elif self.utils.contains_any(pci_data.NetworkIDs, device_id, start=108, end=115): kexts.append("AppleIGC") elif self.utils.contains_any(pci_data.NetworkIDs, device_id, start=115, end=122): @@ -641,7 +641,7 @@ class KextMaestro: elif self.utils.contains_any(pci_data.NetworkIDs, device_id, start=181, end=219): kexts.append("AppleIGB") - if bluetooth and macos_version > (20, 0, 0) and not wifi_pci in ["14E4-43A0", "14E4-43A3", "14E4-43BA"]: + if bluetooth and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("21.0.0") and not wifi_pci in ["14E4-43A0", "14E4-43A3", "14E4-43BA"]: kexts.append("BlueToolFixup") for usb_id in bluetooth: if usb_id in pci_data.BluetoothIDs: @@ -649,7 +649,7 @@ class KextMaestro: if idx < 99: kexts.append("BrcmPatchRAM") - if bluetooth and macos_version > (20, 0, 0): + if bluetooth and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("21.0.0"): kexts.append("BlueToolFixup") else: kexts.append("IntelBluetoothFirmware") @@ -712,7 +712,7 @@ class KextMaestro: def install_kexts_to_efi(self, kexts, macos_version, kexts_directory): for kext_name in kexts: if "AirportItlwm" in kext_name: - kext_name = "{}{}".format(kext_name, macos_version[0]) + kext_name = "{}{}".format(kext_name, macos_version[:2]) elif "BlueToolFixup" in kext_name or "BrcmPatchRAM" in kext_name: kext_name = "BrcmPatchRAM" @@ -761,7 +761,7 @@ class KextMaestro: continue max_kernel = self.utils.parse_darwin_version(kext.get("MaxKernel") or os_data.get_latest_darwin_version()) min_kernel = self.utils.parse_darwin_version(kext.get("MinKernel") or os_data.get_lowest_darwin_version()) - if not min_kernel <= macos_version <= max_kernel: + if not min_kernel <= self.utils.parse_darwin_version(macos_version) <= max_kernel: continue kernel_add.append({ diff --git a/Scripts/utils.py b/Scripts/utils.py index 8fb33ca..d4c1cc4 100644 --- a/Scripts/utils.py +++ b/Scripts/utils.py @@ -163,11 +163,8 @@ class Utils: # Convert the path to an absolute path and normalize it according to the OS return str(pathlib.Path(path).resolve()) - def parse_darwin_version(self, version): - if not isinstance(version, str): - return version - - major, minor, patch = map(int, version.split('.')) + def parse_darwin_version(self, darwin_version): + major, minor, patch = map(int, darwin_version.split('.')) return major, minor, patch def open_folder(self, folder_path):