From 0e49f9fe318d82102dcde21852f08f2b5e1748aa Mon Sep 17 00:00:00 2001 From: Hoang Hong Quan Date: Tue, 8 Oct 2024 02:28:02 +0700 Subject: [PATCH] Update report with Hardware Sniffer, replacing old AIDA64 report --- OpCore-Simplify.py | 7 +-- Scripts/acpi_guru.py | 40 ++++++++--------- Scripts/compatibility_checker.py | 73 ++++++++++++++++-------------- Scripts/config_prodigy.py | 76 ++++++++++++++++---------------- Scripts/efi_builder.py | 3 -- Scripts/kext_maestro.py | 32 +++++++------- Scripts/smbios.py | 54 +++++++++++------------ 7 files changed, 146 insertions(+), 139 deletions(-) diff --git a/OpCore-Simplify.py b/OpCore-Simplify.py index 54ea7a4..dc59985 100644 --- a/OpCore-Simplify.py +++ b/OpCore-Simplify.py @@ -47,8 +47,9 @@ class OCPE: user_input = self.u.request_input("Please drag and drop your hardware report here: (.JSON) ") if user_input.lower() == "q": self.u.exit_program() - path, data = self.u.normalize_path(user_input), self.u.read_file(path) - if not path or os.path.splitext(path).lower() == ".json" or not isinstance(data, dict): + path = self.u.normalize_path(user_input) + data = self.u.read_file(path) + if not path or os.path.splitext(path)[1].lower() != ".json" or not isinstance(data, dict): continue return path, data @@ -82,7 +83,7 @@ class OCPE: def results(self, hardware_report, smbios_model): self.u.head("Results") print("") - print("Your OpenCore EFI for {} has been built at:".format(hardware_report.get("Motherboard").get("Motherboard Name"))) + print("Your OpenCore EFI for {} has been built at:".format(hardware_report.get("Motherboard").get("Name"))) print("\t{}".format(self.result_dir)) print("") print("Before using EFI, please complete the following steps:") diff --git a/Scripts/acpi_guru.py b/Scripts/acpi_guru.py index 021ffcb..2746993 100644 --- a/Scripts/acpi_guru.py +++ b/Scripts/acpi_guru.py @@ -1571,7 +1571,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "MCHC", 0) def add_system_management_bus_device(self): try: - smbus_device_name = self.acpi.get_device_paths_with_hid("0x001F0003" if self.utils.contains_any(cpu_data.IntelCPUGenerations, self.hardware_report.get("CPU").get("CPU Codename"), start=26) else "0x001F0004", self.dsdt)[0][0].split(".")[-1] + smbus_device_name = self.acpi.get_device_paths_with_hid("0x001F0003" if self.utils.contains_any(cpu_data.IntelCPUGenerations, self.hardware_report.get("CPU").get("Codename"), start=26) else "0x001F0004", self.dsdt)[0][0].split(".")[-1] except: smbus_device_name = "SBUS" @@ -1846,11 +1846,11 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "DNVMe", 0x00000000) patches = [] uid_value = 19 - if self.utils.contains_any(cpu_data.IntelCPUGenerations, self.hardware_report.get("CPU").get("CPU Codename"), start=38): + if self.utils.contains_any(cpu_data.IntelCPUGenerations, self.hardware_report.get("CPU").get("Codename"), start=38): uid_value = 14 - elif self.utils.contains_any(cpu_data.IntelCPUGenerations, self.hardware_report.get("CPU").get("CPU Codename"), start=26): + elif self.utils.contains_any(cpu_data.IntelCPUGenerations, self.hardware_report.get("CPU").get("Codename"), start=26): uid_value = 15 - elif self.utils.contains_any(cpu_data.IntelCPUGenerations, self.hardware_report.get("CPU").get("CPU Codename"), start=16): + elif self.utils.contains_any(cpu_data.IntelCPUGenerations, self.hardware_report.get("CPU").get("Codename"), start=16): uid_value = 16 igpu = "" @@ -2823,14 +2823,14 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "SURFACE", 0x00001000) if "Laptop" in hardware_report.get("Motherboard").get("Platform") and \ "Integrated GPU" in list(hardware_report.get("GPU").items())[0][-1].get("Device Type") and \ - not "SURFACE" in hardware_report.get("Motherboard").get("Motherboard Name"): + not "SURFACE" in hardware_report.get("Motherboard").get("Name"): selected_patches.append("ALS") selected_patches.append("PNLF") - if self.is_intel_hedt_cpu(hardware_report.get("CPU").get("CPU Codename")): + if self.is_intel_hedt_cpu(hardware_report.get("CPU").get("Codename")): selected_patches.append("APIC") - if "Intel" in hardware_report.get("CPU").get("CPU Manufacturer"): + if "Intel" in hardware_report.get("CPU").get("Manufacturer"): selected_patches.append("BUS0") for device_name, device_info in unsupported_devices.items(): @@ -2839,25 +2839,25 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "SURFACE", 0x00001000) selected_patches.append("FakeEC") - if "HP" in hardware_report.get("Motherboard").get("Motherboard Name"): + if "HP" in hardware_report.get("Motherboard").get("Name"): selected_patches.append("CMOS") - if "Laptop" in hardware_report.get("Motherboard").get("Platform") and self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("CPU Codename"), start=26) or \ - self.is_intel_hedt_cpu(hardware_report.get("CPU").get("CPU Codename")): + if "Laptop" in hardware_report.get("Motherboard").get("Platform") and self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), start=26) or \ + self.is_intel_hedt_cpu(hardware_report.get("CPU").get("Codename")): selected_patches.append("FixHPET") if hardware_report.get("Intel MEI"): - if "Sandy Bridge" in hardware_report.get("CPU").get("CPU Codename") and hardware_report.get("Intel MEI").get("Device ID") in "8086-1E3A" or \ - "Ivy Bridge" in hardware_report.get("CPU").get("CPU Codename") and hardware_report.get("Intel MEI").get("Device ID") in "8086-1C3A": + if "Sandy Bridge" in hardware_report.get("CPU").get("Codename") and hardware_report.get("Intel MEI").get("Device ID") in "8086-1E3A" or \ + "Ivy Bridge" in hardware_report.get("CPU").get("Codename") and hardware_report.get("Intel MEI").get("Device ID") in "8086-1C3A": selected_patches.append("IMEI") - if "Intel" in hardware_report.get("CPU").get("CPU Manufacturer") or not "MacPro" in smbios_model: + if "Intel" in hardware_report.get("CPU").get("Manufacturer") or not "MacPro" in smbios_model: selected_patches.append("MCHC") - if self.utils.contains_any(chipset_data.IntelChipsets, hardware_report.get("Motherboard").get("Motherboard Chipset"), start=89, end=101): + if self.utils.contains_any(chipset_data.IntelChipsets, hardware_report.get("Motherboard").get("Chipset"), start=89, end=101): selected_patches.append("PMC") - if "Sandy Bridge" in hardware_report.get("CPU").get("CPU Codename") or "Ivy Bridge" in hardware_report.get("CPU").get("CPU Codename"): + if "Sandy Bridge" in hardware_report.get("CPU").get("Codename") or "Ivy Bridge" in hardware_report.get("CPU").get("Codename"): selected_patches.append("PM (Legacy)") else: selected_patches.append("PLUG") @@ -2873,24 +2873,24 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "SURFACE", 0x00001000) if not ethernet_pci: selected_patches.append("RMNE") - if hardware_report.get("Motherboard").get("Motherboard Chipset") in ("C610/X99", "Wellsburg", "X299"): + if hardware_report.get("Motherboard").get("Chipset") in ("C610/X99", "Wellsburg", "X299"): selected_patches.append("RTC0") - if self.utils.contains_any(chipset_data.IntelChipsets, hardware_report.get("Motherboard").get("Motherboard Chipset"), start=89): + if self.utils.contains_any(chipset_data.IntelChipsets, hardware_report.get("Motherboard").get("Chipset"), start=89): selected_patches.append("RTCAWAC") selected_patches.append("PRW") - if "SURFACE" in hardware_report.get("Motherboard").get("Motherboard Name"): + if "SURFACE" in hardware_report.get("Motherboard").get("Name"): selected_patches.append("Surface Patch") else: - if "Intel" in hardware_report.get("CPU").get("CPU Manufacturer"): + if "Intel" in hardware_report.get("CPU").get("Manufacturer"): for input in hardware_report.get("Input").keys(): if "I2C" in input: selected_patches.append("GPI0") break - if hardware_report.get("Motherboard").get("Motherboard Chipset") in ("C600/X79", "C610/X99", "Wellsburg"): + if hardware_report.get("Motherboard").get("Chipset") in ("C600/X79", "C610/X99", "Wellsburg"): selected_patches.append("UNC") selected_patches.append("USB Reset") diff --git a/Scripts/compatibility_checker.py b/Scripts/compatibility_checker.py index fa40522..c9ee4ea 100644 --- a/Scripts/compatibility_checker.py +++ b/Scripts/compatibility_checker.py @@ -13,24 +13,24 @@ class CompatibilityChecker: def is_low_end_intel_cpu(self, processor_name): return any(brand in processor_name for brand in ["Celeron", "Pentium"]) - def check_cpu_compatibility(self, processor_name, instruction_set): - if "x86-64" not in instruction_set or "SSE4" not in instruction_set: + def check_cpu_compatibility(self, processor_name, simd_features): + if "SSE4" not in simd_features: self.max_supported_macos_version = self.min_supported_macos_version = (-1, -1, -1) self.unsupported_devices.append("CPU: {}".format(processor_name)) return - if "SSE4.2" not in instruction_set: + if "SSE4.2" not in simd_features: self.min_supported_macos_version = (18, 0, 0) - if "SSE4.1" in instruction_set: + if "SSE4.1" in simd_features: self.max_supported_macos_version = (21, 99, 99) - def check_gpu_compatibility(self, motherboard_chipset, processor_name, instruction_set, gpu_info): + def check_gpu_compatibility(self, motherboard_chipset, processor_name, simd_features, gpu_info): supported_gpus = {} is_supported_discrete_gpu = False for gpu_name, gpu_props in gpu_info.items(): gpu_manufacturer = gpu_props.get("Manufacturer") - gpu_codename = gpu_props.get("GPU Codename") + gpu_codename = gpu_props.get("Codename") device_id = gpu_props.get("Device ID") device_type = gpu_props.get("Device Type") is_supported_gpu = True @@ -73,7 +73,7 @@ class CompatibilityChecker: is_supported_discrete_gpu = True if "Navi 2" in gpu_codename: - if not "AVX2" in instruction_set: + if not "AVX2" in simd_features: self.max_supported_macos_version = min((21, 99, 99), self.max_supported_macos_version) else: if gpu_codename in ("Navi 23", "Navi 22"): @@ -117,7 +117,7 @@ class CompatibilityChecker: supported_audio = {} for audio_device, audio_props in audio_info.items(): - codec_id = audio_props.get("Codec ID") + codec_id = audio_props.get("Device ID") if "USB" in audio_props.get("Bus Type") or \ codec_id.startswith("8086") or \ codec_id.startswith("1002") or \ @@ -131,13 +131,13 @@ class CompatibilityChecker: return supported_audio - def check_biometric_compatibility(self, hardware): - biometric = hardware.get("Biometric", {}) + def check_biometric_compatibility(self, hardware_report): + biometric = hardware_report.get("Biometric", {}) if biometric: for biometric_device, biometric_props in biometric.items(): self.unsupported_devices["Biometric: {}".format(biometric_device)] = biometric_props - del hardware["Biometric"] + del hardware_report["Biometric"] def check_network_compatibility(self, network_info): supported_network = {} @@ -148,7 +148,7 @@ class CompatibilityChecker: is_device_supported = device_id in pci_data.NetworkIDs if bus_type.startswith("PCI"): - if device_id in ["8086-125B", "8086-125C", "8086-125D", "8086-3102"]: + if device_id in ("8086-125B", "8086-125C", "8086-125D", "8086-3102"): self.min_supported_macos_version = (19, 0, 0) if not is_device_supported: @@ -173,15 +173,24 @@ class CompatibilityChecker: return supported_storage - def check_sd_controller_compatibility(self, hardware): - sd_controller_props = hardware.get("SD Controller", {}) + def check_sd_controller_compatibility(self, hardware_report): + if not hardware_report.get("SD Controller"): + return + + supported_sd_controller = {} - if sd_controller_props: - if sd_controller_props.get("Device ID") not in pci_data.RealtekCardReaderIDs: - self.unsupported_devices["SD Controller: {}".format(sd_controller_props.get("Device Description"))] = sd_controller_props - del hardware["SD Controller"] + for controller_name, controller_props in hardware_report.get("SD Controller", {}).items(): + if controller_props.get("Device ID") not in pci_data.RealtekCardReaderIDs: + self.unsupported_devices["SD Controller: {}".format(controller_name)] = controller_props + else: + supported_sd_controller[controller_name] = controller_props - def check_compatibility(self, hardware): + if supported_sd_controller: + hardware_report["SD Controller"] = supported_sd_controller + else: + del hardware_report["SD Controller"] + + def check_compatibility(self, hardware_report): self.utils.head("Compatibility Checker") print("") @@ -190,23 +199,23 @@ class CompatibilityChecker: self.unsupported_devices = {} self.check_cpu_compatibility( - hardware.get("CPU").get("Processor Name"), - hardware.get("CPU").get("Instruction Set") + hardware_report.get("CPU").get("Processor Name"), + hardware_report.get("CPU").get("SIMD Features") ) if self.max_supported_macos_version != (-1, -1, -1): - hardware["GPU"] = self.check_gpu_compatibility( - hardware.get("Motherboard").get("Motherboard Chipset"), - hardware.get("CPU").get("Processor Name"), - hardware.get("CPU").get("Instruction Set"), - hardware.get("GPU") + hardware_report["GPU"] = self.check_gpu_compatibility( + hardware_report.get("Motherboard").get("Chipset"), + hardware_report.get("CPU").get("Processor Name"), + hardware_report.get("CPU").get("SIMD Features"), + hardware_report.get("GPU") ) - if hardware.get("GPU"): - hardware["Audio"] = self.check_audio_compatibility(hardware.get("Audio")) - self.check_biometric_compatibility(hardware) - hardware["Network"] = self.check_network_compatibility(hardware.get("Network")) - hardware["Storage Controllers"] = self.check_storage_compatibility(hardware.get("Storage Controllers")) - self.check_sd_controller_compatibility(hardware) + if hardware_report.get("GPU"): + hardware_report["Sound"] = self.check_audio_compatibility(hardware_report.get("Sound")) + self.check_biometric_compatibility(hardware_report) + hardware_report["Network"] = self.check_network_compatibility(hardware_report.get("Network")) + hardware_report["Storage Controllers"] = self.check_storage_compatibility(hardware_report.get("Storage Controllers")) + self.check_sd_controller_compatibility(hardware_report) if self.max_supported_macos_version[0] == -1: self.u.request_input("Your hardware is not compatible with macOS!") diff --git a/Scripts/config_prodigy.py b/Scripts/config_prodigy.py index 0fe78bc..77dbe2f 100644 --- a/Scripts/config_prodigy.py +++ b/Scripts/config_prodigy.py @@ -65,9 +65,9 @@ class ConfigProdigy: not self.utils.contains_any(chipset_data.IntelChipsets, motherboard_chipset, start=101) is None or \ not self.utils.contains_any(chipset_data.IntelChipsets, motherboard_chipset, start=79, end=89) is None - def check_resizable_bar_support(self, motherboard_chipset, cpu_codename): + def check_resizable_bar_support(self, motherboard_chipset): return not self.utils.contains_any(chipset_data.AMDChipsets, motherboard_chipset, start=11) is None or \ - not "Ice Lake" in motherboard_chipset and not self.utils.contains_any(chipset_data, motherboard_chipset, start=101) is None + not "Ice Lake" in motherboard_chipset and not self.utils.contains_any(chipset_data.IntelChipsets, motherboard_chipset, start=101) is None def is_low_end_intel_cpu(self, processor_name): return any(cpu_branding in processor_name for cpu_branding in ["Celeron", "Pentium"]) @@ -186,35 +186,35 @@ class ConfigProdigy: "keepsyms=1" ] - codec_id = list(hardware_report.get("Audio").items())[0][-1].get("Codec ID") + codec_id = list(hardware_report.get("Sound").items())[0][-1].get("Device ID") if codec_id in codec_layouts.data: boot_args.append("alcid={}".format(random.choice(codec_layouts.data.get(codec_id)))) - if "AMD" in hardware_report.get("CPU").get("CPU Manufacturer") or self.is_intel_hedt_cpu(hardware_report.get("CPU").get("CPU Codename")): + if "AMD" in hardware_report.get("CPU").get("Manufacturer") or self.is_intel_hedt_cpu(hardware_report.get("CPU").get("Codename")): boot_args.append("npci=0x2000") if self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0"): boot_args.append("revpatch=sbvmm{}".format(",cpuname" if not (" Core" in hardware_report.get("CPU").get("Processor Name") and \ - self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("CPU Codename"), end=3)) else "")) + self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), end=3)) else "")) - if self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("CPU Codename"), end=2) and int(hardware_report.get("CPU").get("CPU Cores")) > 6: + if self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), end=2) and int(hardware_report.get("CPU").get("Core Count")) > 6: boot_args.append("-ctrsmt") - if "Intel" in hardware_report.get("CPU").get("CPU Manufacturer"): + if "Intel" in hardware_report.get("CPU").get("Manufacturer"): if "UHD" in list(hardware_report.get("GPU").keys())[0] 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 list(hardware_report.get("GPU").items())[0][-1].get("GPU Codename"): + if "Ice Lake" in list(hardware_report.get("GPU").items())[0][-1].get("Codename"): boot_args.extend(["-noDC9", "-igfxcdc", "-igfxdvmt", "-igfxdbeo"]) if "Laptop" in hardware_report.get("Motherboard").get("Platform"): - if self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("CPU Codename"), end=21): + if self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), end=21): 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 1" in list(hardware_report.get("GPU").items())[-1][-1].get("GPU Codename"): + if "Navi 1" in list(hardware_report.get("GPU").items())[-1][-1].get("Codename"): boot_args.append("agdpmod=pikera") - if not "SURFACE" in hardware_report.get("Motherboard").get("Motherboard Name"): + if not "SURFACE" in hardware_report.get("Motherboard").get("Name"): for input in hardware_report.get("Input").keys(): if "I2C" in input: boot_args.append("-vi2c-force-polling") @@ -269,54 +269,54 @@ class ConfigProdigy: config["ACPI"]["Delete"] = [] config["ACPI"]["Patch"] = [] - config["Booter"]["MmioWhitelist"] = self.mmio_whitelist(hardware_report.get("Motherboard").get("Motherboard Chipset")) + config["Booter"]["MmioWhitelist"] = self.mmio_whitelist(hardware_report.get("Motherboard").get("Chipset")) config["Booter"]["Patch"] = self.add_booter_patch(smbios_model, macos_version) - config["Booter"]["Quirks"]["DevirtualiseMmio"] = self.check_mats_support(hardware_report.get("CPU").get("CPU Manufacturer"), hardware_report.get("Motherboard").get("Motherboard Chipset")) - if "AMD" in hardware_report.get("CPU").get("CPU Manufacturer") and not "TRX40" in hardware_report.get("Motherboard").get("Motherboard Chipset"): + config["Booter"]["Quirks"]["DevirtualiseMmio"] = self.check_mats_support(hardware_report.get("CPU").get("Manufacturer"), hardware_report.get("Motherboard").get("Chipset")) + if "AMD" in hardware_report.get("CPU").get("Manufacturer") and not "TRX40" in hardware_report.get("Motherboard").get("Chipset"): config["Booter"]["Quirks"]["DevirtualiseMmio"] = False - config["Booter"]["Quirks"]["EnableWriteUnprotector"] = False if "AMD" in hardware_report.get("CPU").get("CPU Manufacturer") else not config["Booter"]["Quirks"]["DevirtualiseMmio"] - config["Booter"]["Quirks"]["ProtectUefiServices"] = "Z390" in hardware_report.get("Motherboard").get("Motherboard Chipset") or \ - not self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("CPU Codename"), end=14) is None + config["Booter"]["Quirks"]["EnableWriteUnprotector"] = False if "AMD" in hardware_report.get("CPU").get("Manufacturer") else not config["Booter"]["Quirks"]["DevirtualiseMmio"] + config["Booter"]["Quirks"]["ProtectUefiServices"] = "Z390" in hardware_report.get("Motherboard").get("Chipset") or \ + not self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), end=14) is None config["Booter"]["Quirks"]["RebuildAppleMemoryMap"] = not config["Booter"]["Quirks"]["EnableWriteUnprotector"] - config["Booter"]["Quirks"]["ResizeAppleGpuBars"] = 0 if self.check_resizable_bar_support(hardware_report.get("Motherboard").get("Motherboard Chipset")) else -1 - config["Booter"]["Quirks"]["SetupVirtualMap"] = not (not self.utils.contains_any(chipset_data.AMDChipsets, hardware_report.get("Motherboard").get("Motherboard Chipset"), start=11, end=17) is None or \ - "ASUS" in hardware_report.get("Motherboard").get("Motherboard Name") and self.is_intel_hedt_cpu(hardware_report.get("CPU").get("CPU Codename")) and config["Booter"]["Quirks"]["DevirtualiseMmio"]) + config["Booter"]["Quirks"]["ResizeAppleGpuBars"] = 0 if self.check_resizable_bar_support(hardware_report.get("Motherboard").get("Chipset")) else -1 + config["Booter"]["Quirks"]["SetupVirtualMap"] = not (not self.utils.contains_any(chipset_data.AMDChipsets, hardware_report.get("Motherboard").get("Chipset"), start=11, end=17) is None or \ + "ASUS" in hardware_report.get("Motherboard").get("Name") and self.is_intel_hedt_cpu(hardware_report.get("CPU").get("Codename")) and config["Booter"]["Quirks"]["DevirtualiseMmio"]) config["Booter"]["Quirks"]["SyncRuntimePermissions"] = config["Booter"]["Quirks"]["RebuildAppleMemoryMap"] config["DeviceProperties"]["Add"] = self.deviceproperties( - hardware_report.get("CPU").get("CPU Codename"), + hardware_report.get("CPU").get("Codename"), next((device_props for device_name, device_props in hardware_report.get("System Devices").items() if "HECI" in device_name or "Management Engine Interface" in device_name), None), {}) config["Kernel"]["Add"] = [] config["Kernel"]["Block"] = self.block_kext_bundle(hardware_report.get("Network"), macos_version) spoof_cpuid = self.spoof_cpuid( hardware_report.get("CPU").get("Processor Name"), - hardware_report.get("CPU").get("CPU Codename"), + hardware_report.get("CPU").get("Codename"), macos_version ) if spoof_cpuid: config["Kernel"]["Emulate"]["Cpuid1Data"] = self.utils.hex_to_bytes("{}{}".format(spoof_cpuid, "0"*8*3)) config["Kernel"]["Emulate"]["Cpuid1Mask"] = self.utils.hex_to_bytes("{}{}".format("F"*8, "0"*8*3)) - config["Kernel"]["Emulate"]["DummyPowerManagement"] = "AMD" in hardware_report.get("CPU").get("CPU Manufacturer") or \ + config["Kernel"]["Emulate"]["DummyPowerManagement"] = "AMD" in hardware_report.get("CPU").get("Manufacturer") or \ self.is_low_end_intel_cpu(hardware_report.get("CPU").get("Processor Name")) config["Kernel"]["Force"] = [] config["Kernel"]["Patch"] = self.load_kernel_patch( - hardware_report.get("Motherboard").get("Motherboard Chipset"), - hardware_report.get("CPU").get("CPU Manufacturer"), - hardware_report.get("CPU").get("CPU Cores"), + hardware_report.get("Motherboard").get("Chipset"), + hardware_report.get("CPU").get("Manufacturer"), + hardware_report.get("CPU").get("Core Count"), list(hardware_report.get("GPU").items())[-1][-1].get("Manufacturer"), kexts ) - config["Kernel"]["Quirks"]["AppleCpuPmCfgLock"] = not self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("CPU Codename"), start=38) is None - config["Kernel"]["Quirks"]["AppleXcpmCfgLock"] = False if "AMD" in hardware_report.get("CPU").get("CPU Manufacturer") else not config["Kernel"]["Quirks"]["AppleCpuPmCfgLock"] - config["Kernel"]["Quirks"]["AppleXcpmExtraMsrs"] = "-E" in hardware_report.get("CPU").get("CPU Codename") and not self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("CPU Codename"), start=26) is None + config["Kernel"]["Quirks"]["AppleCpuPmCfgLock"] = not self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), start=38) is None + config["Kernel"]["Quirks"]["AppleXcpmCfgLock"] = False if "AMD" in hardware_report.get("CPU").get("Manufacturer") else not config["Kernel"]["Quirks"]["AppleCpuPmCfgLock"] + config["Kernel"]["Quirks"]["AppleXcpmExtraMsrs"] = "-E" in hardware_report.get("CPU").get("Codename") and not self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), start=26) is None config["Kernel"]["Quirks"]["CustomSMBIOSGuid"] = True - config["Kernel"]["Quirks"]["DisableIoMapper"] = not "AMD" in hardware_report.get("CPU").get("CPU Manufacturer") - config["Kernel"]["Quirks"]["DisableRtcChecksum"] = "ASUS" in hardware_report.get("Motherboard").get("Motherboard Name") or "HP" in hardware_report.get("Motherboard").get("Motherboard Name") - config["Kernel"]["Quirks"]["LapicKernelPanic"] = "HP" in hardware_report.get("Motherboard").get("Motherboard Name") + config["Kernel"]["Quirks"]["DisableIoMapper"] = not "AMD" in hardware_report.get("CPU").get("Manufacturer") + config["Kernel"]["Quirks"]["DisableRtcChecksum"] = "ASUS" in hardware_report.get("Motherboard").get("Name") or "HP" in hardware_report.get("Motherboard").get("Name") + config["Kernel"]["Quirks"]["LapicKernelPanic"] = "HP" in hardware_report.get("Motherboard").get("Name") config["Kernel"]["Quirks"]["PanicNoKextDump"] = config["Kernel"]["Quirks"]["PowerTimeoutKernelPanic"] = True - config["Kernel"]["Quirks"]["ProvideCurrentCpuInfo"] = "AMD" in hardware_report.get("CPU").get("CPU Manufacturer") or \ - not self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("CPU Codename"), end=2) is None + config["Kernel"]["Quirks"]["ProvideCurrentCpuInfo"] = "AMD" in hardware_report.get("CPU").get("Manufacturer") or \ + not self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), end=2) is None config["Misc"]["BlessOverride"] = [] config["Misc"]["Boot"]["HideAuxiliary"] = False @@ -345,16 +345,16 @@ class ConfigProdigy: config["UEFI"]["APFS"]["MinDate"] = config["UEFI"]["APFS"]["MinVersion"] = -1 config["UEFI"]["Drivers"] = self.load_drivers() - config["UEFI"]["Quirks"]["IgnoreInvalidFlexRatio"] = not self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("CPU Codename"), start=26) is None + config["UEFI"]["Quirks"]["IgnoreInvalidFlexRatio"] = not self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), start=26) is None config["UEFI"]["Quirks"]["ReleaseUsbOwnership"] = True - config["UEFI"]["Quirks"]["UnblockFsConnect"] = "HP" in hardware_report.get("Motherboard").get("Motherboard Name") + config["UEFI"]["Quirks"]["UnblockFsConnect"] = "HP" in hardware_report.get("Motherboard").get("Name") config["UEFI"]["ReservedMemory"] = [] if not (" Core" in hardware_report.get("CPU").get("Processor Name") and \ - self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("CPU Codename"), end=3)): + self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), end=3)): config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revcpu"] = 1 config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revcpuname"] = hardware_report.get("CPU").get("Processor Name") config["NVRAM"]["Delete"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"].extend(["revcpu", "revcpuname"]) - config["PlatformInfo"]["Generic"]["ProcessorType"] = 1537 if int(hardware_report.get("CPU").get("CPU Cores")) < 8 else 3841 + config["PlatformInfo"]["Generic"]["ProcessorType"] = 1537 if int(hardware_report.get("CPU").get("Core Count")) < 8 else 3841 return config \ No newline at end of file diff --git a/Scripts/efi_builder.py b/Scripts/efi_builder.py index f155ec6..8e38752 100644 --- a/Scripts/efi_builder.py +++ b/Scripts/efi_builder.py @@ -49,9 +49,6 @@ class builder: self.utils.create_folder(efi_directory, remove_content=True) - forbidden_chars = r'[<>:"/\\|?*]' - self.utils.write_file(os.path.join(efi_directory, re.sub(forbidden_chars, '_', hardware_report.get("Motherboard").get("Motherboard Name")) + ".json"), hardware_report) - if not os.path.exists(self.kext.ock_files_dir): raise Exception("Directory '{}' does not exist.".format(self.kext.ock_files_dir)) diff --git a/Scripts/kext_maestro.py b/Scripts/kext_maestro.py index 9cb9d4e..f671155 100644 --- a/Scripts/kext_maestro.py +++ b/Scripts/kext_maestro.py @@ -102,44 +102,44 @@ class KextMaestro: selected_kexts = [] - if "Intel" in hardware_report.get("CPU").get("CPU Manufacturer"): + if "Intel" in hardware_report.get("CPU").get("Manufacturer"): selected_kexts.extend(("SMCProcessor", "SMCSuperIO")) - if "Laptop" in hardware_report.get("Motherboard").get("Platform") and not "SURFACE" in hardware_report.get("Motherboard").get("Motherboard Name"): + if "Laptop" in hardware_report.get("Motherboard").get("Platform") and not "SURFACE" in hardware_report.get("Motherboard").get("Name"): selected_kexts.append("SMCBatteryManager") - if "DELL" in hardware_report.get("Motherboard").get("Motherboard Name"): + if "DELL" in hardware_report.get("Motherboard").get("Name"): selected_kexts.append("SMCDellSensors") selected_kexts.append("SMCLightSensor") if not (" Core" in hardware_report.get("CPU").get("Processor Name") and \ - self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("CPU Codename"), end=3)) or \ + self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), end=3)) or \ self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0") or "MacPro7,1" in smbios_model: selected_kexts.append("RestrictEvents") - if list(hardware_report.get("Audio").items())[0][-1].get("Codec ID") in codec_layouts.data: + if list(hardware_report.get("Sound").items())[0][-1].get("Device ID") in codec_layouts.data: selected_kexts.append("AppleALC") - if "AMD" in hardware_report.get("CPU").get("CPU Manufacturer") and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("21.4.0") or \ - int(hardware_report.get("CPU").get("CPU Configuration")) > 1 and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("19.0.0"): + if "AMD" in hardware_report.get("CPU").get("Manufacturer") and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("21.4.0") or \ + int(hardware_report.get("CPU").get("CPU Count")) > 1 and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("19.0.0"): selected_kexts.append("AppleMCEReporterDisabler") - if self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("22.0.0") and not "AVX2" in hardware_report.get("CPU").get("Instruction Set"): + if self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("22.0.0") and not "AVX2" in hardware_report.get("CPU").get("SIMD Features"): selected_kexts.append("CryptexFixup") - if self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("CPU Codename"), end=2) and \ - int(hardware_report.get("CPU").get("CPU Cores")) > 6: + if self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), end=2) and \ + int(hardware_report.get("CPU").get("Core Count")) > 6: selected_kexts.append("CpuTopologyRebuild") - if "AMD" in hardware_report.get("CPU").get("CPU Manufacturer") and \ + if "AMD" in hardware_report.get("CPU").get("Manufacturer") and \ "Integrated GPU" in list(hardware_report.get("GPU").items())[0][-1].get("Device Type") and \ "Integrated GPU" in list(hardware_report.get("GPU").items())[-1][-1].get("Device Type"): selected_kexts.append("NootedRed") else: - selected_kexts.append("NootRX" if "Navi 2" in list(hardware_report.get("GPU").items())[-1][-1].get("GPU Codename") else "WhateverGreen") + selected_kexts.append("NootRX" if "Navi 2" in list(hardware_report.get("GPU").items())[-1][-1].get("Codename") else "WhateverGreen") - if "Laptop" in hardware_report.get("Motherboard").get("Platform") and "ASUS" in hardware_report.get("Motherboard").get("Motherboard Name") or \ + if "Laptop" in hardware_report.get("Motherboard").get("Platform") and "ASUS" in hardware_report.get("Motherboard").get("Name") or \ "NootedRed" in selected_kexts or \ - self.is_intel_hedt_cpu(hardware_report.get("CPU").get("CPU Codename")): + self.is_intel_hedt_cpu(hardware_report.get("CPU").get("Codename")): selected_kexts.append("ForgedInvariant") ethernet_pci = None @@ -188,10 +188,10 @@ class KextMaestro: selected_kexts.append("IntelBluetoothFirmware") if "Laptop" in hardware_report.get("Motherboard").get("Platform"): - if "SURFACE" in hardware_report.get("Motherboard").get("Motherboard Name"): + if "SURFACE" in hardware_report.get("Motherboard").get("Name"): selected_kexts.append("BigSurface") else: - if "ASUS" in hardware_report.get("Motherboard").get("Motherboard Name"): + if "ASUS" in hardware_report.get("Motherboard").get("Name"): selected_kexts.append("AsusSMC") selected_kexts.append("BrightnessKeys") diff --git a/Scripts/smbios.py b/Scripts/smbios.py index a4b3dc8..3b010ab 100644 --- a/Scripts/smbios.py +++ b/Scripts/smbios.py @@ -60,48 +60,48 @@ class SMBIOS: def select_smbios_model(self, hardware_report, macos_version): if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("20.0.0") or \ - self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("CPU Codename"), end=4): + self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), end=4): smbios_model = "iMacPro1,1" else: smbios_model = "MacPro7,1" - if "AMD" in hardware_report.get("CPU").get("CPU Manufacturer") and \ + if "AMD" in hardware_report.get("CPU").get("Manufacturer") and \ "Integrated GPU" in list(hardware_report.get("GPU").items())[-1][-1].get("Device Type"): smbios_model = "MacBookPro16,3" if "Laptop" in hardware_report.get("Motherboard").get("Platform") else "iMacPro1,1" if "Intel" in list(hardware_report.get("GPU").items())[0][-1].get("Manufacturer") and \ "Integrated GPU" in list(hardware_report.get("GPU").items())[0][-1].get("Device Type"): - if "Kaby Lake-R".lower() in hardware_report.get("CPU").get("CPU Codename").lower() and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0"): - hardware_report["CPU"]["CPU Codename"] = "Coffee Lake" + if "Kaby Lake-R".lower() in hardware_report.get("CPU").get("Codename").lower() and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0"): + hardware_report["CPU"]["Codename"] = "Coffee Lake" - if "Sandy Bridge" in hardware_report.get("CPU").get("CPU Codename"): + if "Sandy Bridge" in hardware_report.get("CPU").get("Codename"): if "Desktop" in hardware_report.get("Motherboard").get("Platform"): if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("18.0.0"): smbios_model = "iMac12,2" else: smbios_model = "MacPro6,1" elif "NUC" in hardware_report.get("Motherboard").get("Platform"): - smbios_model = "Macmini5,1" if int(hardware_report.get("CPU").get("CPU Cores")) < 4 else "Macmini5,3" + smbios_model = "Macmini5,1" if int(hardware_report.get("CPU").get("Core Count")) < 4 else "Macmini5,3" else: - smbios_model = "MacBookPro8,1" if int(hardware_report.get("CPU").get("CPU Cores")) < 4 else "MacBookPro8,2" - elif "Ivy Bridge" in hardware_report.get("CPU").get("CPU Codename"): + smbios_model = "MacBookPro8,1" if int(hardware_report.get("CPU").get("Core Count")) < 4 else "MacBookPro8,2" + elif "Ivy Bridge" in hardware_report.get("CPU").get("Codename"): if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("21.0.0"): if "Desktop" in hardware_report.get("Motherboard").get("Platform"): smbios_model = "iMac14,4" if "Integrated GPU" in list(hardware_report.get("GPU").items())[-1][-1].get("Device Type") else "iMac15,1" elif "NUC" in hardware_report.get("Motherboard").get("Platform"): smbios_model = "Macmini7,1" else: - smbios_model = "MacBookPro11,1" if int(hardware_report.get("CPU").get("CPU Cores")) < 4 else "MacBookPro11,5" + smbios_model = "MacBookPro11,1" if int(hardware_report.get("CPU").get("Core Count")) < 4 else "MacBookPro11,5" elif self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("20.0.0"): if "Desktop" in hardware_report.get("Motherboard").get("Platform"): smbios_model = "iMac13,1" if "Integrated GPU" in list(hardware_report.get("GPU").items())[-1][-1].get("Device Type") else "iMac13,2" elif "NUC" in hardware_report.get("Motherboard").get("Platform"): - smbios_model = "Macmini6,1" if int(hardware_report.get("CPU").get("CPU Cores")) < 4 else "Macmini6,2" + smbios_model = "Macmini6,1" if int(hardware_report.get("CPU").get("Core Count")) < 4 else "Macmini6,2" else: - smbios_model = "MacBookPro10,2" if int(hardware_report.get("CPU").get("CPU Cores")) < 4 else "MacBookPro10,1" + smbios_model = "MacBookPro10,2" if int(hardware_report.get("CPU").get("Core Count")) < 4 else "MacBookPro10,1" else: smbios_model = "MacPro6,1" - elif "Haswell" in hardware_report.get("CPU").get("CPU Codename"): + elif "Haswell" in hardware_report.get("CPU").get("Codename"): if "Desktop" in hardware_report.get("Motherboard").get("Platform"): smbios_model = "iMac14,4" if "Integrated GPU" in list(hardware_report.get("GPU").items())[-1][-1].get("Device Type") else "iMac15,1" if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("22.0.0"): @@ -109,37 +109,37 @@ class SMBIOS: elif "NUC" in hardware_report.get("Motherboard").get("Platform"): smbios_model = "Macmini7,1" else: - smbios_model = "MacBookPro11,1" if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("21.0.0") and int(hardware_report.get("CPU").get("CPU Cores")) < 4 else "MacBookPro11,5" - elif "Broadwell" in hardware_report.get("CPU").get("CPU Codename"): + smbios_model = "MacBookPro11,1" if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("21.0.0") and int(hardware_report.get("CPU").get("Core Count")) < 4 else "MacBookPro11,5" + elif "Broadwell" in hardware_report.get("CPU").get("Codename"): if "Desktop" in hardware_report.get("Motherboard").get("Platform"): smbios_model = "iMac16,2" if "Integrated GPU" in list(hardware_report.get("GPU").items())[-1][-1].get("Device Type") else "iMac17,1" elif "NUC" in hardware_report.get("Motherboard").get("Platform"): smbios_model = "iMac16,1" else: - smbios_model = "MacBookPro12,1" if int(hardware_report.get("CPU").get("CPU Cores")) < 4 else "MacBookPro11,5" - elif "Skylake" in hardware_report.get("CPU").get("CPU Codename"): + smbios_model = "MacBookPro12,1" if int(hardware_report.get("CPU").get("Core Count")) < 4 else "MacBookPro11,5" + elif "Skylake" in hardware_report.get("CPU").get("Codename"): smbios_model = "iMac17,1" if "Laptop" in hardware_report.get("Motherboard").get("Platform"): - smbios_model = "MacBookPro13,1" if int(hardware_report.get("CPU").get("CPU Cores")) < 4 else "MacBookPro13,3" - elif self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("CPU Codename"), start=6, end=16): + smbios_model = "MacBookPro13,1" if int(hardware_report.get("CPU").get("Core Count")) < 4 else "MacBookPro13,3" + elif self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), start=6, end=16): smbios_model = "Macmini8,1" if "Desktop" in hardware_report.get("Motherboard").get("Platform"): smbios_model = "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 hardware_report.get("CPU").get("CPU Codename"): - smbios_model = "iMac20,1" if int(hardware_report.get("CPU").get("CPU Cores")) < 10 else "iMac20,2" + if "Comet Lake" in hardware_report.get("CPU").get("Codename"): + smbios_model = "iMac20,1" if int(hardware_report.get("CPU").get("Core Count")) < 10 else "iMac20,2" elif "Laptop" in hardware_report.get("Motherboard").get("Platform"): if "-8" in hardware_report.get("CPU").get("Processor Name"): - smbios_model = "MacBookPro15,2" if int(hardware_report.get("CPU").get("CPU Cores")) < 6 else "MacBookPro15,3" + smbios_model = "MacBookPro15,2" if int(hardware_report.get("CPU").get("Core Count")) < 6 else "MacBookPro15,3" else: - smbios_model = "MacBookPro16,3" if int(hardware_report.get("CPU").get("CPU Cores")) < 6 else "MacBookPro16,1" - elif "Kaby Lake" in hardware_report.get("CPU").get("CPU Codename"): + smbios_model = "MacBookPro16,3" if int(hardware_report.get("CPU").get("Core Count")) < 6 else "MacBookPro16,1" + elif "Kaby Lake" in hardware_report.get("CPU").get("Codename"): smbios_model = "iMac18,1" if "Integrated GPU" in list(hardware_report.get("GPU").items())[-1][-1].get("Device Type") else "iMac18,3" if "Laptop" in hardware_report.get("Motherboard").get("Platform"): - smbios_model = "MacBookPro14,1" if int(hardware_report.get("CPU").get("CPU Cores")) < 4 else "MacBookPro14,3" - elif "Amber Lake" in hardware_report.get("CPU").get("CPU Codename"): + smbios_model = "MacBookPro14,1" if int(hardware_report.get("CPU").get("Core Count")) < 4 else "MacBookPro14,3" + elif "Amber Lake" in hardware_report.get("CPU").get("Codename"): smbios_model = "MacBookAir8,1" - elif "Ice Lake" in hardware_report.get("CPU").get("CPU Codename"): - smbios_model = "MacBookAir9,1" if int(hardware_report.get("CPU").get("CPU Cores")) < 4 else "MacBookPro16,2" + elif "Ice Lake" in hardware_report.get("CPU").get("Codename"): + smbios_model = "MacBookAir9,1" if int(hardware_report.get("CPU").get("Core Count")) < 4 else "MacBookPro16,2" return smbios_model