From 431be0dbc10571d3ff69809f91eb375ab29cccec Mon Sep 17 00:00:00 2001 From: Hoang Hong Quan Date: Tue, 8 Oct 2024 00:24:06 +0700 Subject: [PATCH] Add compatibility info to main screen --- OpCore-Simplify.py | 39 +++++++++++++------------------- Scripts/compatibility_checker.py | 9 +++++++- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/OpCore-Simplify.py b/OpCore-Simplify.py index 314f41d..cd762f2 100644 --- a/OpCore-Simplify.py +++ b/OpCore-Simplify.py @@ -72,26 +72,6 @@ class OCPE: print(content) self.u.request_input() return - - def compatibility_check(self, hardware_report): - supported_macos_version, unsupported_devices = self.c.check_compatibility(hardware_report) - - self.u.head("Compatibility Checker") - print("") - if not supported_macos_version: - self.u.request_input("Your hardware is not compatible with macOS!") - self.u.exit_program() - print("* Supported macOS Version:") - print("{}Max Version: {}".format(" "*4, os_data.get_macos_name_by_darwin(supported_macos_version[-1]))) - print("{}Min Version: {}".format(" "*4, os_data.get_macos_name_by_darwin(supported_macos_version[0]))) - if unsupported_devices: - print("* Unsupported devices:") - for index, device_name in enumerate(unsupported_devices, start=1): - device_props = unsupported_devices.get(device_name) - print("{}{}. {}{}".format(" "*4, index, device_name, "" if not device_props.get("Audio Endpoints") else " ({})".format(", ".join(device_props.get("Audio Endpoints"))))) - print("") - self.u.request_input() - return supported_macos_version, unsupported_devices def select_macos_version(self, supported_macos_version): version_pattern = re.compile(r'^(\d+)(?:\.(\d+)(?:\.(\d+))?)?$') @@ -145,6 +125,8 @@ class OCPE: def main(self): hardware_report_path = None + supported_macos_version = None + unsupported_devices = None macos_version = None smbios_model = None @@ -152,9 +134,20 @@ class OCPE: self.u.head() print("") print("Hardware Report: {}".format("No report selected" if not hardware_report_path else hardware_report_path)) - print("macOS Version: {}{}".format("Unknown" if not macos_version else os_data.get_macos_name_by_darwin(macos_version), "" if not macos_version else " ({})".format(macos_version))) - print("SMBIOS: {}".format("Unknown" if not smbios_model else smbios_model)) print("") + if hardware_report_path: + print("* Hardware Compatibility:") + if supported_macos_version: + print(" - Supported macOS Version: {} - {}".format(os_data.get_macos_name_by_darwin(supported_macos_version[-1]), os_data.get_macos_name_by_darwin(supported_macos_version[0]))) + if unsupported_devices: + print(" - Unsupported devices:") + for index, device_name in enumerate(unsupported_devices, start=1): + device_props = unsupported_devices.get(device_name) + print("{}{}. {}{}".format(" "*6, index, device_name, "" if not device_props.get("Audio Endpoints") else " ({})".format(", ".join(device_props.get("Audio Endpoints"))))) + print("* EFI Options:") + print(" - macOS Version: {}{}".format("Unknown" if not macos_version else os_data.get_macos_name_by_darwin(macos_version), "" if not macos_version else " ({})".format(macos_version))) + print(" - SMBIOS: {}".format("Unknown" if not smbios_model else smbios_model)) + print("") print("1. Select Hardware Report") print("2. Select macOS Version") print("3. Customize ACPI Patch") @@ -176,7 +169,7 @@ class OCPE: if option == 1: hardware_report_path, hardware_report = self.select_hardware_report() self.show_hardware_report(hardware_report) - supported_macos_version, unsupported_devices = self.compatibility_check(hardware_report) + supported_macos_version, unsupported_devices = self.c.check_compatibility(hardware_report) macos_version = supported_macos_version[-1] if int(macos_version[:2]) == os_data.macos_versions[-1].darwin_version and os_data.macos_versions[-1].release_status == "beta": macos_version = str(int(macos_version[:2]) - 1) + macos_version[2:] diff --git a/Scripts/compatibility_checker.py b/Scripts/compatibility_checker.py index 43756d8..45a8859 100644 --- a/Scripts/compatibility_checker.py +++ b/Scripts/compatibility_checker.py @@ -182,6 +182,9 @@ class CompatibilityChecker: del hardware["SD Controller"] def check_compatibility(self, hardware): + self.utils.head("Compatibility Checker") + print("") + 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 = {} @@ -205,4 +208,8 @@ class CompatibilityChecker: hardware["Storage Controllers"] = self.check_storage_compatibility(hardware.get("Storage Controllers")) self.check_sd_controller_compatibility(hardware) - return () if self.max_supported_macos_version[0] == -1 else (".".join(str(item) for item in self.min_supported_macos_version), ".".join(str(item) for item in self.max_supported_macos_version)), self.unsupported_devices \ No newline at end of file + if self.max_supported_macos_version[0] == -1: + self.u.request_input("Your hardware is not compatible with macOS!") + self.u.exit_program() + + return (".".join(str(item) for item in self.min_supported_macos_version), ".".join(str(item) for item in self.max_supported_macos_version)), self.unsupported_devices \ No newline at end of file