diff --git a/OpCore-Simplify.py b/OpCore-Simplify.py index bc2919f..c6c0cc6 100644 --- a/OpCore-Simplify.py +++ b/OpCore-Simplify.py @@ -61,9 +61,6 @@ class OCPE: return def hardware_report(self): - if not self.hardware: - self.select_aida64_report() - self.u.head("Review the hardware information") contents = [] for index, device_type in enumerate(self.hardware, start=1): @@ -83,9 +80,6 @@ class OCPE: return def compatibility_check(self): - if not self.hardware: - self.select_aida64_report() - self.hardware = self.c.check_compatibility(self.hardware) self.compatibility = self.hardware.get("Compatibility") supported_macOS_version = self.compatibility.get("macOS Version") @@ -108,9 +102,6 @@ class OCPE: return def select_macos_version(self): - if not self.compatibility: - self.compatibility_check() - supported_macOS_version = self.compatibility.get("macOS Version") min_version = supported_macOS_version.get("Min Version") max_version = supported_macOS_version.get("Max Version") @@ -203,11 +194,11 @@ class OCPE: if __name__ == '__main__': o = OCPE() - #try: - update_flag = updater.Updater().run_update() - if update_flag: - os.execv(sys.executable, ['python3'] + sys.argv) - else: - o.main() - #except Exception as e: - # o.u.exit_program(o.u.message("\nAn error occurred: {}\n".format(e))) + try: + update_flag = updater.Updater().run_update() + if update_flag: + os.execv(sys.executable, ['python3'] + sys.argv) + else: + o.main() + except Exception as e: + o.u.exit_program(o.u.message("\nAn error occurred: {}\n".format(e))) diff --git a/Scripts/aida64.py b/Scripts/aida64.py index 5ebea5c..339801c 100644 --- a/Scripts/aida64.py +++ b/Scripts/aida64.py @@ -55,11 +55,9 @@ class AIDA64: def motherboard(self, motherboard_props, dmi): motherboard_info = {} - # Extract motherboard name and chipset from provided properties motherboard_info["Motherboard Name"] = motherboard_props.get("Motherboard Name", "Unknown").split("(")[0].strip() motherboard_info["Motherboard Chipset"] = motherboard_props.get("Motherboard Chipset", "Unknown").split(", ")[0] - # If motherboard name is still unknown, attempt to derive it from DMI information if "Unknown" in motherboard_info.get("Motherboard Name"): motherboard_info["Motherboard Name"] = "Unknown" merged_report = dmi.get("System", {}).copy() @@ -69,7 +67,6 @@ class AIDA64: if "O.E.M." not in motherboard_name and "System Product Name" not in motherboard_name and len(motherboard_name) > len(motherboard_info.get("Motherboard Name")): motherboard_info["Motherboard Name"] = motherboard_name - # Extract platform type from chassis information motherboard_info["Platform"] = dmi.get("Chassis", {}).get("Chassis Properties", {}).get("Chassis Type", "Unknown") if any(word in motherboard_info["Platform"].lower() for word in ["convertible", "notebook", "laptop", "docking station", "portable"]): motherboard_info["Platform"] = "Laptop" @@ -88,7 +85,6 @@ class AIDA64: cpu_props = cpu_table.get("CPU Properties", {}) cpu_info["Processor Name"] = cpu_props.get("CPU Type", "Unknown").split(",")[0] - # Determine CPU Manufacturer if still unknown if "Intel" in cpu_info["CPU Manufacturer"]: cpu_info["CPU Manufacturer"] = "Intel" elif "Advanced Micro Devices" in cpu_info["CPU Manufacturer"]: diff --git a/Scripts/codec_layouts.py b/Scripts/codec_layouts.py index 47e306a..bd8961e 100755 --- a/Scripts/codec_layouts.py +++ b/Scripts/codec_layouts.py @@ -1,100 +1,34 @@ -from Scripts import github -from Scripts import resource_fetcher from Scripts import utils import os -class CodecLayouts: - def __init__(self): - self.github = github.Github() - self.fetcher = resource_fetcher.ResourceFetcher(self.github.headers) - self.utils = utils.Utils() - self.vendors = { - "11D4": ["AD", "AnalogDevices"], - "10EC": ["ALC", "Realtek"], - "1102": ["CA", "Creative"], - "1013": ["CS", "CirrusLogic"], - "14F1": ["CX", "Conexant"], - "111D": ["IDT"], - "8384": ["STAC", "SigmaTel"], - "1106": ["VT", "VIA"] - } - - def get_layout_ids_from_applealc_repo(self): - # Define the GitHub API URL for the AppleALC repository contents - url = "https://api.github.com/repos/acidanthera/AppleALC/contents/Resources" +u = utils.Utils() - self.github.check_ratelimit() - - # Dictionary to store sound codec information - sound_codec_info = {} - - # Retrieve content information from the GitHub repository - content = self.fetcher.fetch_and_parse_content(url, "json") - - # Iterate through folders in the content - for folder in content: - codec_folder_name = folder["name"] - - if "." in codec_folder_name: - continue - - # Identify vendor based on the vendor information - vendor_id = next((id for id, vendor in self.vendors.items() if vendor[0] in codec_folder_name), None) - - if not vendor_id: - # Skip if vendor ID is not found - print("Unknown vendor for codec: {}".format(codec_folder_name)) - continue - - # Extract vendor name from vendor information - vendor_name = self.vendors[vendor_id][-1] - - # Build the raw URL for the Info.plist file - raw_url = "https://raw.githubusercontent.com/acidanthera/AppleALC/master/Resources/{}/Info.plist".format(codec_folder_name) - - # Retrieve content from the Info.plist file and parse as plist - info = self.fetcher.fetch_and_parse_content(raw_url, "json") - - # Extract relevant information from the Info.plist - codec_id_hex = self.utils.int_to_hex(info["CodecID"]).zfill(4) - formatted_codec_name = "{} {}".format(vendor_name, info["CodecName"]) - layout_ids = sorted([int(layouts["Id"]) for layouts in info["Files"]["Layouts"]]) - pci_id = "{}-{}".format(vendor_id, codec_id_hex).upper() +def get_layout_ids(applealc_path): + if not os.path.exists(applealc_path): + return {} - sound_codec_info[pci_id] = layout_ids - - # Sort sound codec information by name - sorted_sound_codec_info = dict(sorted(sound_codec_info.items(), key=lambda item: item[1]["Name"])) - - return sorted_sound_codec_info + plist_path = os.path.join(applealc_path, "Contents", "Info.plist") + plist_data = u.read_file(plist_path) + + if not plist_data: + return {} + + codec_layouts = {} + + hda_config_defaults = plist_data.get("IOKitPersonalities", {}).get("as.vit9696.AppleALC", {}).get("HDAConfigDefault", []) + for layout in hda_config_defaults: + codec_id_hex = u.int_to_hex(layout.get("CodecID", 0)).zfill(8) + formatted_codec_id = "{}-{}".format(codec_id_hex[:4], codec_id_hex[-4:]) + layout_id = layout.get("LayoutID") + if layout_id is not None: + if formatted_codec_id not in codec_layouts: + codec_layouts[formatted_codec_id] = [] + codec_layouts[formatted_codec_id].append(layout_id) - def get_layout_ids_from_applealc_kext(self, applealc_path): - if not os.path.exists(applealc_path): - return {} + for codec_id in codec_layouts: + codec_layouts[codec_id] = sorted(codec_layouts[codec_id]) - plist_path = os.path.join(applealc_path, "Contents", "Info.plist") - plist_data = self.utils.read_file(plist_path) - - if not plist_data: - return {} - - codec_layouts = {} - - hda_config_defaults = plist_data.get("IOKitPersonalities", {}).get("as.vit9696.AppleALC", {}).get("HDAConfigDefault", []) - for layout in hda_config_defaults: - codec_id_hex = self.utils.int_to_hex(layout.get("CodecID", 0)).zfill(8) - formatted_codec_id = "{}-{}".format(codec_id_hex[:4], codec_id_hex[-4:]) - layout_id = layout.get("LayoutID") - if layout_id is not None: - if formatted_codec_id not in codec_layouts: - codec_layouts[formatted_codec_id] = [] - codec_layouts[formatted_codec_id].append(layout_id) - - # Sort the layout IDs for each codec - for codec_id in codec_layouts: - codec_layouts[codec_id] = sorted(codec_layouts[codec_id]) - - return codec_layouts + return codec_layouts data = { "10EC-0295": [ diff --git a/Scripts/github.py b/Scripts/github.py index 3298198..32e6f85 100755 --- a/Scripts/github.py +++ b/Scripts/github.py @@ -56,7 +56,6 @@ class Github: response = self.fetcher.fetch_and_parse_content(url, "json") - # Iterate over the assets in the release for asset in response[0].get("assets"): asset_id = asset.get("id") download_url = asset.get("browser_download_url") @@ -72,7 +71,6 @@ class Github: return result def extract_asset_name(self, name): - # Extract the base name from the asset name name_parts = name.split("-") if "-" in name else name.split("_") asset_name = name_parts[0].split(".")[0]