From 88fa7a4b7a2784bf7b9acdb331f51dad3c0a0276 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Wed, 15 Mar 2023 10:31:35 -0600 Subject: [PATCH 1/2] arguments.py: Remove unused variable --- resources/arguments.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/resources/arguments.py b/resources/arguments.py index a0eb71f88..97dedc864 100644 --- a/resources/arguments.py +++ b/resources/arguments.py @@ -109,10 +109,6 @@ If you plan to create the USB for another machine, please select the "Change Mod logging.info(f"- Using detected model: {self.constants.computer.real_model}") defaults.GenerateDefaults(self.constants.custom_model, True, self.constants) - if self.args.disk: - logging.info(f"- Install Disk set: {self.args.disk}") - self.constants.disk = self.args.disk - if self.args.verbose: logging.info("- Set verbose configuration") self.constants.verbose_debug = True From 7fe0432a475e90fbb47b6f33184b0d1791af2d96 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Wed, 15 Mar 2023 10:33:26 -0600 Subject: [PATCH 2/2] constants.py: Reorganize variables --- resources/constants.py | 299 +++++++++++++++++++++-------------------- 1 file changed, 153 insertions(+), 146 deletions(-) diff --git a/resources/constants.py b/resources/constants.py index cc4f38e64..4c125262f 100644 --- a/resources/constants.py +++ b/resources/constants.py @@ -1,5 +1,5 @@ # pylint: disable=multiple-statements -# Define Files +# Defines versioning, file paths and other settings for the patcher # Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk from pathlib import Path @@ -12,209 +12,216 @@ from data import os_data class Constants: def __init__(self): # Patcher Versioning - self.patcher_version = "0.6.2" # OpenCore-Legacy-Patcher - self.patcher_support_pkg_version = "0.8.5" # PatcherSupportPkg - self.url_patcher_support_pkg = "https://github.com/dortania/PatcherSupportPkg/releases/download/" - self.nightly_url_patcher_support_pkg = "https://nightly.link/dortania/PatcherSupportPkg/workflows/build/master/" - self.discord_link = "https://discord.gg/rqdPgH8xSN" - self.guide_link = "https://dortania.github.io/OpenCore-Legacy-Patcher/" - self.repo_link = "https://github.com/dortania/OpenCore-Legacy-Patcher" - self.repo_link_latest = f"{self.repo_link}/releases/tag/{self.patcher_version}" - self.copyright_date = "Copyright © 2020-2023 Dortania" - self.installer_pkg_url = f"{self.repo_link}/releases/download/{self.patcher_version}/AutoPkg-Assets.pkg" - self.installer_pkg_url_nightly = "http://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython/main/AutoPkg-Assets.pkg.zip" + self.patcher_version: str = "0.6.2" # OpenCore-Legacy-Patcher + self.patcher_support_pkg_version: str = "0.8.5" # PatcherSupportPkg + self.copyright_date: str = "Copyright © 2020-2023 Dortania" + + # URLs + self.url_patcher_support_pkg: str = "https://github.com/dortania/PatcherSupportPkg/releases/download/" + self.nightly_url_patcher_support_pkg: str = "https://nightly.link/dortania/PatcherSupportPkg/workflows/build/master/" + self.discord_link: str = "https://discord.gg/rqdPgH8xSN" + self.guide_link: str = "https://dortania.github.io/OpenCore-Legacy-Patcher/" + self.repo_link: str = "https://github.com/dortania/OpenCore-Legacy-Patcher" + self.repo_link_latest: str = f"{self.repo_link}/releases/tag/{self.patcher_version}" + self.installer_pkg_url: str = f"{self.repo_link}/releases/download/{self.patcher_version}/AutoPkg-Assets.pkg" + self.installer_pkg_url_nightly: str = "http://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython/main/AutoPkg-Assets.pkg.zip" # OpenCore Versioning # https://github.com/acidanthera/OpenCorePkg - self.opencore_commit = "e4f0ba1 - 03-06-2023" - self.opencore_version = "0.9.0" + self.opencore_commit: str = "e4f0ba1 - 03-06-2023" + self.opencore_version: str = "0.9.0" # Kext Versioning ## Acidanthera ## https://github.com/acidanthera - self.lilu_version = "1.6.4" # Lilu - self.whatevergreen_version = "1.6.4" # WhateverGreen - self.whatevergreen_navi_version = "1.6.4-Navi" # WhateverGreen (Navi Patch) - self.airportbcrmfixup_version = "2.1.6" # AirPortBrcmFixup - self.nvmefix_version = "1.1.0" # NVMeFix - self.applealc_version = "1.6.3" # AppleALC - self.restrictevents_version = "1.0.9" # RestrictEvents - self.featureunlock_version = "1.1.4" # FeatureUnlock - self.debugenhancer_version = "1.0.7" # DebugEnhancer - self.cpufriend_version = "1.2.6" # CPUFriend - self.bluetool_version = "2.6.4" # BlueToolFixup (BrcmPatchRAM) - self.cslvfixup_version = "2.6.1" # CSLVFixup - self.autopkg_version = "1.0.2" # AutoPkgInstaller - self.cryptexfixup_version = "1.0.1" # CryptexFixup + self.lilu_version: str = "1.6.4" # Lilu + self.whatevergreen_version: str = "1.6.4" # WhateverGreen + self.whatevergreen_navi_version: str = "1.6.4-Navi" # WhateverGreen (Navi Patch) + self.airportbcrmfixup_version: str = "2.1.6" # AirPortBrcmFixup + self.nvmefix_version: str = "1.1.0" # NVMeFix + self.applealc_version: str = "1.6.3" # AppleALC + self.restrictevents_version: str = "1.0.9" # RestrictEvents + self.featureunlock_version: str = "1.1.4" # FeatureUnlock + self.debugenhancer_version: str = "1.0.7" # DebugEnhancer + self.cpufriend_version: str = "1.2.6" # CPUFriend + self.bluetool_version: str = "2.6.4" # BlueToolFixup (BrcmPatchRAM) + self.cslvfixup_version: str = "2.6.1" # CSLVFixup + self.autopkg_version: str = "1.0.2" # AutoPkgInstaller + self.cryptexfixup_version: str = "1.0.1" # CryptexFixup ## Apple ## https://www.apple.com - self.marvel_version = "1.0.1" # MarvelYukonEthernet - self.nforce_version = "1.0.1" # nForceEthernet - self.piixata_version = "1.0.1" # AppleIntelPIIXATA - self.fw_kext = "1.0.1" # IOFireWireFamily - self.apple_trackpad = "1.0.1" # AppleUSBTrackpad - self.apple_isight_version = "1.0.0" # AppleiSight - self.apple_raid_version = "1.0.0" # AppleRAIDCard - self.apfs_zlib_version = "12.3.1" # NoAVXFSCompressionTypeZlib - self.apfs_zlib_v2_version = "12.6" # NoAVXFSCompressionTypeZlib (patched with AVXpel) - self.multitouch_version = "1.0.0" # AppleUSBMultitouch - self.topcase_version = "1.0.0" # AppleUSBTopCase - self.intel_82574l_version = "1.0.0" # Intel82574L - self.intel_8254x_version = "1.0.0" # AppleIntel8254XEthernet - self.apple_usb_11_injector = "1.0.0" # AppleUSBUHCI/OHCI - self.aicpupm_version = "1.0.0" # AppleIntelCPUPowerManagement/Client + self.marvel_version: str = "1.0.1" # MarvelYukonEthernet + self.nforce_version: str = "1.0.1" # nForceEthernet + self.piixata_version: str = "1.0.1" # AppleIntelPIIXATA + self.fw_kext: str = "1.0.1" # IOFireWireFamily + self.apple_trackpad: str = "1.0.1" # AppleUSBTrackpad + self.apple_isight_version: str = "1.0.0" # AppleiSight + self.apple_raid_version: str = "1.0.0" # AppleRAIDCard + self.apfs_zlib_version: str = "12.3.1" # NoAVXFSCompressionTypeZlib + self.apfs_zlib_v2_version: str = "12.6" # NoAVXFSCompressionTypeZlib (patched with AVXpel) + self.multitouch_version: str = "1.0.0" # AppleUSBMultitouch + self.topcase_version: str = "1.0.0" # AppleUSBTopCase + self.intel_82574l_version: str = "1.0.0" # Intel82574L + self.intel_8254x_version: str = "1.0.0" # AppleIntel8254XEthernet + self.apple_usb_11_injector: str = "1.0.0" # AppleUSBUHCI/OHCI + self.aicpupm_version: str = "1.0.0" # AppleIntelCPUPowerManagement/Client ## Apple - Dortania Modified - self.bcm570_version = "1.0.2" # CatalinaBCM5701Ethernet - self.i210_version = "1.0.0" # CatalinaIntelI210Ethernet - self.corecaptureelcap_version = "1.0.1" # corecaptureElCap - self.io80211elcap_version = "2.0.0" # IO80211ElCap - self.bigsursdxc_version = "1.0.0" # BigSurSDXC - self.monterey_ahci_version = "1.0.0" # CatalinaAHCI + self.bcm570_version: str = "1.0.2" # CatalinaBCM5701Ethernet + self.i210_version: str = "1.0.0" # CatalinaIntelI210Ethernet + self.corecaptureelcap_version: str = "1.0.1" # corecaptureElCap + self.io80211elcap_version: str = "2.0.0" # IO80211ElCap + self.bigsursdxc_version: str = "1.0.0" # BigSurSDXC + self.monterey_ahci_version: str = "1.0.0" # CatalinaAHCI ## Dortania ## https://github.com/dortania - self.backlight_injector_version = "1.1.0" # BacklightInjector - self.smcspoof_version = "1.0.0" # SMC-Spoof - self.mce_version = "1.0.0" # AppleMCEReporterDisabler - self.btspoof_version = "1.0.0" # Bluetooth-Spoof - self.aspp_override_version = "1.0.1" # ACPI_SMC_PlatformPlugin Override - self.rsrhelper_version = "1.0.0" # RSRHelper + self.backlight_injector_version: str = "1.1.0" # BacklightInjector + self.smcspoof_version: str = "1.0.0" # SMC-Spoof + self.mce_version: str = "1.0.0" # AppleMCEReporterDisabler + self.btspoof_version: str = "1.0.0" # Bluetooth-Spoof + self.aspp_override_version: str = "1.0.1" # ACPI_SMC_PlatformPlugin Override + self.rsrhelper_version: str = "1.0.0" # RSRHelper ## Syncretic ## https://forums.macrumors.com/members/syncretic.1173816/ ## https://github.com/reenigneorcim/latebloom - self.mousse_version = "0.95-Dortania" # MouSSE - self.telemetrap_version = "1.0.0" # telemetrap + self.mousse_version: str = "0.95-Dortania" # MouSSE + self.telemetrap_version: str = "1.0.0" # telemetrap ## cdf ## https://github.com/cdf/Innie - self.innie_version = "1.3.1" # Innie + self.innie_version: str = "1.3.1" # Innie ## arter97 ## https://github.com/arter97/SimpleMSR/ - self.simplemsr_version = "1.0.0" # SimpleMSR + self.simplemsr_version: str = "1.0.0" # SimpleMSR ## blackgate ## https://github.com/blackgate/AMDGPUWakeHandler - self.gpu_wake_version = "1.0.0" + self.gpu_wake_version: str = "1.0.0" ## flagersgit ## https://github.com/flagersgit/KDKlessWorkaround - self.kdkless_version = "1.0.0" + self.kdkless_version: str = "1.0.0" # Get resource path - self.current_path = Path(__file__).parent.parent.resolve() - self.payload_path = self.current_path / Path("payloads") + self.current_path: Path = Path(__file__).parent.parent.resolve() + self.payload_path: Path = self.current_path / Path("payloads") # Patcher Settings - self.allow_oc_everywhere = False # Set whether Patcher can be run on unsupported Macs - self.gui_mode = False # Determine whether running in a GUI or TUI - self.disk = "" # Set installation ESP - self.patch_disk = "" # Set Root Volume to patch - self.validate = False # Enable validation testing for CI - self.recovery_status = False # Detect if booted into RecoveryOS - self.launcher_binary = None # Determine launch binary (ie. Python vs PyInstaller) - self.launcher_script = None # Determine launch file (if run via Python) - self.ignore_updates = False # Ignore OCLP updates - self.wxpython_variant = False # Determine if using wxPython variant - self.unpack_thread = None # Determine if unpack thread finished - self.cli_mode = False # Determine if running in CLI mode - self.should_nuke_kdks = True # Determine if KDKs should be nuked if unused in /L*/D*/KDKs - self.has_checked_updates = False # Determine if check for updates has been run + ## Internal settings + self.allow_oc_everywhere: bool = False # Set whether Patcher can be run on unsupported Macs + self.gui_mode: bool = False # Determine whether running in a GUI or TUI + self.cli_mode: bool = False # Determine if running in CLI mode + self.validate: bool = False # Enable validation testing for CI + self.recovery_status: bool = False # Detect if booted into RecoveryOS + self.ignore_updates: bool = False # Ignore OCLP updates + self.wxpython_variant: bool = False # Determine if using wxPython variant + self.has_checked_updates: bool = False # Determine if check for updates has been run + self.root_patcher_succeeded: bool = False # Determine if root patcher succeeded + self.start_build_install: bool = False # Determine if build install should be started + self.host_is_non_metal: bool = False # Determine if host is non-metal (ie. enable UI hacks) + self.needs_to_open_preferences: bool = False # Determine if preferences need to be opened + self.host_is_hackintosh: bool = False # Determine if host is Hackintosh + self.should_nuke_kdks: bool = True # Determine if KDKs should be nuked if unused in /L*/D*/KDKs + self.launcher_binary: str = None # Determine launch binary path (ie. Python vs PyInstaller) + self.launcher_script: str = None # Determine launch file path (None if PyInstaller) + self.booted_oc_disk: str = None # Determine current disk OCLP booted from + self.unpack_thread = None # Determine if unpack thread finished (threading.Thread) + + self.commit_info: tuple = (None, None, None) # Commit info (Branch, Commit Date, Commit URL) ## Hardware self.computer: device_probe.Computer = None # type: ignore - self.custom_model: Optional[str] = None + self.custom_model: Optional[str] = None ## OpenCore Settings - self.opencore_debug = False - self.opencore_build = "RELEASE" - self.showpicker = True # Show or Hide OpenCore's Boot Picker - self.boot_efi = False # Use EFI/BOOT/BOOTx64.efi bootstrap - self.nvram_write = True # Write to hardware NVRAM + self.opencore_debug: bool = False # Enable OpenCore debug + self.boot_efi: bool = False # Use EFI/BOOT/BOOTx64.efi vs boot.efi bootstrap + self.showpicker: bool = True # Show or Hide OpenCore's Boot Picker + self.nvram_write: bool = True # Write to hardware NVRAM + self.oc_timeout: int = 5 # Set OpenCore timeout + self.opencore_build: str = "RELEASE" ## Kext Settings - self.kext_debug = False # Enables Lilu debug and DebugEnhancer - self.kext_variant = "RELEASE" + self.kext_debug: bool = False # Enables Lilu debug and DebugEnhancer + self.kext_variant: str = "RELEASE" ## NVRAM Settings - self.verbose_debug = False # -v + self.verbose_debug: bool = False # -v ## SMBIOS Settings - self.custom_cpu_model = 2 # Patch type value - self.custom_cpu_model_value = "" # New CPU name within About This Mac - self.serial_settings = "None" # Set SMBIOS level used - self.override_smbios = "Default" # Set SMBIOS model used - self.allow_native_spoofs = False # Allow native models to recieve spoofs - self.custom_serial_number = "" # Set SMBIOS serial number - self.custom_board_serial_number = "" # Set SMBIOS board serial number + self.serial_settings: str = "None" # Set SMBIOS level used + self.override_smbios: str = "Default" # Set SMBIOS model used + self.allow_native_spoofs: bool = False # Allow native models to recieve spoofs + + ### RestrictEvents CPU renaming + self.custom_cpu_model: int = 2 # Patch type value + self.custom_cpu_model_value: str = "" # New CPU name within About This Mac + + ### Serial Number Overrides + self.custom_serial_number: str = "" # Set SMBIOS serial number + self.custom_board_serial_number: str = "" # Set SMBIOS board serial number ## FeatureUnlock Settings - self.fu_status = True # Enable FeatureUnlock - self.fu_arguments = None # Set FeatureUnlock arguments + self.fu_status: bool = True # Enable FeatureUnlock + self.fu_arguments: str = None # Set FeatureUnlock arguments ## Security Settings - self.apecid_support = False # ApECID - self.sip_status = True # System Integrity Protection - self.secure_status = False # Secure Boot Model - self.vault = False # EFI Vault - self.disable_cs_lv = False # Disable Library validation - self.disable_amfi = False # Disable AMFI + self.sip_status: bool = True # System Integrity Protection + self.secure_status: bool = False # Secure Boot Model + self.vault: bool = False # EFI Vault + self.disable_cs_lv: bool = False # Disable Library validation + self.disable_amfi: bool = False # Disable AMFI ## OS Settings - self.os_support = 12.0 - self.detected_os = 0 # Major Kernel Version - self.detected_os_minor = 0 # Minor Kernel Version - self.detected_os_build = "" # OS Build - self.detected_os_version = "" # OS Version + self.os_support: float = 12.0 + self.detected_os: int = 0 # Major Kernel Version + self.detected_os_minor: int = 0 # Minor Kernel Version + self.detected_os_build: str = "" # OS Build + self.detected_os_version: str = "" # OS Version ## Boot Volume Settings - self.firewire_boot = False # Allow macOS FireWire Boot - self.nvme_boot = False # Allow UEFI NVMe Boot - self.xhci_boot = False + self.firewire_boot: bool = False # Allow macOS FireWire Boot (kernel) + self.nvme_boot: bool = False # Allow UEFI NVMe Boot + self.xhci_boot: bool = False # Allow UEFI XHCI Boot ## Graphics Settings - self.metal_build = False # Set MXM Build support - self.imac_vendor = "None" # Set MXM GPU vendor - self.imac_model = "" # Set MXM GPU model - self.drm_support = False # Set iMac14,x DRM support - self.allow_ts2_accel = True # Set TeraScale 2 Acceleration support - self.force_nv_web = False # Force Nvidia Web Drivers on Tesla and Kepler - self.force_output_support = False # Force Output support for Mac Pros with PC VBIOS - self.amd_gop_injection = False # Set GOP Injection support - self.nvidia_kepler_gop_injection = False # Set Kepler GOP Injection support + self.allow_ts2_accel: bool = True # Set TeraScale 2 Acceleration support + self.drm_support: bool = False # Set iMac14,x DRM support + self.force_nv_web: bool = False # Force Nvidia Web Drivers on Tesla and Kepler + self.force_output_support: bool = False # Force Output support for Mac Pros with PC VBIOS + self.amd_gop_injection: bool = False # Set GOP Injection support + self.nvidia_kepler_gop_injection: bool = False # Set Kepler GOP Injection support - ## Miscellaneous - self.disallow_cpufriend = False # Disable CPUFriend - self.enable_wake_on_wlan = False # Allow Wake on WLAN for modern Broadcom - self.disable_tb = False # Disable Thunderbolt Controller - self.set_alc_usage = True # Set AppleALC usage - self.dGPU_switch = False # Set Display GPU Switching for Windows - self.force_surplus = False # Force SurPlus patch in newer OSes - self.force_latest_psp = False # Force latest PatcherSupportPkg - self.disable_msr_power_ctl = False # Disable MSR Power Control (missing battery throttling) - self.software_demux = False # Enable Software Demux patch set - self.force_vmm = False # Force VMM patch - self.custom_sip_value = None # Set custom SIP value - self.walkthrough = False # Enable Walkthrough - self.disable_connectdrivers = False # Disable ConnectDrivers (hibernation) - self.allow_3rd_party_drives = True # Allow ThridPartyDrives quirk - self.set_content_caching = False # Set Content Caching - self.allow_nvme_fixing = True # Allow NVMe Kernel Space Patches - self.disable_xcpm = False # Disable XCPM (X86PlatformPlugin.kext) - self.root_patcher_succeeded = False # Determine if root patcher succeeded - self.booted_oc_disk = None # Determine current disk OCLP booted from - self.start_build_install = False # Determine if build install should be started - self.host_is_non_metal = False # Determine if host is non-metal (ie. enable UI hacks) - self.needs_to_open_preferences = False # Determine if preferences need to be opened - self.host_is_hackintosh = False # Determine if host is Hackintosh - self.commit_info = (None, None, None) - self.set_vmm_cpuid = False # Set VMM bit inside CPUID - self.oc_timeout = 5 # Set OpenCore timeout - self.apfs_trim_timeout = True # Set APFS Trim timeout + ### MXM GPU Support + self.metal_build: bool = False # Set MXM Build support + self.imac_vendor: str = "None" # Set MXM GPU vendor + self.imac_model: str = "" # Set MXM GPU model + ## Miscellaneous build settings + self.disallow_cpufriend: bool = False # Disable CPUFriend + self.enable_wake_on_wlan: bool = False # Allow Wake on WLAN for modern Broadcom + self.disable_tb: bool = False # Disable Thunderbolt Controller + self.dGPU_switch: bool = False # Set Display GPU Switching for Windows + self.force_surplus: bool = False # Force SurPlus patch in newer OSes + self.force_latest_psp: bool = False # Force latest PatcherSupportPkg + self.disable_msr_power_ctl: bool = False # Disable MSR Power Control (missing battery throttling) + self.software_demux: bool = False # Enable Software Demux patch set + self.force_vmm: bool = False # Force VMM patch + self.disable_connectdrivers: bool = False # Disable ConnectDrivers (hibernation) + self.set_content_caching: bool = False # Set Content Caching + self.disable_xcpm: bool = False # Disable XCPM (X86PlatformPlugin.kext) + self.set_vmm_cpuid: bool = False # Set VMM bit inside CPUID + self.set_alc_usage: bool = True # Set AppleALC usage + self.allow_3rd_party_drives: bool = True # Allow ThridPartyDrives quirk + self.allow_nvme_fixing: bool = True # Allow NVMe Kernel Space Patches + self.apfs_trim_timeout: bool = True # Set APFS Trim timeout + self.custom_sip_value: int = None # Set custom SIP value + + ## Non-Metal OS support self.legacy_accel_support = [ os_data.os_data.big_sur, os_data.os_data.monterey,