diff --git a/CHANGELOG.md b/CHANGELOG.md index 665ace602..ff15c08fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # OpenCore Legacy Patcher changelog +## 0.6.3 +- Update non-Metal Binaries: + - Resolves Safari 16.4 rendering issue + - Resolves left side menubar selections + - Implements automatic menubar text color + - New Menubar implementation can be disabled via `defaults write -g Amy.MenuBar2Beta -bool false` +- Implement full IOUSBHostFamily downgrade for UHCI/OHCI + - Resolves panics on certain iMac models +- Resolve unused KDKs not being properly cleaned up +- Increment Binaries: + - PatcherSupportPkg 0.9.2 - release + ## 0.6.2 - Work around Black Box rendering issues on certain Display Color Profiles - Limited to Ventura currently due to limitations with other color profiles @@ -19,14 +31,21 @@ - Fixed System Settings hover effects, including Bluetooth connect button - Add Books hacks (reimplement cover image generation, disable broken page curl animation) - Fixed unresponsive buttons -- Implement Hardware Encoding support for AMD Polaris and Vega GPUs +- Implement Hardware Encoding support for AMD GCN 1-3, Polaris and Vega GPUs - Applicable for pre-Haswell Macs on macOS Ventura - Resolves DRM playback issues on Netflix, Disney+, etc. + - Note: GCN 1-3 DRM is functional, however hardware video encoding is still experimental + - AppleTV+ may be unstable due to this - Implement support for AMD Navi and Lexa MXM GPUs in 2009-2011 iMacs - Primarily applicable for MXM 3.0 variants of AMD WX3200 (0x6981) and AMD RX5500XT (0x7340) - Credit to [Ausdauersportler](https://github.com/Ausdauersportler) for implementation - Implement Continuity Camera Unlocking for pre-Kaby Lake CPUs - Applicable for all legacy Macs in macOS Ventura +- Resolve boot support for 3802-based GPUs with macOS 13.3 + - Applicable for following GPUs: + - Intel Ivy Bridge and Haswell iGPUs + - Nvidia Kepler dGPUs + - Note: patchset now requires AMFI to be disabled, patchset still in active development to remove this requirement - Backend Changes: - Refactored kdk_handler.py - Prioritizes KdkSupportPkg repository for downloads @@ -34,7 +53,7 @@ - Support local loose matching when no network connection is available - Implement pkg receipt verification to validate integrity of KDKs - Implemented logging framework usage for more reliable logging - - Logs are stored under `~/OpenCore-Patcher.log` + - Logs are stored under `~/Library/Logs/OpenCore-Patcher.log` - Subsequent runs are appended to the log, allowing for easy debugging - Implemented new network_handler.py module - Allows for more reliable network calls and downloads @@ -54,9 +73,14 @@ - pyinstaller - 5.7.0 - packaging - 23.0 - Increment Binaries: - - PatcherSupportPkg 0.8.4 - release + - PatcherSupportPkg 0.8.7 - release - AutoPkgInstaller 1.0.2 - release - FeatureUnlock 1.1.4 - rolling (0e8d87f) + - Lilu 1.6.4 - release + - WhateverGreen 1.6.4 - release + - NVMeFix 1.1.0 - release + - Innie 1.3.1 - release + - OpenCorePkg 0.9.0 - release ## 0.6.1 - Avoid usage of KDKlessWorkaround on hardware not requiring it diff --git a/data/sys_patch_dict.py b/data/sys_patch_dict.py index 6fbe699c0..19b0bd323 100644 --- a/data/sys_patch_dict.py +++ b/data/sys_patch_dict.py @@ -1,1134 +1,1177 @@ # Dictionary defining patch sets used during Root Volume patching (sys_patch.py) -# Copyright (C) 2022, Mykola Grymalyuk - -# Schema for sys_patch_dict.py: -# Supports 6 types of higher level keys: -# - OS Support: Supported OSes by patches - Dictionary of Min/Max Kernel Major and Minor versions -# - Install: Install to root volume - Dictionary of strings with string value of source -# - Install Non-Root: Install to data partition - Dictionary of strings with string value of source -# - Remove: Files to remove - Array of strings -# - Processes: Additional processes to run - Dictionary of strings with boolean value of requires root -# - Display Name: User-friendly name - String - -# File Storage is based off the origin, ie. '10.13.6/System/Library/Extensions/IOSurface.kext' -# Stubbed binaries are OS specific, they use the 'os_major' variable to denounce which folder to use +# Copyright (C) 2022-2023, Mykola Grymalyuk from data import os_data -def SystemPatchDictionary(os_major, os_minor, non_metal_os_support): - # @os_major: XNU Kernel Major (int) - # @os_minor: XNU Kernel Minor (int) - # @non_metal_os_support: Array of supported OSes (XNU Kernel Majors (int)) - sys_patch_dict = { - "Graphics": { - "Non-Metal Common": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": non_metal_os_support[0], - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": non_metal_os_support[-1], - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "IOSurface.kext": "10.15.7", - }, - "/System/Library/Frameworks": { - "OpenGL.framework": "10.14.3", - "CoreDisplay.framework": f"10.14.4-{os_major}", - "IOSurface.framework": f"10.15.7-{os_major}", - "QuartzCore.framework": f"10.15.7-{os_major}", - }, - "/System/Library/PrivateFrameworks": { - "GPUSupport.framework": "10.14.3", - "SkyLight.framework": f"10.14.6-{os_major}", - }, - }, - "Remove": { - "/System/Library/Extensions": [ - "AMDRadeonX4000.kext", - "AMDRadeonX4000HWServices.kext", - "AMDRadeonX5000.kext", - "AMDRadeonX5000HWServices.kext", - "AMDRadeonX6000.kext", - "AMDRadeonX6000Framebuffer.kext", - "AMDRadeonX6000HWServices.kext", - "AppleIntelBDWGraphics.kext", - "AppleIntelBDWGraphicsFramebuffer.kext", - "AppleIntelCFLGraphicsFramebuffer.kext", - "AppleIntelHD4000Graphics.kext", - "AppleIntelHD5000Graphics.kext", - "AppleIntelICLGraphics.kext", - "AppleIntelICLLPGraphicsFramebuffer.kext", - "AppleIntelKBLGraphics.kext", - "AppleIntelKBLGraphicsFramebuffer.kext", - "AppleIntelSKLGraphics.kext", - "AppleIntelSKLGraphicsFramebuffer.kext", - "AppleIntelFramebufferAzul.kext", - "AppleIntelFramebufferCapri.kext", - "AppleParavirtGPU.kext", - "GeForce.kext", - "IOAcceleratorFamily2.kext", - "IOGPUFamily.kext", - "AppleAfterburner.kext", - ], - }, - "Install Non-Root": { - "/Library/Application Support/SkyLightPlugins": { - **({ "DropboxHack.dylib": "SkyLightPlugins" } if os_major >= os_data.os_data.monterey else {}), - **({ "DropboxHack.txt": "SkyLightPlugins" } if os_major >= os_data.os_data.monterey else {}), - }, - }, - "Processes": { - # 'When Space Allows' option introduced in 12.4 (XNU 21.5) - **({"defaults write /Library/Preferences/.GlobalPreferences.plist ShowDate -int 1": True } if os_data.os_conversion.is_os_newer(os_data.os_data.monterey, 4, os_major, os_minor) else {}), - "defaults write /Library/Preferences/.GlobalPreferences.plist InternalDebugUseGPUProcessForCanvasRenderingEnabled -bool false": True, - }, - }, - "Non-Metal IOAccelerator Common": { - # TeraScale 2 and Nvidia Web Drivers broke in Mojave due to mismatched structs in - # the IOAccelerator stack - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": non_metal_os_support[0], - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": non_metal_os_support[-1], - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "IOAcceleratorFamily2.kext": "10.13.6", - "IOSurface.kext": "10.14.6", - }, - "/System/Library/Frameworks": { - "IOSurface.framework": f"10.14.6-{os_major}", - "OpenCL.framework": "10.13.6", - }, - "/System/Library/PrivateFrameworks": { - "GPUSupport.framework": "10.13.6", - "IOAccelerator.framework": f"10.13.6-{os_major}", - }, - }, - "Remove": { - "/System/Library/Extensions": [ - "AppleCameraInterface.kext" - ], - }, - }, - "Non-Metal CoreDisplay Common": { - # Nvidia Web Drivers require an older build of CoreDisplay - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": non_metal_os_support[0], - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": non_metal_os_support[-1], - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Frameworks": { - "CoreDisplay.framework": f"10.13.6-{os_major}", - }, - }, - }, +class SystemPatchDictionary(): + """ + Library for generating patch sets for sys_patch.py and supporting modules - "Non-Metal Enforcement": { - # Forces Metal kexts from High Sierra to run in the fallback non-Metal mode - # Verified functional with HD4000 and Iris Plus 655 - # Only used for internal development purposes, not suitable for end users + Usage: + >>> patchsets = SystemPatchDictionary(22, 0, [20, 21, 22]).patchset_dict - # Note: Metal kexts in High Sierra rely on IOAccelerator, thus 'Non-Metal IOAccelerator Common' - # is needed for proper linking - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": non_metal_os_support[0], - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": non_metal_os_support[-1], - "OS Minor": 99 - }, - }, - "Processes": { - "defaults write /Library/Preferences/com.apple.CoreDisplay useMetal -boolean no": True, - "defaults write /Library/Preferences/com.apple.CoreDisplay useIOP -boolean no": True, - }, - }, - "Non-Metal ColorSync Workaround": { - # HD3000 Macs have issues with certain ColorProfiles - # This downgrade allows for proper UI rendering, - # however limited to Ventura due to regression with Big Sur and Monterey - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": non_metal_os_support[-1], - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Frameworks": { - "ColorSync.framework": f"10.15.7-{os_major}", - }, - }, - }, + Patchset Schema: + Supports 6 types of higher level keys: + - OS Support: Supported OSes by patches + - Minimum OS Support: Minimum supported OS version + - OS Major: Major XNU Kernel version + - OS Minor: Minor XNU Kernel version + - Maximum OS Support: Maximum supported OS version + - OS Major: Major XNU Kernel version + - OS Minor: Minor XNU Kernel version + - Install: Files to install to root volume + - Location: + - File (dict: { "File": "Source" }) + - Install Non-Root: Files to install to data partition + - Location: + - File (dict: { "File": "Source" }) + - Remove: Files to remove + - Location: + - File (array: [ "File" ]) + - Processes: Additional processes to run + - Process (dict: { "Process": "Requires Root" }) + - Display Name: User-friendly name (string, "" if user-friendly name is not required) - # AMD GCN and Nvidia Kepler require Metal Downgrade in Ventura - # The patches are required due to struct issues in the Metal stack - # - AMD GCN will break on BronzeMtlDevice - # - See Nvidia Kepler patchset for more info - "Metal Common": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Frameworks": { - "Metal.framework": "12.5", - "MetalPerformanceShaders.framework": "12.5", - }, - }, - }, - # Temporary work-around for Kepler GPUs on Ventura - # We removed the reliance on Metal.framework downgrade, however the new Kepler - # patchset breaks with the old Metal. Thus we need to ensure stock variant is used - # Remove this when OCLP is merged onto mainline - "Revert Metal Downgrade": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 99 - }, - }, - "Remove": { - "/System/Library/Frameworks/Metal.framework/Versions/A/": [ - "Metal", - "MetalOld.dylib", - ], - "/System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSCore.framework/Versions/A": [ - "MPSCore", - ], - }, - }, + Schema file storage is based off the origin, ie. '10.13.6/System/Library/Extensions/IOSurface.kext': - # Monterey has a WebKit sandboxing issue where many UI elements fail to render - # This patch simple replaces the sandbox profile with one supporting our GPUs - # Note: Neither Big Sur nor Ventura have this issue - "WebKit Monterey Common": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.monterey, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.monterey, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Frameworks": { - "WebKit.framework": "11.6" - }, - }, - "Install Non-Root": { - "/Library/Apple/System/Library/StagedFrameworks/Safari": { - "WebKit.framework": "11.6" - }, - }, - }, - - # Intel Ivy Bridge, Haswell and Nvidia Kepler are Metal 3802-based GPUs - # Due to this, we need to re-add 3802 compiler support to the Metal stack - "Metal 3802 Common": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Frameworks": { - "Metal.framework": "12.5-3802", - }, - "/System/Library/PrivateFrameworks": { - "MTLCompiler.framework": "12.5-3802", - "GPUCompiler.framework": "12.5-3802", - }, - "/System/Library/Sandbox/Profiles": { - "com.apple.mtlcompilerservice.sb": "12.5-3802", - } - }, - }, - - # Support for 3802 GPUs were broken with 13.3+ - # Downgrades 31001 stack to 13.2.1, however nukes AMFI support - # Extremely fugly, only for reference purposes at this time - "Metal 3802 Common Extended": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 4 # 13.3 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install Reference": { - "/System/Library/Frameworks": { - "Metal.framework": "13.2.1", - }, - "/System/Library/PrivateFrameworks": { - "MTLCompiler.framework": "13.2.1", - "GPUCompiler.framework": "13.2.1", - }, - }, - }, - - # Primarily for AMD GCN GPUs - "Revert GVA Downgrade": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Remove": { - "/System/Library/PrivateFrameworks/AppleGVA.framework/Versions/A/": [ - "AppleGVA", - ], - "/System/Library/PrivateFrameworks/AppleGVACore.framework/Versions/A/": [ - "AppleGVACore", - ], - }, - }, - - # For GPUs last natively supported in Catalina/Big Sur - # Restores DRM support - "Catalina GVA": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.monterey, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/PrivateFrameworks": { - "AppleGVA.framework": "10.15.7", - "AppleGVACore.framework": "10.15.7", - }, - }, - }, - - # For GPUs last natively supported in Monterey - # Restores DRM support - "Monterey GVA": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/PrivateFrameworks": { - "AppleGVA.framework": "12.5", - "AppleGVACore.framework": "12.5", - }, - }, - }, - - "High Sierra GVA": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": non_metal_os_support[0], - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/PrivateFrameworks": { - "AppleGVA.framework": "10.13.6", - "AppleGVACore.framework": "10.15.7", - }, - }, - }, - - "Big Sur OpenCL": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.monterey, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Frameworks": { - "OpenCL.framework": "11.6", - }, - }, - }, - - "Monterey OpenCL": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Frameworks": { - "OpenCL.framework": "12.5", - }, - }, - }, - - # In Ventura, Apple added AVX2.0 code to AMD's OpenCL/GL compilers - "AMD OpenCL": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Frameworks": { - "OpenCL.framework": "12.5 non-AVX2.0", - "OpenGL.framework": "12.5 non-AVX2.0", - }, - }, - }, - - "Nvidia Tesla": { - "Display Name": "Graphics: Nvidia Tesla", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.mojave, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "GeForceGA.bundle": "10.13.6", - "GeForceTesla.kext": "10.13.6", - "GeForceTeslaGLDriver.bundle": "10.13.6", - "GeForceTeslaVADriver.bundle": "10.13.6", - "NVDANV50HalTesla.kext": "10.13.6", - "NVDAResmanTesla.kext": "10.13.6", - # Apple dropped NVDAStartup in 12.0 Beta 7 (XNU 21.1) - **({ "NVDAStartup.kext": "12.0 Beta 6" } if os_data.os_conversion.is_os_newer(os_data.os_data.monterey, 0, os_major, os_minor) else {}) - }, - }, - }, - "Nvidia Kepler": { - "Display Name": "Graphics: Nvidia Kepler", - "OS Support": { - "Minimum OS Support": { - # 12.0 beta 7 (XNU 21.1) - "OS Major": os_data.os_data.monterey, - "OS Minor": 1 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "GeForce.kext": "12.0 Beta 6", - "NVDAGF100Hal.kext": "12.0 Beta 6", - "NVDAGK100Hal.kext": "12.0 Beta 6", - "NVDAResman.kext": "12.0 Beta 6", - "NVDAStartup.kext": "12.0 Beta 6", - "GeForceAIRPlugin.bundle": "11.0 Beta 3", - "GeForceGLDriver.bundle": "11.0 Beta 3", - "GeForceMTLDriver.bundle": "11.0 Beta 3" if os_major <= os_data.os_data.monterey else f"11.0 Beta 3-{os_major}", - "GeForceVADriver.bundle": "12.0 Beta 6", - }, - "/System/Library/Frameworks": { - # XNU 21.6 (macOS 12.5) - **({ "Metal.framework": "12.5 Beta 2"} if (os_data.os_conversion.is_os_newer(os_data.os_data.monterey, 5, os_major, os_minor) and os_major < os_data.os_data.ventura) else {}), - }, - "/System/Library/PrivateFrameworks": { - "GPUCompiler.framework": "11.6", - }, - }, - }, - "Nvidia Web Drivers": { - "Display Name": "Graphics: Nvidia Web Drivers", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.mojave, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "GeForceAIRPluginWeb.bundle": "WebDriver-387.10.10.10.40.140", - "GeForceGLDriverWeb.bundle": "WebDriver-387.10.10.10.40.140", - "GeForceMTLDriverWeb.bundle": "WebDriver-387.10.10.10.40.140", - "GeForceVADriverWeb.bundle": "WebDriver-387.10.10.10.40.140", - - # Tesla-only files - "GeForceTeslaGAWeb.bundle": "WebDriver-387.10.10.10.40.140", - "GeForceTeslaGLDriverWeb.bundle": "WebDriver-387.10.10.10.40.140", - "GeForceTeslaVADriverWeb.bundle": "WebDriver-387.10.10.10.40.140", - }, - }, - "Install Non-Root": { - "/Library/Extensions": { - "GeForceWeb.kext": "WebDriver-387.10.10.10.40.140", - "NVDAGF100HalWeb.kext": "WebDriver-387.10.10.10.40.140", - "NVDAGK100HalWeb.kext": "WebDriver-387.10.10.10.40.140", - "NVDAGM100HalWeb.kext": "WebDriver-387.10.10.10.40.140", - "NVDAGP100HalWeb.kext": "WebDriver-387.10.10.10.40.140", - "NVDAResmanWeb.kext": "WebDriver-387.10.10.10.40.140", - "NVDAStartupWeb.kext": "WebDriver-387.10.10.10.40.140", - - # Tesla-only files - "GeForceTeslaWeb.kext": "WebDriver-387.10.10.10.40.140", - "NVDANV50HalTeslaWeb.kext": "WebDriver-387.10.10.10.40.140", - "NVDAResmanTeslaWeb.kext": "WebDriver-387.10.10.10.40.140", - }, - - # Disabled due to issues with Pref pane stripping 'nvda_drv' NVRAM - # variables - # "/Library/PreferencePanes": { - # "NVIDIA Driver Manager.prefPane": "WebDriver-387.10.10.10.40.140", - # }, - # "/Library/LaunchAgents": { - # "com.nvidia.nvagent.plist": "WebDriver-387.10.10.10.40.140", - # }, - # "/Library/LaunchDaemons": { - # "com.nvidia.nvroothelper.plist": "WebDriver-387.10.10.10.40.140", - # }, - }, - "Remove": { - "/System/Library/Extensions": [ - # Due to how late the Auxiliary cache loads, NVDAStartup will match first and then the Web Driver kexts. - # This has no effect for Maxwell and Pascal, however for development purposes, Tesla and Kepler are partially supported. - "NVDAStartup.kext", - ], - }, - }, - "AMD TeraScale Common": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.mojave, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AMDFramebuffer.kext": "10.13.6", - "AMDLegacyFramebuffer.kext": "10.13.6", - "AMDLegacySupport.kext": "10.13.6", - "AMDShared.bundle": "10.13.6", - "AMDSupport.kext": "10.13.6", - }, - }, - "Remove": { - "/System/Library/Extensions": [ - "AMD7000Controller.kext", - "AMD8000Controller.kext", - "AMD9000Controller.kext", - "AMD9500Controller.kext", - "AMD10000Controller.kext", - ], - }, - }, - - "AMD TeraScale 1": { - "Display Name": "Graphics: AMD TeraScale 1", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.mojave, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AMD2400Controller.kext": "10.13.6", - "AMD2600Controller.kext": "10.13.6", - "AMD3800Controller.kext": "10.13.6", - "AMD4600Controller.kext": "10.13.6", - "AMD4800Controller.kext": "10.13.6", - "ATIRadeonX2000.kext": "10.13.6", - "ATIRadeonX2000GA.plugin": "10.13.6", - "ATIRadeonX2000GLDriver.bundle": "10.13.6", - "ATIRadeonX2000VADriver.bundle": "10.13.6", - }, - }, - "Remove": { - "/System/Library/Extensions": [ - # Following removals are a work around for 0.4.3 and older root patches - # Previously TS1 and TS2 patch sets were shared, now they're split off - # Due to this, updating to 0.4.4 or newer can break kmutil linking - "AMD5000Controller.kext", - "AMD6000Controller.kext", - "AMDRadeonVADriver.bundle", - "AMDRadeonVADriver2.bundle", - "AMDRadeonX3000.kext", - "AMDRadeonX3000GLDriver.bundle", - ], - }, - }, - "AMD TeraScale 2": { - "Display Name": "Graphics: AMD TeraScale 2", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.mojave, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AMD5000Controller.kext": "10.13.6", - "AMD6000Controller.kext": "10.13.6", - "AMDRadeonVADriver.bundle": "10.13.6", - "AMDRadeonVADriver2.bundle": "10.13.6", - "AMDRadeonX3000.kext": "10.13.6", - "AMDRadeonX3000GLDriver.bundle": "10.13.6", - }, - }, - }, - "AMD Legacy GCN": { - "Display Name": "Graphics: AMD Legacy GCN", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AMD7000Controller.kext": "12.5", - "AMD8000Controller.kext": "12.5", - "AMD9000Controller.kext": "12.5", - "AMD9500Controller.kext": "12.5", - "AMD10000Controller.kext": "12.5", - "AMDRadeonX4000.kext": "12.5", - "AMDRadeonX4000HWServices.kext": "12.5", - "AMDFramebuffer.kext": "12.5", - "AMDSupport.kext": "12.5", - - "AMDRadeonVADriver.bundle": "12.5", - "AMDRadeonVADriver2.bundle": "12.5", - "AMDRadeonX4000GLDriver.bundle": "12.5", - "AMDMTLBronzeDriver.bundle": "12.5", - "AMDShared.bundle": "12.5", - }, - }, - }, - # Used only for AMD Polaris with host lacking AVX2.0 - # Note missing framebuffers are not restored (ex. 'ATY,Berbice') - "AMD Legacy Polaris": { - "Display Name": "Graphics: AMD Legacy Polaris", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AMDRadeonX4000.kext": "12.5", - "AMDRadeonX4000HWServices.kext": "12.5", - - "AMDRadeonVADriver2.bundle": "12.5", - "AMDRadeonX4000GLDriver.bundle": "12.5", - "AMDMTLBronzeDriver.bundle": "12.5", - "AMDShared.bundle": "12.5", - }, - }, - }, - "AMD Legacy Vega": { - "Display Name": "Graphics: AMD Legacy Vega", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AMDRadeonX5000.kext": "12.5", - "AMDRadeonX5000HWServices.kext": "12.5", - - "AMDRadeonVADriver2.bundle": "12.5", - "AMDRadeonX5000GLDriver.bundle": "12.5", - "AMDRadeonX5000MTLDriver.bundle": "12.5", - "AMDRadeonX5000Shared.bundle": "12.5", - - "AMDShared.bundle": "12.5", - }, - }, - }, - # Support mixed legacy and modern AMD GPUs - # Specifically systems using AMD GCN 1-3 and Vega (ex. MacPro6,1 with eGPU) - # Assume 'AMD Legacy GCN' patchset is installed alongside this - "AMD Legacy Vega Extended": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AMDRadeonX5000HWServices.kext": "12.5", - }, - }, - }, - "Intel Ironlake": { - "Display Name": "Graphics: Intel Ironlake", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.mojave, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AppleIntelHDGraphics.kext": "10.13.6", - "AppleIntelHDGraphicsFB.kext": "10.13.6", - "AppleIntelHDGraphicsGA.plugin": "10.13.6", - "AppleIntelHDGraphicsGLDriver.bundle": "10.13.6", - "AppleIntelHDGraphicsVADriver.bundle": "10.13.6", - }, - }, - }, - "Intel Sandy Bridge": { - "Display Name": "Graphics: Intel Sandy Bridge", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.mojave, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AppleIntelHD3000Graphics.kext": "10.13.6", - "AppleIntelHD3000GraphicsGA.plugin": "10.13.6", - "AppleIntelHD3000GraphicsGLDriver.bundle": "10.13.6", - "AppleIntelHD3000GraphicsVADriver.bundle": "10.13.6", - "AppleIntelSNBGraphicsFB.kext": "10.13.6", - "AppleIntelSNBVA.bundle": "10.13.6", - }, - }, - }, - "Intel Ivy Bridge": { - "Display Name": "Graphics: Intel Ivy Bridge", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.monterey, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AppleIntelHD4000GraphicsGLDriver.bundle": "11.0 Beta 6", - "AppleIntelHD4000GraphicsMTLDriver.bundle": "11.0 Beta 6", - "AppleIntelHD4000GraphicsVADriver.bundle": "11.3 Beta 1", - "AppleIntelFramebufferCapri.kext": "11.4", - "AppleIntelHD4000Graphics.kext": "11.4", - "AppleIntelIVBVA.bundle": "11.4", - "AppleIntelGraphicsShared.bundle": "11.4", # libIGIL-Metal.dylib pulled from 11.0 Beta 6 - }, - }, - }, - "Intel Haswell": { - "Display Name": "Graphics: Intel Haswell", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AppleIntelFramebufferAzul.kext": "12.5", - "AppleIntelHD5000Graphics.kext": "12.5", - "AppleIntelHD5000GraphicsGLDriver.bundle": "12.5", - "AppleIntelHD5000GraphicsMTLDriver.bundle": "12.5", - "AppleIntelHD5000GraphicsVADriver.bundle": "12.5", - "AppleIntelHSWVA.bundle": "12.5", - "AppleIntelGraphicsShared.bundle": "12.5", - }, - }, - }, - "Intel Broadwell": { - "Display Name": "Graphics: Intel Broadwell", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AppleIntelBDWGraphics.kext": "12.5", - "AppleIntelBDWGraphicsFramebuffer.kext": "12.5", - "AppleIntelBDWGraphicsGLDriver.bundle": "12.5", - "AppleIntelBDWGraphicsMTLDriver.bundle": "12.5", - "AppleIntelBDWGraphicsVADriver.bundle": "12.5", - "AppleIntelBDWGraphicsVAME.bundle": "12.5", - "AppleIntelGraphicsShared.bundle": "12.5", - }, - }, - }, - "Intel Skylake": { - "Display Name": "Graphics: Intel Skylake", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AppleIntelSKLGraphics.kext": "12.5", - "AppleIntelSKLGraphicsFramebuffer.kext": "12.5", - "AppleIntelSKLGraphicsGLDriver.bundle": "12.5", - "AppleIntelSKLGraphicsMTLDriver.bundle": "12.5", - "AppleIntelSKLGraphicsVADriver.bundle": "12.5", - "AppleIntelSKLGraphicsVAME.bundle": "12.5", - "AppleIntelGraphicsShared.bundle": "12.5", - }, - }, + "Install": { + "/System/Library/Extensions": { + "IOSurface.kext": "10.13.6", }, }, - "Audio": { - "Legacy Realtek": { - "Display Name": "Audio: Legacy Realtek", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.sierra, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - # For iMac7,1 and iMac8,1 units with legacy Realtek HD Audio - "Install": { - "/System/Library/Extensions": { - "AppleHDA.kext": "10.11.6", - "IOAudioFamily.kext": "10.11.6", - }, - }, - "Remove": { - "/System/Library/Extensions": [ - "AppleVirtIO.kext", - "AppleVirtualGraphics.kext", - "AppleVirtualPlatform.kext", - "ApplePVPanic.kext", - "AppleVirtIOStorage.kext", - ], - }, - }, - # For Mac Pros with non-UGA/GOP GPUs - "Legacy Non-GOP": { - "Display Name": "Audio: Legacy non-GOP", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.mojave, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AppleHDA.kext": "10.13.6", - }, - }, - }, - }, - "Networking": { - "Legacy Wireless": { - "Display Name": "Networking: Legacy Wireless", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.monterey, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/usr/libexec": { - "airportd": "11.7.1", - }, - "/System/Library/CoreServices": { - "WiFiAgent.app": "11.7.1", - }, - }, - "Install Non-Root": { - "/Library/Application Support/SkyLightPlugins": { - **({ "CoreWLAN.dylib": "SkyLightPlugins" } if os_major == os_data.os_data.monterey else {}), - **({ "CoreWLAN.txt": "SkyLightPlugins" } if os_major == os_data.os_data.monterey else {}), - }, - }, - }, - "Legacy Wireless Extended": { - "Display Name": "", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/usr/libexec": { - "wps": "12.6.2", - }, - "/System/Library/Frameworks": { - "CoreWLAN.framework": "12.6.2", - }, - "/System/Library/PrivateFrameworks": { - "CoreWiFi.framework": "12.6.2", - "IO80211.framework": "12.6.2", - }, - }, - } - }, - "Brightness": { - "Legacy Backlight Control": { - "Display Name": "Brightness: Legacy Backlight Control", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.high_sierra, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions": { - "AppleBacklight.kext": "10.12.6", - "AppleBacklightExpert.kext": "10.12.6", - }, - "/System/Library/PrivateFrameworks": { - "DisplayServices.framework": "10.12.6", - }, - }, - "Remove": { - "/System/Library/Extensions/AppleGraphicsControl.kext/Contents/PlugIns": [ - "AGDCBacklightControl.kext", - ], - }, - }, - }, - "Miscellaneous": { - "Legacy GMUX": { - "Display Name": "Miscellaneous: Legacy GMUX", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.high_sierra, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions/AppleGraphicsControl.kext/Contents/PlugIns": { - "AppleMuxControl.kext": "10.12.6", - }, - }, - "Remove": { - "/System/Library/Extensions": [ - "AppleBacklight.kext", - ], - "/System/Library/Extensions/AppleGraphicsControl.kext/Contents/PlugIns": [ - "AGDCBacklightControl.kext", - "AppleMuxControl.kext", - ], - }, - }, - "Legacy Keyboard Backlight": { - "Display Name": "Miscellaneous: Legacy Keyboard Backlight", - "OS Support": { - "Minimum OS Support": { - "OS Major": non_metal_os_support[0], - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": non_metal_os_support[-1], - "OS Minor": 99 - }, - }, - "Processes": { - "defaults write /Library/Preferences/.GlobalPreferences.plist Moraea_BacklightHack -bool true": True, - }, - }, - "Legacy USB 1.1": { - "Display Name": "Miscellaneous: Legacy USB 1.1", - "OS Support": { - "Minimum OS Support": { - "OS Major": os_data.os_data.ventura, - "OS Minor": 0 - }, - "Maximum OS Support": { - "OS Major": os_data.os_data.max_os, - "OS Minor": 99 - }, - }, - "Install": { - "/System/Library/Extensions/IOUSBHostFamily.kext/Contents/MacOS": { - "IOUSBHostFamily": "12.6.2", - }, - "/System/Library/Extensions/IOUSBHostFamily.kext/Contents/PlugIns": { - "AppleUSBEHCI.kext": "12.6.2", - "AppleUSBHub.kext": "12.6.2", - }, - }, - } - }, - } - return sys_patch_dict \ No newline at end of file + Note: Stubbed binaries are OS specific, thus use the 'self.os_major' variable to denounce which folder variant to use + """ + + def __init__(self, os_major: int, os_minor: int, non_metal_os_support: list) -> None: + """ + Parameters: + os_major (int): Major XNU Kernel version + os_minor (int): Minor XNU Kernel version + non_metal_os_support (list): List of supported non-metal OSes (XNU Major Versions) + + 'non_metal_os_support' is assumed to be sorted from oldest to newest + """ + + self.os_major: int = os_major + self.os_minor: int = os_minor + self.non_metal_os_support: list = non_metal_os_support + self.patchset_dict: dict = {} + + self._generate_sys_patch_dict() + + + def _generate_sys_patch_dict(self): + """ + Generates the sys_patch_dict dictionary + """ + + self.patchset_dict = { + "Graphics": { + "Non-Metal Common": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": self.non_metal_os_support[0], + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": self.non_metal_os_support[-1], + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "IOSurface.kext": "10.15.7", + }, + "/System/Library/Frameworks": { + "OpenGL.framework": "10.14.3", + "CoreDisplay.framework": f"10.14.4-{self.os_major}", + "IOSurface.framework": f"10.15.7-{self.os_major}", + "QuartzCore.framework": f"10.15.7-{self.os_major}", + }, + "/System/Library/PrivateFrameworks": { + "GPUSupport.framework": "10.14.3", + "SkyLight.framework": f"10.14.6-{self.os_major}", + }, + }, + "Remove": { + "/System/Library/Extensions": [ + "AMDRadeonX4000.kext", + "AMDRadeonX4000HWServices.kext", + "AMDRadeonX5000.kext", + "AMDRadeonX5000HWServices.kext", + "AMDRadeonX6000.kext", + "AMDRadeonX6000Framebuffer.kext", + "AMDRadeonX6000HWServices.kext", + "AppleIntelBDWGraphics.kext", + "AppleIntelBDWGraphicsFramebuffer.kext", + "AppleIntelCFLGraphicsFramebuffer.kext", + "AppleIntelHD4000Graphics.kext", + "AppleIntelHD5000Graphics.kext", + "AppleIntelICLGraphics.kext", + "AppleIntelICLLPGraphicsFramebuffer.kext", + "AppleIntelKBLGraphics.kext", + "AppleIntelKBLGraphicsFramebuffer.kext", + "AppleIntelSKLGraphics.kext", + "AppleIntelSKLGraphicsFramebuffer.kext", + "AppleIntelFramebufferAzul.kext", + "AppleIntelFramebufferCapri.kext", + "AppleParavirtGPU.kext", + "GeForce.kext", + "IOAcceleratorFamily2.kext", + "IOGPUFamily.kext", + "AppleAfterburner.kext", + ], + }, + "Install Non-Root": { + "/Library/Application Support/SkyLightPlugins": { + **({ "DropboxHack.dylib": "SkyLightPlugins" } if self.os_major >= os_data.os_data.monterey else {}), + **({ "DropboxHack.txt": "SkyLightPlugins" } if self.os_major >= os_data.os_data.monterey else {}), + }, + }, + "Processes": { + # 'When Space Allows' option introduced in 12.4 (XNU 21.5) + **({"defaults write /Library/Preferences/.GlobalPreferences.plist ShowDate -int 1": True } if os_data.os_conversion.is_os_newer(os_data.os_data.monterey, 4, self.os_major, self.os_minor) else {}), + "defaults write /Library/Preferences/.GlobalPreferences.plist InternalDebugUseGPUProcessForCanvasRenderingEnabled -bool false": True, + }, + }, + "Non-Metal IOAccelerator Common": { + # TeraScale 2 and Nvidia Web Drivers broke in Mojave due to mismatched structs in + # the IOAccelerator stack + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": self.non_metal_os_support[0], + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": self.non_metal_os_support[-1], + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "IOAcceleratorFamily2.kext": "10.13.6", + "IOSurface.kext": "10.14.6", + }, + "/System/Library/Frameworks": { + "IOSurface.framework": f"10.14.6-{self.os_major}", + "OpenCL.framework": "10.13.6", + }, + "/System/Library/PrivateFrameworks": { + "GPUSupport.framework": "10.13.6", + "IOAccelerator.framework": f"10.13.6-{self.os_major}", + }, + }, + "Remove": { + "/System/Library/Extensions": [ + "AppleCameraInterface.kext" + ], + }, + }, + + "Non-Metal CoreDisplay Common": { + # Nvidia Web Drivers require an older build of CoreDisplay + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": self.non_metal_os_support[0], + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": self.non_metal_os_support[-1], + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Frameworks": { + "CoreDisplay.framework": f"10.13.6-{self.os_major}", + }, + }, + }, + + "Non-Metal Enforcement": { + # Forces Metal kexts from High Sierra to run in the fallback non-Metal mode + # Verified functional with HD4000 and Iris Plus 655 + # Only used for internal development purposes, not suitable for end users + + # Note: Metal kexts in High Sierra rely on IOAccelerator, thus 'Non-Metal IOAccelerator Common' + # is needed for proper linking + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": self.non_metal_os_support[0], + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": self.non_metal_os_support[-1], + "OS Minor": 99 + }, + }, + "Processes": { + "defaults write /Library/Preferences/com.apple.CoreDisplay useMetal -boolean no": True, + "defaults write /Library/Preferences/com.apple.CoreDisplay useIOP -boolean no": True, + }, + }, + + "Non-Metal ColorSync Workaround": { + # HD3000 Macs have issues with certain ColorProfiles + # This downgrade allows for proper UI rendering, + # however limited to Ventura due to regression with Big Sur and Monterey + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": self.non_metal_os_support[-1], + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Frameworks": { + "ColorSync.framework": f"10.15.7-{self.os_major}", + }, + }, + }, + + # AMD GCN and Nvidia Kepler require Metal Downgrade in Ventura + # The patches are required due to struct issues in the Metal stack + # - AMD GCN will break on BronzeMtlDevice + # - See Nvidia Kepler patchset for more info + "Metal Common": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Frameworks": { + "Metal.framework": "12.5", + "MetalPerformanceShaders.framework": "12.5", + }, + }, + }, + + # Temporary work-around for Kepler GPUs on Ventura + # We removed the reliance on Metal.framework downgrade, however the new Kepler + # patchset breaks with the old Metal. Thus we need to ensure stock variant is used + # Remove this when OCLP is merged onto mainline + "Revert Metal Downgrade": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 99 + }, + }, + "Remove": { + "/System/Library/Frameworks/Metal.framework/Versions/A/": [ + "Metal", + "MetalOld.dylib", + ], + "/System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSCore.framework/Versions/A": [ + "MPSCore", + ], + }, + }, + + # Monterey has a WebKit sandboxing issue where many UI elements fail to render + # This patch simple replaces the sandbox profile with one supporting our GPUs + # Note: Neither Big Sur nor Ventura have this issue + "WebKit Monterey Common": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.monterey, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.monterey, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Frameworks": { + "WebKit.framework": "11.6" + }, + }, + "Install Non-Root": { + "/Library/Apple/System/Library/StagedFrameworks/Safari": { + "WebKit.framework": "11.6" + }, + }, + }, + + # Intel Ivy Bridge, Haswell and Nvidia Kepler are Metal 3802-based GPUs + # Due to this, we need to re-add 3802 compiler support to the Metal stack + "Metal 3802 Common": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Frameworks": { + "Metal.framework": "12.5-3802", + }, + "/System/Library/PrivateFrameworks": { + "MTLCompiler.framework": "12.5-3802", + "GPUCompiler.framework": "12.5-3802", + }, + "/System/Library/Sandbox/Profiles": { + "com.apple.mtlcompilerservice.sb": "12.5-3802", + } + }, + }, + + # Support for 3802 GPUs were broken with 13.3+ + # Downgrades 31001 stack to 13.2.1, however nukes AMFI support + "Metal 3802 Common Extended": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 4 # 13.3 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Frameworks": { + "Metal.framework": "13.2.1", + }, + "/System/Library/PrivateFrameworks": { + "MTLCompiler.framework": "13.2.1", + "GPUCompiler.framework": "13.2.1", + }, + }, + }, + + # Primarily for AMD GCN GPUs + "Revert GVA Downgrade": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Remove": { + "/System/Library/PrivateFrameworks/AppleGVA.framework/Versions/A/": [ + "AppleGVA", + ], + "/System/Library/PrivateFrameworks/AppleGVACore.framework/Versions/A/": [ + "AppleGVACore", + ], + }, + }, + + # For GPUs last natively supported in Catalina/Big Sur + # Restores DRM support + "Catalina GVA": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.monterey, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/PrivateFrameworks": { + "AppleGVA.framework": "10.15.7", + "AppleGVACore.framework": "10.15.7", + }, + }, + }, + + # For GPUs last natively supported in Monterey + # Restores DRM support + "Monterey GVA": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/PrivateFrameworks": { + "AppleGVA.framework": "12.5", + "AppleGVACore.framework": "12.5", + }, + }, + }, + + "High Sierra GVA": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": self.non_metal_os_support[0], + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/PrivateFrameworks": { + "AppleGVA.framework": "10.13.6", + "AppleGVACore.framework": "10.15.7", + }, + }, + }, + + "Big Sur OpenCL": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.monterey, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Frameworks": { + "OpenCL.framework": "11.6", + }, + }, + }, + + "Monterey OpenCL": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Frameworks": { + "OpenCL.framework": "12.5", + }, + }, + }, + + # In Ventura, Apple added AVX2.0 code to AMD's OpenCL/GL compilers + "AMD OpenCL": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Frameworks": { + "OpenCL.framework": "12.5 non-AVX2.0", + "OpenGL.framework": "12.5 non-AVX2.0", + }, + }, + }, + + "Nvidia Tesla": { + "Display Name": "Graphics: Nvidia Tesla", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.mojave, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "GeForceGA.bundle": "10.13.6", + "GeForceTesla.kext": "10.13.6", + "GeForceTeslaGLDriver.bundle": "10.13.6", + "GeForceTeslaVADriver.bundle": "10.13.6", + "NVDANV50HalTesla.kext": "10.13.6", + "NVDAResmanTesla.kext": "10.13.6", + # Apple dropped NVDAStartup in 12.0 Beta 7 (XNU 21.1) + **({ "NVDAStartup.kext": "12.0 Beta 6" } if os_data.os_conversion.is_os_newer(os_data.os_data.monterey, 0, self.os_major, self.os_minor) else {}) + }, + }, + }, + "Nvidia Kepler": { + "Display Name": "Graphics: Nvidia Kepler", + "OS Support": { + "Minimum OS Support": { + # 12.0 beta 7 (XNU 21.1) + "OS Major": os_data.os_data.monterey, + "OS Minor": 1 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "GeForce.kext": "12.0 Beta 6", + "NVDAGF100Hal.kext": "12.0 Beta 6", + "NVDAGK100Hal.kext": "12.0 Beta 6", + "NVDAResman.kext": "12.0 Beta 6", + "NVDAStartup.kext": "12.0 Beta 6", + "GeForceAIRPlugin.bundle": "11.0 Beta 3", + "GeForceGLDriver.bundle": "11.0 Beta 3", + "GeForceMTLDriver.bundle": "11.0 Beta 3" if self.os_major <= os_data.os_data.monterey else f"11.0 Beta 3-{self.os_major}", + "GeForceVADriver.bundle": "12.0 Beta 6", + }, + "/System/Library/Frameworks": { + # XNU 21.6 (macOS 12.5) + **({ "Metal.framework": "12.5 Beta 2"} if (os_data.os_conversion.is_os_newer(os_data.os_data.monterey, 5, self.os_major, self.os_minor) and self.os_major < os_data.os_data.ventura) else {}), + }, + "/System/Library/PrivateFrameworks": { + "GPUCompiler.framework": "11.6", + }, + }, + }, + "Nvidia Web Drivers": { + "Display Name": "Graphics: Nvidia Web Drivers", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.mojave, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "GeForceAIRPluginWeb.bundle": "WebDriver-387.10.10.10.40.140", + "GeForceGLDriverWeb.bundle": "WebDriver-387.10.10.10.40.140", + "GeForceMTLDriverWeb.bundle": "WebDriver-387.10.10.10.40.140", + "GeForceVADriverWeb.bundle": "WebDriver-387.10.10.10.40.140", + + # Tesla-only files + "GeForceTeslaGAWeb.bundle": "WebDriver-387.10.10.10.40.140", + "GeForceTeslaGLDriverWeb.bundle": "WebDriver-387.10.10.10.40.140", + "GeForceTeslaVADriverWeb.bundle": "WebDriver-387.10.10.10.40.140", + }, + }, + "Install Non-Root": { + "/Library/Extensions": { + "GeForceWeb.kext": "WebDriver-387.10.10.10.40.140", + "NVDAGF100HalWeb.kext": "WebDriver-387.10.10.10.40.140", + "NVDAGK100HalWeb.kext": "WebDriver-387.10.10.10.40.140", + "NVDAGM100HalWeb.kext": "WebDriver-387.10.10.10.40.140", + "NVDAGP100HalWeb.kext": "WebDriver-387.10.10.10.40.140", + "NVDAResmanWeb.kext": "WebDriver-387.10.10.10.40.140", + "NVDAStartupWeb.kext": "WebDriver-387.10.10.10.40.140", + + # Tesla-only files + "GeForceTeslaWeb.kext": "WebDriver-387.10.10.10.40.140", + "NVDANV50HalTeslaWeb.kext": "WebDriver-387.10.10.10.40.140", + "NVDAResmanTeslaWeb.kext": "WebDriver-387.10.10.10.40.140", + }, + + # Disabled due to issues with Pref pane stripping 'nvda_drv' NVRAM + # variables + # "/Library/PreferencePanes": { + # "NVIDIA Driver Manager.prefPane": "WebDriver-387.10.10.10.40.140", + # }, + # "/Library/LaunchAgents": { + # "com.nvidia.nvagent.plist": "WebDriver-387.10.10.10.40.140", + # }, + # "/Library/LaunchDaemons": { + # "com.nvidia.nvroothelper.plist": "WebDriver-387.10.10.10.40.140", + # }, + }, + "Remove": { + "/System/Library/Extensions": [ + # Due to how late the Auxiliary cache loads, NVDAStartup will match first and then the Web Driver kexts. + # This has no effect for Maxwell and Pascal, however for development purposes, Tesla and Kepler are partially supported. + "NVDAStartup.kext", + ], + }, + }, + "AMD TeraScale Common": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.mojave, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AMDFramebuffer.kext": "10.13.6", + "AMDLegacyFramebuffer.kext": "10.13.6", + "AMDLegacySupport.kext": "10.13.6", + "AMDShared.bundle": "10.13.6", + "AMDSupport.kext": "10.13.6", + }, + }, + "Remove": { + "/System/Library/Extensions": [ + "AMD7000Controller.kext", + "AMD8000Controller.kext", + "AMD9000Controller.kext", + "AMD9500Controller.kext", + "AMD10000Controller.kext", + ], + }, + }, + + "AMD TeraScale 1": { + "Display Name": "Graphics: AMD TeraScale 1", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.mojave, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AMD2400Controller.kext": "10.13.6", + "AMD2600Controller.kext": "10.13.6", + "AMD3800Controller.kext": "10.13.6", + "AMD4600Controller.kext": "10.13.6", + "AMD4800Controller.kext": "10.13.6", + "ATIRadeonX2000.kext": "10.13.6", + "ATIRadeonX2000GA.plugin": "10.13.6", + "ATIRadeonX2000GLDriver.bundle": "10.13.6", + "ATIRadeonX2000VADriver.bundle": "10.13.6", + }, + }, + "Remove": { + "/System/Library/Extensions": [ + # Following removals are a work around for 0.4.3 and older root patches + # Previously TS1 and TS2 patch sets were shared, now they're split off + # Due to this, updating to 0.4.4 or newer can break kmutil linking + "AMD5000Controller.kext", + "AMD6000Controller.kext", + "AMDRadeonVADriver.bundle", + "AMDRadeonVADriver2.bundle", + "AMDRadeonX3000.kext", + "AMDRadeonX3000GLDriver.bundle", + ], + }, + }, + "AMD TeraScale 2": { + "Display Name": "Graphics: AMD TeraScale 2", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.mojave, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AMD5000Controller.kext": "10.13.6", + "AMD6000Controller.kext": "10.13.6", + "AMDRadeonVADriver.bundle": "10.13.6", + "AMDRadeonVADriver2.bundle": "10.13.6", + "AMDRadeonX3000.kext": "10.13.6", + "AMDRadeonX3000GLDriver.bundle": "10.13.6", + }, + }, + }, + "AMD Legacy GCN": { + "Display Name": "Graphics: AMD Legacy GCN", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AMD7000Controller.kext": "12.5", + "AMD8000Controller.kext": "12.5", + "AMD9000Controller.kext": "12.5", + "AMD9500Controller.kext": "12.5", + "AMD10000Controller.kext": "12.5", + "AMDRadeonX4000.kext": "12.5", + "AMDRadeonX4000HWServices.kext": "12.5", + "AMDFramebuffer.kext": "12.5", + "AMDSupport.kext": "12.5", + + "AMDRadeonVADriver.bundle": "12.5", + "AMDRadeonVADriver2.bundle": "12.5", + "AMDRadeonX4000GLDriver.bundle": "12.5", + "AMDMTLBronzeDriver.bundle": "12.5", + "AMDShared.bundle": "12.5", + }, + }, + }, + # Used only for AMD Polaris with host lacking AVX2.0 + # Note missing framebuffers are not restored (ex. 'ATY,Berbice') + "AMD Legacy Polaris": { + "Display Name": "Graphics: AMD Legacy Polaris", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AMDRadeonX4000.kext": "12.5", + "AMDRadeonX4000HWServices.kext": "12.5", + + "AMDRadeonVADriver2.bundle": "12.5", + "AMDRadeonX4000GLDriver.bundle": "12.5", + "AMDMTLBronzeDriver.bundle": "12.5", + "AMDShared.bundle": "12.5", + }, + }, + }, + "AMD Legacy Vega": { + "Display Name": "Graphics: AMD Legacy Vega", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AMDRadeonX5000.kext": "12.5", + "AMDRadeonX5000HWServices.kext": "12.5", + + "AMDRadeonVADriver2.bundle": "12.5", + "AMDRadeonX5000GLDriver.bundle": "12.5", + "AMDRadeonX5000MTLDriver.bundle": "12.5", + "AMDRadeonX5000Shared.bundle": "12.5", + + "AMDShared.bundle": "12.5", + }, + }, + }, + # Support mixed legacy and modern AMD GPUs + # Specifically systems using AMD GCN 1-3 and Vega (ex. MacPro6,1 with eGPU) + # Assume 'AMD Legacy GCN' patchset is installed alongside this + "AMD Legacy Vega Extended": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AMDRadeonX5000HWServices.kext": "12.5", + }, + }, + }, + "Intel Ironlake": { + "Display Name": "Graphics: Intel Ironlake", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.mojave, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AppleIntelHDGraphics.kext": "10.13.6", + "AppleIntelHDGraphicsFB.kext": "10.13.6", + "AppleIntelHDGraphicsGA.plugin": "10.13.6", + "AppleIntelHDGraphicsGLDriver.bundle": "10.13.6", + "AppleIntelHDGraphicsVADriver.bundle": "10.13.6", + }, + }, + }, + "Intel Sandy Bridge": { + "Display Name": "Graphics: Intel Sandy Bridge", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.mojave, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AppleIntelHD3000Graphics.kext": "10.13.6", + "AppleIntelHD3000GraphicsGA.plugin": "10.13.6", + "AppleIntelHD3000GraphicsGLDriver.bundle": "10.13.6", + "AppleIntelHD3000GraphicsVADriver.bundle": "10.13.6", + "AppleIntelSNBGraphicsFB.kext": "10.13.6", + "AppleIntelSNBVA.bundle": "10.13.6", + }, + }, + }, + "Intel Ivy Bridge": { + "Display Name": "Graphics: Intel Ivy Bridge", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.monterey, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AppleIntelHD4000GraphicsGLDriver.bundle": "11.0 Beta 6", + "AppleIntelHD4000GraphicsMTLDriver.bundle": "11.0 Beta 6", + "AppleIntelHD4000GraphicsVADriver.bundle": "11.3 Beta 1", + "AppleIntelFramebufferCapri.kext": "11.4", + "AppleIntelHD4000Graphics.kext": "11.4", + "AppleIntelIVBVA.bundle": "11.4", + "AppleIntelGraphicsShared.bundle": "11.4", # libIGIL-Metal.dylib pulled from 11.0 Beta 6 + }, + }, + }, + "Intel Haswell": { + "Display Name": "Graphics: Intel Haswell", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AppleIntelFramebufferAzul.kext": "12.5", + "AppleIntelHD5000Graphics.kext": "12.5", + "AppleIntelHD5000GraphicsGLDriver.bundle": "12.5", + "AppleIntelHD5000GraphicsMTLDriver.bundle": "12.5", + "AppleIntelHD5000GraphicsVADriver.bundle": "12.5", + "AppleIntelHSWVA.bundle": "12.5", + "AppleIntelGraphicsShared.bundle": "12.5", + }, + }, + }, + "Intel Broadwell": { + "Display Name": "Graphics: Intel Broadwell", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AppleIntelBDWGraphics.kext": "12.5", + "AppleIntelBDWGraphicsFramebuffer.kext": "12.5", + "AppleIntelBDWGraphicsGLDriver.bundle": "12.5", + "AppleIntelBDWGraphicsMTLDriver.bundle": "12.5", + "AppleIntelBDWGraphicsVADriver.bundle": "12.5", + "AppleIntelBDWGraphicsVAME.bundle": "12.5", + "AppleIntelGraphicsShared.bundle": "12.5", + }, + }, + }, + "Intel Skylake": { + "Display Name": "Graphics: Intel Skylake", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AppleIntelSKLGraphics.kext": "12.5", + "AppleIntelSKLGraphicsFramebuffer.kext": "12.5", + "AppleIntelSKLGraphicsGLDriver.bundle": "12.5", + "AppleIntelSKLGraphicsMTLDriver.bundle": "12.5", + "AppleIntelSKLGraphicsVADriver.bundle": "12.5", + "AppleIntelSKLGraphicsVAME.bundle": "12.5", + "AppleIntelGraphicsShared.bundle": "12.5", + }, + }, + }, + }, + "Audio": { + "Legacy Realtek": { + "Display Name": "Audio: Legacy Realtek", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.sierra, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + # For iMac7,1 and iMac8,1 units with legacy Realtek HD Audio + "Install": { + "/System/Library/Extensions": { + "AppleHDA.kext": "10.11.6", + "IOAudioFamily.kext": "10.11.6", + }, + }, + "Remove": { + "/System/Library/Extensions": [ + "AppleVirtIO.kext", + "AppleVirtualGraphics.kext", + "AppleVirtualPlatform.kext", + "ApplePVPanic.kext", + "AppleVirtIOStorage.kext", + ], + }, + }, + # For Mac Pros with non-UGA/GOP GPUs + "Legacy Non-GOP": { + "Display Name": "Audio: Legacy non-GOP", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.mojave, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AppleHDA.kext": "10.13.6", + }, + }, + }, + }, + "Networking": { + "Legacy Wireless": { + "Display Name": "Networking: Legacy Wireless", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.monterey, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/usr/libexec": { + "airportd": "11.7.1", + }, + "/System/Library/CoreServices": { + "WiFiAgent.app": "11.7.1", + }, + }, + "Install Non-Root": { + "/Library/Application Support/SkyLightPlugins": { + **({ "CoreWLAN.dylib": "SkyLightPlugins" } if self.os_major == os_data.os_data.monterey else {}), + **({ "CoreWLAN.txt": "SkyLightPlugins" } if self.os_major == os_data.os_data.monterey else {}), + }, + }, + }, + "Legacy Wireless Extended": { + "Display Name": "", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/usr/libexec": { + "wps": "12.6.2", + }, + "/System/Library/Frameworks": { + "CoreWLAN.framework": "12.6.2", + }, + "/System/Library/PrivateFrameworks": { + "CoreWiFi.framework": "12.6.2", + "IO80211.framework": "12.6.2", + }, + }, + } + }, + "Brightness": { + "Legacy Backlight Control": { + "Display Name": "Brightness: Legacy Backlight Control", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.high_sierra, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "AppleBacklight.kext": "10.12.6", + "AppleBacklightExpert.kext": "10.12.6", + }, + "/System/Library/PrivateFrameworks": { + "DisplayServices.framework": "10.12.6", + }, + }, + "Remove": { + "/System/Library/Extensions/AppleGraphicsControl.kext/Contents/PlugIns": [ + "AGDCBacklightControl.kext", + ], + }, + }, + }, + "Miscellaneous": { + "Legacy GMUX": { + "Display Name": "Miscellaneous: Legacy GMUX", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.high_sierra, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions/AppleGraphicsControl.kext/Contents/PlugIns": { + "AppleMuxControl.kext": "10.12.6", + }, + }, + "Remove": { + "/System/Library/Extensions": [ + "AppleBacklight.kext", + ], + "/System/Library/Extensions/AppleGraphicsControl.kext/Contents/PlugIns": [ + "AGDCBacklightControl.kext", + "AppleMuxControl.kext", + ], + }, + }, + "Legacy Keyboard Backlight": { + "Display Name": "Miscellaneous: Legacy Keyboard Backlight", + "OS Support": { + "Minimum OS Support": { + "OS Major": self.non_metal_os_support[0], + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": self.non_metal_os_support[-1], + "OS Minor": 99 + }, + }, + "Processes": { + "defaults write /Library/Preferences/.GlobalPreferences.plist Moraea_BacklightHack -bool true": True, + }, + }, + "Legacy USB 1.1": { + "Display Name": "Miscellaneous: Legacy USB 1.1", + "OS Support": { + "Minimum OS Support": { + "OS Major": os_data.os_data.ventura, + "OS Minor": 0 + }, + "Maximum OS Support": { + "OS Major": os_data.os_data.max_os, + "OS Minor": 99 + }, + }, + "Install": { + "/System/Library/Extensions": { + "IOUSBHostFamily.kext": "12.6.2", + }, + }, + } + }, + } \ No newline at end of file diff --git a/payloads/Config/config.plist b/payloads/Config/config.plist index 83d2492e8..02961b234 100644 --- a/payloads/Config/config.plist +++ b/payloads/Config/config.plist @@ -2699,6 +2699,8 @@ ResizeGpuBars -1 + ResizeUsePciRbIo + TscSyncTimeout 0 UnblockFsConnect diff --git a/payloads/Kexts/Acidanthera/Lilu-v1.6.3-DEBUG.zip b/payloads/Kexts/Acidanthera/Lilu-v1.6.3-DEBUG.zip deleted file mode 100644 index 679473f99..000000000 Binary files a/payloads/Kexts/Acidanthera/Lilu-v1.6.3-DEBUG.zip and /dev/null differ diff --git a/payloads/Kexts/Acidanthera/Lilu-v1.6.3-RELEASE.zip b/payloads/Kexts/Acidanthera/Lilu-v1.6.3-RELEASE.zip deleted file mode 100644 index abe140083..000000000 Binary files a/payloads/Kexts/Acidanthera/Lilu-v1.6.3-RELEASE.zip and /dev/null differ diff --git a/payloads/Kexts/Acidanthera/Lilu-v1.6.4-DEBUG.zip b/payloads/Kexts/Acidanthera/Lilu-v1.6.4-DEBUG.zip new file mode 100644 index 000000000..b17fb932b Binary files /dev/null and b/payloads/Kexts/Acidanthera/Lilu-v1.6.4-DEBUG.zip differ diff --git a/payloads/Kexts/Acidanthera/Lilu-v1.6.4-RELEASE.zip b/payloads/Kexts/Acidanthera/Lilu-v1.6.4-RELEASE.zip new file mode 100644 index 000000000..999bcfca3 Binary files /dev/null and b/payloads/Kexts/Acidanthera/Lilu-v1.6.4-RELEASE.zip differ diff --git a/payloads/Kexts/Acidanthera/NVMeFix-v1.0.9-DEBUG.zip b/payloads/Kexts/Acidanthera/NVMeFix-v1.0.9-DEBUG.zip deleted file mode 100644 index a2d32449e..000000000 Binary files a/payloads/Kexts/Acidanthera/NVMeFix-v1.0.9-DEBUG.zip and /dev/null differ diff --git a/payloads/Kexts/Acidanthera/NVMeFix-v1.0.9-RELEASE.zip b/payloads/Kexts/Acidanthera/NVMeFix-v1.0.9-RELEASE.zip deleted file mode 100644 index 62ce4d810..000000000 Binary files a/payloads/Kexts/Acidanthera/NVMeFix-v1.0.9-RELEASE.zip and /dev/null differ diff --git a/payloads/Kexts/Acidanthera/NVMeFix-v1.1.0-DEBUG.zip b/payloads/Kexts/Acidanthera/NVMeFix-v1.1.0-DEBUG.zip new file mode 100644 index 000000000..195833373 Binary files /dev/null and b/payloads/Kexts/Acidanthera/NVMeFix-v1.1.0-DEBUG.zip differ diff --git a/payloads/Kexts/Acidanthera/NVMeFix-v1.1.0-RELEASE.zip b/payloads/Kexts/Acidanthera/NVMeFix-v1.1.0-RELEASE.zip new file mode 100644 index 000000000..8a9036fdc Binary files /dev/null and b/payloads/Kexts/Acidanthera/NVMeFix-v1.1.0-RELEASE.zip differ diff --git a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.3-DEBUG.zip b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.3-DEBUG.zip deleted file mode 100644 index 119cbbdb3..000000000 Binary files a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.3-DEBUG.zip and /dev/null differ diff --git a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.3-Navi-DEBUG.zip b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.3-Navi-DEBUG.zip deleted file mode 100644 index 07daec46b..000000000 Binary files a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.3-Navi-DEBUG.zip and /dev/null differ diff --git a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.3-Navi-RELEASE.zip b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.3-Navi-RELEASE.zip deleted file mode 100644 index ae8345e90..000000000 Binary files a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.3-Navi-RELEASE.zip and /dev/null differ diff --git a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.3-RELEASE.zip b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.3-RELEASE.zip deleted file mode 100644 index 1c15022d6..000000000 Binary files a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.3-RELEASE.zip and /dev/null differ diff --git a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-DEBUG.zip b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-DEBUG.zip new file mode 100644 index 000000000..e00ce8c6c Binary files /dev/null and b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-DEBUG.zip differ diff --git a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-Navi-DEBUG.zip b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-Navi-DEBUG.zip new file mode 100644 index 000000000..86249d2b4 Binary files /dev/null and b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-Navi-DEBUG.zip differ diff --git a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-Navi-RELEASE.zip b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-Navi-RELEASE.zip new file mode 100644 index 000000000..0192af4d8 Binary files /dev/null and b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-Navi-RELEASE.zip differ diff --git a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-RELEASE.zip b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-RELEASE.zip new file mode 100644 index 000000000..1d3a4d01e Binary files /dev/null and b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-RELEASE.zip differ diff --git a/payloads/Kexts/Misc/Innie-v1.3.0.zip b/payloads/Kexts/Misc/Innie-v1.3.0.zip deleted file mode 100644 index c7699d31b..000000000 Binary files a/payloads/Kexts/Misc/Innie-v1.3.0.zip and /dev/null differ diff --git a/payloads/Kexts/Misc/Innie-v1.3.1-DEBUG.zip b/payloads/Kexts/Misc/Innie-v1.3.1-DEBUG.zip new file mode 100644 index 000000000..22db43e08 Binary files /dev/null and b/payloads/Kexts/Misc/Innie-v1.3.1-DEBUG.zip differ diff --git a/payloads/Kexts/Misc/Innie-v1.3.1-RELEASE.zip b/payloads/Kexts/Misc/Innie-v1.3.1-RELEASE.zip new file mode 100644 index 000000000..def7110a3 Binary files /dev/null and b/payloads/Kexts/Misc/Innie-v1.3.1-RELEASE.zip differ diff --git a/payloads/Kexts/Update-Kexts.command b/payloads/Kexts/Update-Kexts.command new file mode 100755 index 000000000..55bc00161 --- /dev/null +++ b/payloads/Kexts/Update-Kexts.command @@ -0,0 +1,253 @@ +#!/usr/bin/env python3 + +import os +import subprocess +from pathlib import Path +import requests +import packaging.version +import tempfile + + +# For kexts with basic handling requirements +KEXT_DICTIONARY = { + + "Acidanthera": { + "AirportBrcmFixup": { + "Repository": "https://github.com/acidanthera/AirportBrcmFixup", + "Constants Variable": "self.airportbcrmfixup_version", + }, + # Due to issues with legacy Macs, don't update + # "AppleALC": { + # "Repository": "https://github.com/acidanthera/AppleALC", + # "Constants Variable": "self.applealc_version", + # }, + "BlueToolFixup": { + "Repository": "https://github.com/acidanthera/BrcmPatchRAM", + "Constants Variable": "self.bluetoolfixup_version", + "Override": "BrcmPatchRAM", + }, + "CPUFriend": { + "Repository": "https://github.com/acidanthera/CPUFriend", + "Constants Variable": "self.cpufriend_version", + }, + "CryptexFixup": { + "Repository": "https://github.com/acidanthera/CryptexFixup", + "Constants Variable": "self.cryptexfixup_version", + }, + "DebugEnhancer": { + "Repository": "https://github.com/acidanthera/DebugEnhancer", + "Constants Variable": "self.debugenhancer_version", + }, + "FeatureUnlock": { + "Repository": "https://github.com/acidanthera/FeatureUnlock", + "Constants Variable": "self.featureunlock_version", + }, + "Lilu": { + "Repository": "https://github.com/acidanthera/Lilu", + "Constants Variable": "self.lilu_version", + }, + "NVMeFix": { + "Repository": "https://github.com/acidanthera/NVMeFix", + "Constants Variable": "self.nvmefix_version", + }, + "RestrictEvents": { + "Repository": "https://github.com/acidanthera/RestrictEvents", + "Constants Variable": "self.restrictevents_version", + }, + "RSRHelper": { + "Repository": "https://github.com/khronokernel/RSRHelper", + "Constants Variable": "self.rsrhelper_version", + }, + "WhateverGreen": { + "Repository": "https://github.com/acidanthera/WhateverGreen", + "Constants Variable": "self.whatevergreen_version", + }, + }, + + "Misc": { + "Innie": { + "Repository": "https://github.com/cdf/Innie", + "Constants Variable": "self.innie_version", + }, + }, +} + + + +class GenerateKexts: + + def __init__(self): + self.weg_version = None + self.weg_old = None + self.lilu_version = None + + self._set_cwd() + self._iterate_over_kexts() + self._special_kext_handling() + + + def _set_cwd(self): + # Set working directory to script location + script_path = Path(__file__).parent.absolute() + os.chdir(script_path) + + def _special_kext_handling(self): + # Generate custom WhateverGreen + if self.weg_version is None or self.lilu_version is None or self.weg_old is None: + raise Exception("Unable to find latest WEG version!") + + if packaging.version.parse(self.weg_version) <= packaging.version.parse(self.weg_old): + print(" WEG is up to date!") + return + + # WhateverGreen + print("Building modified WhateverGreen...") + # We have to compile WEG ourselves + weg_source_url = f"https://github.com/acidanthera/WhateverGreen/archive/refs/tags/{self.weg_version}.zip" + lilu_url = f"https://github.com/acidanthera/Lilu/releases/download/{self.lilu_version}/Lilu-{self.lilu_version}-DEBUG.zip" + with tempfile.TemporaryDirectory() as temp_dir: + # Download source + weg_source_zip = f"{temp_dir}/WhateverGreen-{self.weg_version}.zip" + subprocess.run(["curl", "-L", weg_source_url, "-o", weg_source_zip], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + + # Unzip source + subprocess.run(["unzip", weg_source_zip, "-d", temp_dir], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + + # Git clone MacKernelSDK into source + subprocess.run(["git", "clone", "https://github.com/acidanthera/MacKernelSDK", f"{temp_dir}/WhateverGreen-{self.weg_version}/MacKernelSDK"], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + + # Grab latest Lilu release, debug version + lilu_zip = f"{temp_dir}/Lilu-{self.lilu_version}-DEBUG.zip" + subprocess.run(["curl", "-L", lilu_url, "-o", lilu_zip], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + + # Unzip Lilu into WEG source + subprocess.run(["unzip", lilu_zip, "-d", f"{temp_dir}/WhateverGreen-{self.weg_version}"], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + + # Apply patch + patch_path = Path("./Acidanthera/WhateverGreen-Navi-Backlight.patch").absolute() + subprocess.run(["git", "apply", patch_path], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, cwd=f"{temp_dir}/WhateverGreen-{self.weg_version}") + + # Build WEG + for variant in ["Release", "Debug"]: + subprocess.run(["xcodebuild", "-configuration", variant], cwd=f"{temp_dir}/WhateverGreen-{self.weg_version}", check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + + + # Zip Release + for variant in ["RELEASE", "DEBUG"]: + dst_path = Path(f"./Acidanthera/WhateverGreen-v{self.weg_version}-Navi-{variant}.zip").absolute() + subprocess.run(["zip", "-r", dst_path, "WhateverGreen.kext"], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, cwd=f"{temp_dir}/WhateverGreen-{self.weg_version}/build/{'Release' if variant == 'RELEASE' else 'Debug'}") + if Path(f"./Acidanthera/WhateverGreen-v{self.weg_old}-Navi-{variant}.zip").exists(): + subprocess.run(["rm", f"./Acidanthera/WhateverGreen-v{self.weg_old}-Navi-{variant}.zip"], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + + self._update_constants_file("self.whatevergreen_navi_version", f"{self.weg_old}-Navi", f"{self.weg_version}-Navi") + + + def _iterate_over_kexts(self): + for kext_folder in KEXT_DICTIONARY: + for kext_name in KEXT_DICTIONARY[kext_folder]: + print(f"Checking {kext_name}...") + if "Override" in KEXT_DICTIONARY[kext_folder][kext_name]: + self._get_latest_release(kext_folder, kext_name, override_kext_zip_name=KEXT_DICTIONARY[kext_folder][kext_name]["Override"]) + else: + self._get_latest_release(kext_folder, kext_name) + + + def _get_latest_release(self, kext_folder, kext_name, override_kext_zip_name=None): + # Get latest release from GitHub API + repo_url = KEXT_DICTIONARY[kext_folder][kext_name]["Repository"].replace("https://github.com", "https://api.github.com/repos") + latest_release = requests.get(f"{repo_url}/releases/latest").json() + + for variant in ["RELEASE", "DEBUG"]: + + if "tag_name" not in latest_release: + print(f" Error: {latest_release['message']}") + continue + + remote_version = latest_release["tag_name"] + if remote_version.startswith("v"): + remote_version = remote_version[1:] + + if kext_name == "WhateverGreen": + self.weg_version = remote_version + elif kext_name == "Lilu": + self.lilu_version = remote_version + + local_version = self._get_local_version(kext_folder, kext_name, variant) + if kext_name == "WhateverGreen": + self.weg_old = local_version + + if packaging.version.parse(remote_version) <= packaging.version.parse(local_version): + print(f" {kext_name} {variant} is up to date: v{local_version}") + continue + + for asset in latest_release["assets"]: + if not asset["name"].endswith(f"{variant}.zip"): + continue + print(f" Downloading {kext_name} {variant}: v{remote_version}...") + zip_name = f"{override_kext_zip_name}-v{remote_version}-{variant}.zip" if override_kext_zip_name else f"{kext_name}-v{remote_version}-{variant}.zip" + + self._download_file(asset["browser_download_url"], f"./{kext_folder}/{zip_name}", f"{kext_name}.kext") + if Path(f"./{kext_folder}/{zip_name}").exists(): + subprocess.run(["rm", "-rf", f"./{kext_folder}/{zip_name.replace(f'v{remote_version}', f'v{local_version}')}"]) + self._update_constants_file(KEXT_DICTIONARY[kext_folder][kext_name]["Constants Variable"], local_version, remote_version) + + if override_kext_zip_name: + # rename zip file + os.rename(f"./{kext_folder}/{zip_name}", f"./{kext_folder}/{kext_name}-v{remote_version}-{variant}.zip") + subprocess.run(["rm", "-rf", f"./{kext_folder}/{kext_name}-v{local_version}-{variant}.zip"]) + + + def _get_local_version(self, kext_folder, kext_name, variant): + loose_name_start = f"{kext_name}-v" + loose_name_end = f"-{variant}.zip" + + for file in Path(f"./{kext_folder}").iterdir(): + if file.name.startswith(loose_name_start) and file.name.endswith(loose_name_end): + local_version = file.name.replace(loose_name_start, "").replace(loose_name_end, "") + if local_version.startswith("v"): + local_version = local_version[1:] + return local_version[:5] + + raise Exception(f"Could not find local version for {kext_name} {variant}") + + + def _download_file(self, url, file_path, file): + # Download file + if Path(file_path).exists(): + os.remove(file_path) + + with tempfile.TemporaryDirectory() as temp_dir: + download = requests.get(url) + with open(f"{temp_dir}/temp.zip", "wb") as f: + f.write(download.content) + + # Unzip file + subprocess.run(["unzip", "-q", f"{temp_dir}/temp.zip", "-d", f"{temp_dir}"], check=True) + + print(f" Moving {file} to {file_path}...") + # Zip file + subprocess.run(["zip", "-q", "-r", Path(file_path).name, file], cwd=f"{temp_dir}", check=True) + + # Move file + subprocess.run(["mv", f"{temp_dir}/{Path(file_path).name}", file_path], check=True) + + + def _update_constants_file(self, variable_name, old_version, new_version): + print(f" Updating {variable_name} to {new_version}...") + constants_file = Path("../../resources/constants.py") + if not constants_file.exists(): + raise Exception("Constants file does not exist") + constants_file_contents = constants_file.read_text() + + # Replace version + for line in constants_file_contents.splitlines(): + if variable_name in line: + constants_file_contents = constants_file_contents.replace(line, line.replace(old_version, new_version)) + break + + # Write file + constants_file.write_text(constants_file_contents) + + +if __name__ == '__main__': + GenerateKexts() \ No newline at end of file diff --git a/payloads/OpenCore/OpenCore-DEBUG.zip b/payloads/OpenCore/OpenCore-DEBUG.zip index af32f5132..d6a464672 100644 Binary files a/payloads/OpenCore/OpenCore-DEBUG.zip and b/payloads/OpenCore/OpenCore-DEBUG.zip differ diff --git a/payloads/OpenCore/OpenCore-RELEASE.zip b/payloads/OpenCore/OpenCore-RELEASE.zip index 0b6951b32..3518ebb64 100644 Binary files a/payloads/OpenCore/OpenCore-RELEASE.zip and b/payloads/OpenCore/OpenCore-RELEASE.zip differ diff --git a/payloads/OpenCore/generate.command b/payloads/OpenCore/Update-OpenCore.command similarity index 100% rename from payloads/OpenCore/generate.command rename to payloads/OpenCore/Update-OpenCore.command diff --git a/payloads/OpenCore/ocvalidate b/payloads/OpenCore/ocvalidate index 31aabf760..470852885 100755 Binary files a/payloads/OpenCore/ocvalidate and b/payloads/OpenCore/ocvalidate differ diff --git a/resources/amfi_detect.py b/resources/amfi_detect.py index 0e09fb80c..d57d593fb 100644 --- a/resources/amfi_detect.py +++ b/resources/amfi_detect.py @@ -28,7 +28,7 @@ class AmfiConfigurationDetection: """ - def __init__(self): + def __init__(self) -> None: self.AMFI_ALLOW_TASK_FOR_PID: bool = False self.AMFI_ALLOW_INVALID_SIGNATURE: bool = False self.AMFI_LV_ENFORCE_THIRD_PARTY: bool = False @@ -45,7 +45,7 @@ class AmfiConfigurationDetection: self._parse_oclp_configuration() - def _init_nvram_dicts(self): + def _init_nvram_dicts(self) -> None: """ Initialize the boot-args and OCLP-Settings NVRAM dictionaries """ @@ -60,7 +60,7 @@ class AmfiConfigurationDetection: self.oclp_args = oclp_args.split(" ") - def _parse_amfi_bitmask(self): + def _parse_amfi_bitmask(self) -> None: """ Parse the AMFI bitmask from boot-args See data/amfi_data.py for more information @@ -96,7 +96,7 @@ class AmfiConfigurationDetection: self.AMFI_ALLOW_INVALID_SIGNATURE = True - def _parse_amfi_boot_args(self): + def _parse_amfi_boot_args(self) -> None: """ Parse the AMFI boot-args """ @@ -121,7 +121,7 @@ class AmfiConfigurationDetection: self.AMFI_ALLOW_INVALID_SIGNATURE = True - def _parse_oclp_configuration(self): + def _parse_oclp_configuration(self) -> None: """ Parse the OCLP configuration """ @@ -130,16 +130,16 @@ class AmfiConfigurationDetection: self.SKIP_LIBRARY_VALIDATION = True - def check_config(self, level: int): + def check_config(self, level: int) -> bool: """ Check the AMFI configuration based on provided AMFI level See AmfiConfigLevel enum for valid levels Parameters: - level (int): The level of AMFI checks to check for + level (int): The level of AMFI checks to check for Returns: - bool: True if the AMFI configuration matches the level, False otherwise + bool: True if the AMFI configuration matches the level, False otherwise """ if level == AmfiConfigDetectLevel.NO_CHECK: diff --git a/resources/arguments.py b/resources/arguments.py index a0eb71f88..803fbb984 100644 --- a/resources/arguments.py +++ b/resources/arguments.py @@ -12,7 +12,7 @@ from data import model_array # Generic building args class arguments: - def __init__(self, global_constants: constants.Constants): + def __init__(self, global_constants: constants.Constants) -> None: self.constants: constants.Constants = global_constants self.args = utilities.check_cli_args() @@ -20,7 +20,7 @@ class arguments: self._parse_arguments() - def _parse_arguments(self): + def _parse_arguments(self) -> None: """ Parses arguments passed to the patcher """ @@ -46,7 +46,7 @@ class arguments: return - def _validation_handler(self): + def _validation_handler(self) -> None: """ Enter validation mode """ @@ -54,7 +54,7 @@ class arguments: validation.PatcherValidation(self.constants) - def _sys_patch_handler(self): + def _sys_patch_handler(self) -> None: """ Start root volume patching """ @@ -71,7 +71,7 @@ class arguments: sys_patch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants, None).start_patch() - def _sys_unpatch_handler(self): + def _sys_unpatch_handler(self) -> None: """ Start root volume unpatching """ @@ -79,7 +79,7 @@ class arguments: sys_patch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants, None).start_unpatch() - def _sys_patch_auto_handler(self): + def _sys_patch_auto_handler(self) -> None: """ Start root volume auto patching """ @@ -88,7 +88,7 @@ class arguments: sys_patch_auto.AutomaticSysPatch(self.constants).start_auto_patch() - def _build_handler(self): + def _build_handler(self) -> None: """ Start config building process """ @@ -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 diff --git a/resources/commit_info.py b/resources/commit_info.py index 43272bbd5..af64465fe 100644 --- a/resources/commit_info.py +++ b/resources/commit_info.py @@ -5,7 +5,7 @@ import plistlib class ParseCommitInfo: - def __init__(self, binary_path: str): + def __init__(self, binary_path: str) -> None: """ Parameters: binary_path (str): Path to binary @@ -15,7 +15,7 @@ class ParseCommitInfo: self.plist_path = self._convert_binary_path_to_plist_path() - def _convert_binary_path_to_plist_path(self): + def _convert_binary_path_to_plist_path(self) -> str or None: """ Resolve Info.plist path from binary path """ @@ -27,7 +27,7 @@ class ParseCommitInfo: return None - def generate_commit_info(self): + def generate_commit_info(self) -> tuple: """ Generate commit info from Info.plist diff --git a/resources/constants.py b/resources/constants.py index 1062ec0a2..11ef1a6c7 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 @@ -10,212 +10,217 @@ from data import os_data class Constants: - def __init__(self): + def __init__(self) -> None: # 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.3" # OpenCore-Legacy-Patcher + self.patcher_support_pkg_version: str = "0.9.2" # PatcherSupportPkg + self.copyright_date: str = "Copyright © 2020-2023 Dortania" + + # URLs + self.url_patcher_support_pkg: str = "https://github.com/dortania/PatcherSupportPkg/releases/download/" + 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.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 = "a753334 - 01-02-2023" - self.opencore_version = "0.8.8" + 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.3" # Lilu - self.whatevergreen_version = "1.6.3" # WhateverGreen - self.whatevergreen_navi_version = "1.6.3-Navi" # WhateverGreen (Navi Patch) - self.airportbcrmfixup_version = "2.1.6" # AirPortBrcmFixup - self.nvmefix_version = "1.0.9" # 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.backlight_injectorA_version = "1.0.0" # BacklightInjector iMac9,1 - 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.backlight_injectorA_version: str = "1.0.0" # BacklightInjector (iMac9,1) + 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.0" # 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, @@ -283,10 +288,6 @@ class Constants: def link_rate_driver_path(self): return self.payload_path / Path("Drivers/FixPCIeLinkRate.efi") - @property - def list_txt_path(self): - return self.payload_path / Path("List.txt") - @property def installer_sh_path(self): return self.payload_path / Path("Installer.sh") @@ -466,7 +467,7 @@ class Constants: @property def innie_path(self): - return self.payload_kexts_path / Path(f"Misc/Innie-v{self.innie_version}.zip") + return self.payload_kexts_path / Path(f"Misc/Innie-v{self.innie_version}-{self.kext_variant}.zip") @property def simplemsr_path(self): diff --git a/resources/defaults.py b/resources/defaults.py index 1d3e4246e..d001e8e01 100644 --- a/resources/defaults.py +++ b/resources/defaults.py @@ -17,7 +17,7 @@ from data import ( class GenerateDefaults: - def __init__(self, model: str, host_is_target: bool, global_constants: constants.Constants): + def __init__(self, model: str, host_is_target: bool, global_constants: constants.Constants) -> None: self.constants: constants.Constants = global_constants self.model: str = model @@ -51,7 +51,7 @@ class GenerateDefaults: self._smbios_probe() - def _general_probe(self): + def _general_probe(self) -> None: """ General probe for data """ @@ -93,7 +93,7 @@ class GenerateDefaults: self.constants.should_nuke_kdks = False - def _smbios_probe(self): + def _smbios_probe(self) -> None: """ SMBIOS specific probe """ @@ -128,7 +128,7 @@ class GenerateDefaults: self.constants.force_vmm = False - def _nvram_probe(self): + def _nvram_probe(self) -> None: """ NVRAM specific probe """ @@ -153,7 +153,7 @@ class GenerateDefaults: self.constants.custom_cpu_model_value = custom_cpu_model_value.split("%00")[0] - def _networking_probe(self): + def _networking_probe(self) -> None: """ Networking specific probe """ @@ -195,7 +195,7 @@ class GenerateDefaults: self.constants.fu_arguments = " -disable_sidecar_mac" - def _misc_hardwares_probe(self): + def _misc_hardwares_probe(self) -> None: """ Misc probe """ @@ -211,7 +211,7 @@ class GenerateDefaults: break - def _gpu_probe(self): + def _gpu_probe(self) -> None: """ Graphics specific probe """ @@ -245,6 +245,13 @@ class GenerateDefaults: device_probe.AMD.Archs.Vega, device_probe.AMD.Archs.Navi, ]: + if gpu in [ + device_probe.Intel.Archs.Ivy_Bridge, + device_probe.Intel.Archs.Haswell, + device_probe.NVIDIA.Archs.Kepler, + ]: + self.constants.disable_amfi = True + if gpu in [ device_probe.AMD.Archs.Legacy_GCN_7000, device_probe.AMD.Archs.Legacy_GCN_8000, @@ -302,7 +309,8 @@ class GenerateDefaults: # Only disable AMFI if we officially support Ventura self.constants.disable_amfi = True - # Enable BetaBlur if user hasn't disabled it - is_blur_enabled = subprocess.run(["defaults", "read", "-g", "Moraea_BlurBeta"], stdout=subprocess.PIPE).stdout.decode("utf-8").strip() - if is_blur_enabled in ["false", "0"]: - subprocess.run(["defaults", "write", "-g", "Moraea_BlurBeta", "-bool", "true"]) \ No newline at end of file + for key in ["Moraea_BlurBeta", "Amy.MenuBar2Beta"]: + # Enable BetaBlur if user hasn't disabled it + is_key_enabled = subprocess.run(["defaults", "read", "-g", key], stdout=subprocess.PIPE).stdout.decode("utf-8").strip() + if is_key_enabled not in ["false", "0"]: + subprocess.run(["defaults", "write", "-g", key, "-bool", "true"]) \ No newline at end of file diff --git a/resources/global_settings.py b/resources/global_settings.py index cdbb84ef8..de8b3db80 100644 --- a/resources/global_settings.py +++ b/resources/global_settings.py @@ -15,7 +15,7 @@ class GlobalEnviromentSettings: Library for querying and writing global enviroment settings """ - def __init__(self): + def __init__(self) -> None: self.file_name: str = ".com.dortania.opencore-legacy-patcher.plist" self.global_settings_folder: str = "/Users/Shared" self.global_settings_plist: str = f"{self.global_settings_folder}/{self.file_name}" @@ -25,7 +25,7 @@ class GlobalEnviromentSettings: self._fix_file_permission() - def read_property(self, property_name: str): + def read_property(self, property_name: str) -> str or None: """ Reads a property from the global settings file """ @@ -37,7 +37,7 @@ class GlobalEnviromentSettings: return None - def write_property(self, property_name: str, property_value): + def write_property(self, property_name: str, property_value) -> None: """ Writes a property to the global settings file """ @@ -51,7 +51,7 @@ class GlobalEnviromentSettings: logging.info("- Failed to write to global settings file") - def _generate_settings_file(self): + def _generate_settings_file(self) -> None: if Path(self.global_settings_plist).exists(): return try: @@ -60,7 +60,7 @@ class GlobalEnviromentSettings: logging.info("- Permission error: Unable to write to global settings file") - def _convert_defaults_to_global_settings(self): + def _convert_defaults_to_global_settings(self) -> None: """ Converts legacy defaults to global settings """ @@ -86,7 +86,7 @@ class GlobalEnviromentSettings: logging.info("- Permission error: Unable to delete defaults plist") - def _fix_file_permission(self): + def _fix_file_permission(self) -> None: """ Fixes file permission for log file diff --git a/resources/gui/gui_main.py b/resources/gui/gui_main.py index a614937e2..40e49a6b4 100644 --- a/resources/gui/gui_main.py +++ b/resources/gui/gui_main.py @@ -1142,6 +1142,32 @@ class wx_python_gui: ) ) i = i + self.patch_label.GetSize().height + 3 + + i += 10 + if self.constants.host_is_hackintosh is False: + self.patch_label = wx.StaticText(self.frame_modal, label="Please run 'Build and Install OpenCore' and reboot") + self.patch_label.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) + self.patch_label.SetPosition( + wx.Point( + self.subheader.GetPosition().x, + self.subheader.GetPosition().y + self.subheader.GetSize().height + 3 + i + ) + ) + self.patch_label.Centre(wx.HORIZONTAL) + i = i + self.patch_label.GetSize().height + 3 + + self.patch_label = wx.StaticText(self.frame_modal, label="to remove these errors.") + self.patch_label.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) + self.patch_label.SetPosition( + wx.Point( + self.subheader.GetPosition().x, + self.subheader.GetPosition().y + self.subheader.GetSize().height + 3 + i + ) + ) + self.patch_label.Centre(wx.HORIZONTAL) + i = i + self.patch_label.GetSize().height + 3 + + else: if self.constants.computer.oclp_sys_version and self.constants.computer.oclp_sys_date: date = self.constants.computer.oclp_sys_date.split(" @") @@ -1941,7 +1967,7 @@ class wx_python_gui: with Path(self.constants.payload_path / Path("InstallAssistant.pkg")).open("rb") as f: for chunk in chunks: status = hashlib.sha256(f.read(chunk["length"])).digest() - if not status == chunk["checksum"]: + if status != chunk["checksum"]: logging.info(f"Chunk {chunks.index(chunk) + 1} checksum status FAIL: chunk sum {binascii.hexlify(chunk['checksum']).decode()}, calculated sum {binascii.hexlify(status).decode()}") self.popup = wx.MessageDialog( self.frame, diff --git a/resources/kdk_handler.py b/resources/kdk_handler.py index d13985f30..6603b0f18 100644 --- a/resources/kdk_handler.py +++ b/resources/kdk_handler.py @@ -49,7 +49,7 @@ class KernelDebugKitObject: """ - def __init__(self, global_constants: constants.Constants, host_build: str, host_version: str, ignore_installed: bool = False, passive: bool = False): + def __init__(self, global_constants: constants.Constants, host_build: str, host_version: str, ignore_installed: bool = False, passive: bool = False) -> None: self.constants: constants.Constants = global_constants self.host_build: str = host_build # ex. 20A5384c @@ -83,7 +83,7 @@ class KernelDebugKitObject: self._get_latest_kdk() - def _get_remote_kdks(self): + def _get_remote_kdks(self) -> list or None: """ Fetches a list of available KDKs from the KdkSupportPkg API Additionally caches the list for future use, avoiding extra API calls @@ -119,7 +119,7 @@ class KernelDebugKitObject: return KDK_ASSET_LIST - def _get_latest_kdk(self, host_build: str = None, host_version: str = None): + def _get_latest_kdk(self, host_build: str = None, host_version: str = None) -> None: """ Fetches the latest KDK for the current macOS version @@ -229,7 +229,7 @@ class KernelDebugKitObject: self.success = True - def retrieve_download(self, override_path: str = ""): + def retrieve_download(self, override_path: str = "") -> network_handler.DownloadObject or None: """ Returns a DownloadObject for the KDK @@ -263,7 +263,7 @@ class KernelDebugKitObject: return network_handler.DownloadObject(self.kdk_url, kdk_download_path) - def _generate_kdk_info_plist(self, plist_path: str): + def _generate_kdk_info_plist(self, plist_path: str) -> None: """ Generates a KDK Info.plist @@ -285,7 +285,7 @@ class KernelDebugKitObject: logging.error(f"- Failed to generate KDK Info.plist: {e}") - def _local_kdk_valid(self, kdk_path: Path): + def _local_kdk_valid(self, kdk_path: Path) -> bool: """ Validates provided KDK, ensure no corruption @@ -334,7 +334,7 @@ class KernelDebugKitObject: return True - def _local_kdk_valid_legacy(self, kdk_path: Path): + def _local_kdk_valid_legacy(self, kdk_path: Path) -> bool: """ Legacy variant of validating provided KDK Uses best guess of files that should be present @@ -363,7 +363,7 @@ class KernelDebugKitObject: return True - def _local_kdk_installed(self, match: str = None, check_version: bool = False): + def _local_kdk_installed(self, match: str = None, check_version: bool = False) -> str or None: """ Checks if KDK matching build is installed If so, validates it has not been corrupted @@ -429,7 +429,7 @@ class KernelDebugKitObject: return None - def _remove_kdk(self, kdk_path: str): + def _remove_kdk(self, kdk_path: str) -> None: """ Removes provided KDK @@ -448,19 +448,18 @@ class KernelDebugKitObject: logging.warning(f"- KDK does not exist: {kdk_path}") return - rm_args = ["rm", "-f", kdk_path] - if Path(kdk_path).is_dir(): - rm_args = ["rm", "-rf", kdk_path] + rm_args = ["rm", "-rf" if Path(kdk_path).is_dir() else "-f", kdk_path] result = utilities.elevated(rm_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) if result.returncode != 0: logging.warning(f"- Failed to remove KDK: {kdk_path}") logging.warning(f"- {result.stdout.decode('utf-8')}") + return logging.info(f"- Successfully removed KDK: {kdk_path}") - def _remove_unused_kdks(self, exclude_builds: list = None): + def _remove_unused_kdks(self, exclude_builds: list = None) -> None: """ Removes KDKs that are not in use @@ -486,21 +485,20 @@ class KernelDebugKitObject: logging.info("- Cleaning unused KDKs") for kdk_folder in Path(KDK_INSTALL_PATH).iterdir(): - if kdk_folder.is_dir(): - if kdk_folder.name.endswith(".kdk") or kdk_folder.name.endswith(".pkg"): - should_remove = True - for build in exclude_builds: - if build != "": - continue - if kdk_folder.name.endswith(f"{build}.kdk") or kdk_folder.name.endswith(f"{build}.pkg"): - should_remove = False - break - if should_remove is False: + if kdk_folder.name.endswith(".kdk") or kdk_folder.name.endswith(".pkg"): + should_remove = True + for build in exclude_builds: + if build == "": continue - self._remove_kdk(kdk_folder) + if kdk_folder.name.endswith(f"_{build}.kdk") or kdk_folder.name.endswith(f"_{build}.pkg"): + should_remove = False + break + if should_remove is False: + continue + self._remove_kdk(kdk_folder) - def validate_kdk_checksum(self, kdk_dmg_path: str = None): + def validate_kdk_checksum(self, kdk_dmg_path: str = None) -> bool: """ Validates KDK DMG checksum @@ -542,11 +540,11 @@ class KernelDebugKitUtilities: """ - def __init__(self): + def __init__(self) -> None: pass - def install_kdk_pkg(self, kdk_path: Path): + def install_kdk_pkg(self, kdk_path: Path) -> bool: """ Installs provided KDK packages @@ -577,7 +575,7 @@ class KernelDebugKitUtilities: return True - def install_kdk_dmg(self, kdk_path: Path): + def install_kdk_dmg(self, kdk_path: Path) -> bool: """ Installs provided KDK disk image @@ -617,7 +615,7 @@ class KernelDebugKitUtilities: logging.info("- Successfully installed KDK") return True - def _unmount_disk_image(self, mount_point): + def _unmount_disk_image(self, mount_point) -> None: """ Unmounts provided disk image silently @@ -627,7 +625,7 @@ class KernelDebugKitUtilities: subprocess.run(["hdiutil", "detach", mount_point], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - def _create_backup(self, kdk_path: Path, kdk_info_plist: Path): + def _create_backup(self, kdk_path: Path, kdk_info_plist: Path) -> None: """ Creates a backup of the KDK diff --git a/resources/logging_handler.py b/resources/logging_handler.py index 98935024f..b834e89f5 100644 --- a/resources/logging_handler.py +++ b/resources/logging_handler.py @@ -26,7 +26,7 @@ class InitializeLoggingSupport: """ - def __init__(self): + def __init__(self) -> None: self.log_filename: str = "OpenCore-Patcher.log" self.log_filepath: Path = None @@ -43,11 +43,11 @@ class InitializeLoggingSupport: self._fix_file_permission() - def __del__(self): + def __del__(self) -> None: self._restore_original_excepthook() - def _initialize_logging_path(self): + def _initialize_logging_path(self) -> None: """ Initialize logging framework storage path """ @@ -62,7 +62,7 @@ class InitializeLoggingSupport: print(f" - Log file: {self.log_filepath}") - def _clean_log_file(self): + def _clean_log_file(self) -> None: """ Determine if log file should be cleaned @@ -87,7 +87,7 @@ class InitializeLoggingSupport: print(f"- Failed to clean log file: {e}") - def _fix_file_permission(self): + def _fix_file_permission(self) -> None: """ Fixes file permission for log file @@ -105,7 +105,7 @@ class InitializeLoggingSupport: print(result.stderr.decode("utf-8")) - def _initialize_logging_configuration(self, log_to_file: bool = True): + def _initialize_logging_configuration(self, log_to_file: bool = True) -> None: """ Initialize logging framework configuration @@ -130,7 +130,7 @@ class InitializeLoggingSupport: logging.getLogger().handlers[1].maxBytes = self.max_file_size - def _attempt_initialize_logging_configuration(self): + def _attempt_initialize_logging_configuration(self) -> None: """ Attempt to initialize logging framework configuration @@ -145,18 +145,18 @@ class InitializeLoggingSupport: self._initialize_logging_configuration(log_to_file=False) - def _implement_custom_traceback_handler(self): + def _implement_custom_traceback_handler(self) -> None: """ Reroute traceback to logging module """ - def custom_excepthook(type, value, tb): + def custom_excepthook(type, value, tb) -> None: """ Reroute traceback in main thread to logging module """ logging.error("Uncaught exception in main thread", exc_info=(type, value, tb)) - def custom_thread_excepthook(args): + def custom_thread_excepthook(args) -> None: """ Reroute traceback in spawned thread to logging module """ @@ -166,7 +166,7 @@ class InitializeLoggingSupport: threading.excepthook = custom_thread_excepthook - def _restore_original_excepthook(self): + def _restore_original_excepthook(self) -> None: """ Restore original traceback handlers """ diff --git a/resources/macos_installer_handler.py b/resources/macos_installer_handler.py index 8764b4a6a..02cb7e4ba 100644 --- a/resources/macos_installer_handler.py +++ b/resources/macos_installer_handler.py @@ -23,13 +23,19 @@ tmp_dir = tempfile.TemporaryDirectory() class InstallerCreation(): - def __init__(self): + def __init__(self) -> None: pass - def install_macOS_installer(self, download_path: str): + def install_macOS_installer(self, download_path: str) -> bool: """ Installs InstallAssistant.pkg + + Parameters: + download_path (str): Path to InstallAssistant.pkg + + Returns: + bool: True if successful, False otherwise """ logging.info("- Extracting macOS installer from InstallAssistant.pkg\n This may take some time") @@ -52,7 +58,7 @@ class InstallerCreation(): return True - def generate_installer_creation_script(self, tmp_location, installer_path, disk): + def generate_installer_creation_script(self, tmp_location: str, installer_path: str, disk: str) -> bool: """ Creates installer.sh to be piped to OCLP-Helper and run as admin @@ -67,6 +73,9 @@ class InstallerCreation(): tmp_location (str): Path to temporary directory installer_path (str): Path to InstallAssistant.pkg disk (str): Disk to install to + + Returns: + bool: True if successful, False otherwise """ additional_args = "" @@ -136,7 +145,8 @@ fi return True return False - def list_disk_to_format(self): + + def list_disk_to_format(self) -> dict: """ List applicable disks for macOS installer creation Only lists disks that are: @@ -191,14 +201,20 @@ fi return list_disks -class SeedType(enum.Enum): +class SeedType(enum.IntEnum): """ Enum for catalog types + + Variants: + DeveloperSeed: Developer Beta (Part of the Apple Developer Program) + PublicSeed: Public Beta + CustomerSeed: AppleSeed Program (Generally mirrors DeveloperSeed) + PublicRelease: Public Release """ - DeveloperSeed = 0 - PublicSeed = 1 - CustomerSeed = 2 - PublicRelease = 3 + DeveloperSeed: int = 0 + PublicSeed: int = 1 + CustomerSeed: int = 2 + PublicRelease: int = 3 class RemoteInstallerCatalog: @@ -206,7 +222,7 @@ class RemoteInstallerCatalog: Parses Apple's Software Update catalog and finds all macOS installers. """ - def __init__(self, seed_override: SeedType = SeedType.PublicRelease): + def __init__(self, seed_override: SeedType = SeedType.PublicRelease) -> None: self.catalog_url: str = self._construct_catalog_url(seed_override) @@ -214,12 +230,15 @@ class RemoteInstallerCatalog: self.available_apps_latest: dict = self._list_newest_installers_only() - def _construct_catalog_url(self, seed_type: SeedType): + def _construct_catalog_url(self, seed_type: SeedType) -> str: """ Constructs the catalog URL based on the seed type - Args: + Parameters: seed_type (SeedType): The seed type to use + + Returns: + str: The catalog URL """ @@ -237,7 +256,7 @@ class RemoteInstallerCatalog: return url - def _fetch_catalog(self): + def _fetch_catalog(self) -> dict: """ Fetches the catalog from Apple's servers @@ -257,7 +276,13 @@ class RemoteInstallerCatalog: return catalog - def _parse_catalog(self): + def _parse_catalog(self) -> dict: + """ + Parses the catalog and returns a dictionary of available installers + + Returns: + dict: Dictionary of available installers + """ available_apps: dict = {} catalog: dict = self._fetch_catalog() @@ -358,7 +383,7 @@ class RemoteInstallerCatalog: return available_apps - def _list_newest_installers_only(self): + def _list_newest_installers_only(self) -> dict: """ Returns a dictionary of the newest macOS installers only. Primarily used to avoid overwhelming the user with a list of @@ -449,11 +474,11 @@ class LocalInstallerCatalog: Finds all macOS installers on the local machine. """ - def __init__(self): + def __init__(self) -> None: self.available_apps: dict = self._list_local_macOS_installers() - def _list_local_macOS_installers(self): + def _list_local_macOS_installers(self) -> dict: """ Searches for macOS installers in /Applications @@ -537,7 +562,7 @@ class LocalInstallerCatalog: return application_list - def _parse_sharedsupport_version(self, sharedsupport_path: Path): + def _parse_sharedsupport_version(self, sharedsupport_path: Path) -> tuple: """ Determine true version of macOS installer by parsing SharedSupport.dmg This is required due to Info.plist reporting the application version, not the OS version diff --git a/resources/main.py b/resources/main.py index f52dada98..fd937d8ec 100644 --- a/resources/main.py +++ b/resources/main.py @@ -25,7 +25,7 @@ class OpenCoreLegacyPatcher: Initial entry point for starting OpenCore Legacy Patcher """ - def __init__(self): + def __init__(self) -> None: logging_handler.InitializeLoggingSupport() self.constants: constants.Constants = constants.Constants() @@ -40,7 +40,7 @@ class OpenCoreLegacyPatcher: gui_main.wx_python_gui(self.constants).main_menu(None) - def _generate_base_data(self): + def _generate_base_data(self) -> None: """ Generate base data required for the patcher to run """ diff --git a/resources/network_handler.py b/resources/network_handler.py index 2bcb025ad..db59449b8 100644 --- a/resources/network_handler.py +++ b/resources/network_handler.py @@ -32,14 +32,14 @@ class NetworkUtilities: Utilities for network related tasks, primarily used for downloading files """ - def __init__(self, url: str = None): + def __init__(self, url: str = None) -> None: self.url: str = url if self.url is None: self.url = "https://github.com" - def verify_network_connection(self): + def verify_network_connection(self) -> bool: """ Verifies that the network is available @@ -58,8 +58,13 @@ class NetworkUtilities: ): return False - def validate_link(self): - # Check if link is 404 + def validate_link(self) -> bool: + """ + Check for 404 error + + Returns: + bool: True if link is valid, False otherwise + """ try: response = SESSION.head(self.url, timeout=5, allow_redirects=True) if response.status_code == 404: @@ -93,7 +98,7 @@ class DownloadObject: """ - def __init__(self, url: str, path: str): + def __init__(self, url: str, path: str) -> None: self.url: str = url self.status: str = DownloadStatus.INACTIVE self.error_msg: str = "" @@ -121,11 +126,11 @@ class DownloadObject: self._populate_file_size() - def __del__(self): + def __del__(self) -> None: self.stop() - def download(self, display_progress: bool = False, spawn_thread: bool = True, verify_checksum: bool = False): + def download(self, display_progress: bool = False, spawn_thread: bool = True, verify_checksum: bool = False) -> None: """ Download the file @@ -152,7 +157,8 @@ class DownloadObject: self.should_checksum = verify_checksum self._download(display_progress) - def download_simple(self, verify_checksum: bool = False): + + def download_simple(self, verify_checksum: bool = False) -> str or bool: """ Alternative to download(), mimics utilities.py's old download_file() function @@ -176,7 +182,7 @@ class DownloadObject: return self.checksum.hexdigest() if self.checksum else True - def _get_filename(self): + def _get_filename(self) -> str: """ Get the filename from the URL @@ -187,7 +193,7 @@ class DownloadObject: return Path(self.url).name - def _populate_file_size(self): + def _populate_file_size(self) -> None: """ Get the file size of the file to be downloaded @@ -206,7 +212,7 @@ class DownloadObject: self.total_file_size = 0.0 - def _update_checksum(self, chunk: bytes): + def _update_checksum(self, chunk: bytes) -> None: """ Update checksum with new chunk @@ -216,7 +222,7 @@ class DownloadObject: self._checksum_storage.update(chunk) - def _prepare_working_directory(self, path: Path): + def _prepare_working_directory(self, path: Path) -> bool: """ Validates working enviroment, including free space and removing existing files @@ -253,7 +259,7 @@ class DownloadObject: return True - def _download(self, display_progress: bool = False): + def _download(self, display_progress: bool = False) -> None: """ Download the file @@ -306,7 +312,7 @@ class DownloadObject: utilities.enable_sleep_after_running() - def get_percent(self): + def get_percent(self) -> float: """ Query the download percent @@ -320,7 +326,7 @@ class DownloadObject: return self.downloaded_file_size / self.total_file_size * 100 - def get_speed(self): + def get_speed(self) -> float: """ Query the download speed @@ -331,7 +337,7 @@ class DownloadObject: return self.downloaded_file_size / (time.time() - self.start_time) - def get_time_remaining(self): + def get_time_remaining(self) -> float: """ Query the time remaining for the download @@ -345,7 +351,7 @@ class DownloadObject: return (self.total_file_size - self.downloaded_file_size) / self.get_speed() - def get_file_size(self): + def get_file_size(self) -> float: """ Query the file size of the file to be downloaded @@ -356,7 +362,7 @@ class DownloadObject: return self.total_file_size - def is_active(self): + def is_active(self) -> bool: """ Query if the download is active @@ -369,12 +375,11 @@ class DownloadObject: return False - def stop(self): + def stop(self) -> None: """ Stop the download - Returns: - boolean: If the download is active, this function will hold the thread until stopped + If the download is active, this function will hold the thread until stopped """ self.should_stop = True diff --git a/resources/os_probe.py b/resources/os_probe.py index a88f32883..7b174d293 100644 --- a/resources/os_probe.py +++ b/resources/os_probe.py @@ -10,11 +10,11 @@ class OSProbe: Library for querying OS information specific to macOS """ - def __init__(self): + def __init__(self) -> None: self.uname_data = platform.uname() - def detect_kernel_major(self): + def detect_kernel_major(self) -> int: """ Detect the booted major kernel version @@ -25,7 +25,7 @@ class OSProbe: return int(self.uname_data.release.partition(".")[0]) - def detect_kernel_minor(self): + def detect_kernel_minor(self) -> int: """ Detect the booted minor kernel version @@ -36,7 +36,7 @@ class OSProbe: return int(self.uname_data.release.partition(".")[2].partition(".")[0]) - def detect_os_version(self): + def detect_os_version(self) -> str: """ Detect the booted OS version @@ -51,7 +51,7 @@ class OSProbe: return result.stdout.decode().strip() - def detect_os_build(self, rsr: bool = False): + def detect_os_build(self, rsr: bool = False) -> str: """ Detect the booted OS build diff --git a/resources/reroute_payloads.py b/resources/reroute_payloads.py index 6f3624ec5..9877e341f 100644 --- a/resources/reroute_payloads.py +++ b/resources/reroute_payloads.py @@ -13,13 +13,13 @@ from resources import constants class RoutePayloadDiskImage: - def __init__(self, global_constants: constants.Constants): + def __init__(self, global_constants: constants.Constants) -> None: self.constants: constants.Constants = global_constants self._setup_tmp_disk_image() - def _setup_tmp_disk_image(self): + def _setup_tmp_disk_image(self) -> None: """ Initialize temp directory and mount payloads.dmg Create overlay for patcher to write to @@ -55,7 +55,7 @@ class RoutePayloadDiskImage: logging.info(f"Return Code: {output.returncode}") - def _unmount_active_dmgs(self, unmount_all_active=True): + def _unmount_active_dmgs(self, unmount_all_active=True) -> None: """ Unmounts disk images associated with OCLP diff --git a/resources/sys_patch/sys_patch_detect.py b/resources/sys_patch/sys_patch_detect.py index fb150b10e..e7c950efa 100644 --- a/resources/sys_patch/sys_patch_detect.py +++ b/resources/sys_patch/sys_patch_detect.py @@ -120,6 +120,8 @@ class DetectRootPatch: self.supports_metal = True if self.constants.detected_os >= os_data.os_data.ventura: self.amfi_must_disable = True + if (self.constants.detected_os == os_data.os_data.ventura and self.constants.detected_os_minor >= 4) or self.constants.detected_os > os_data.os_data.ventura: + self.amfi_shim_bins = True elif gpu.arch in [ device_probe.NVIDIA.Archs.Fermi, device_probe.NVIDIA.Archs.Kepler, @@ -205,11 +207,15 @@ class DetectRootPatch: self.ivy_gpu = True if self.constants.detected_os >= os_data.os_data.ventura: self.amfi_must_disable = True + if (self.constants.detected_os == os_data.os_data.ventura and self.constants.detected_os_minor >= 4) or self.constants.detected_os > os_data.os_data.ventura: + self.amfi_shim_bins = True self.supports_metal = True elif gpu.arch == device_probe.Intel.Archs.Haswell: if self.constants.detected_os > os_data.os_data.monterey: self.haswell_gpu = True self.amfi_must_disable = True + if (self.constants.detected_os == os_data.os_data.ventura and self.constants.detected_os_minor >= 4) or self.constants.detected_os > os_data.os_data.ventura: + self.amfi_shim_bins = True self.supports_metal = True elif gpu.arch == device_probe.Intel.Archs.Broadwell: if self.constants.detected_os > os_data.os_data.monterey: @@ -738,7 +744,7 @@ class DetectRootPatch: dict: Dictionary of patches to be applied from sys_patch_dict.py """ - all_hardware_patchset: dict = sys_patch_dict.SystemPatchDictionary(self.constants.detected_os, self.constants.detected_os_minor, self.constants.legacy_accel_support) + all_hardware_patchset: dict = sys_patch_dict.SystemPatchDictionary(self.constants.detected_os, self.constants.detected_os_minor, self.constants.legacy_accel_support).patchset_dict required_patches: dict = {} utilities.cls() @@ -752,13 +758,16 @@ class DetectRootPatch: if hardware_details["Graphics: Intel Sandy Bridge"] is True: required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]}) - required_patches.update({"Non-Metal ColorSync Workaround": all_hardware_patchset["Graphics"]["Non-Metal ColorSync Workaround"]}) required_patches.update({"High Sierra GVA": all_hardware_patchset["Graphics"]["High Sierra GVA"]}) required_patches.update({"WebKit Monterey Common": all_hardware_patchset["Graphics"]["WebKit Monterey Common"]}) required_patches.update({"Intel Sandy Bridge": all_hardware_patchset["Graphics"]["Intel Sandy Bridge"]}) + # Patchset breaks Display Profiles, don't install if primary GPU is AMD + if self.constants.computer.real_model not in ["Macmini5,2", "iMac12,1", "iMac12,2"]: + required_patches.update({"Non-Metal ColorSync Workaround": all_hardware_patchset["Graphics"]["Non-Metal ColorSync Workaround"]}) if hardware_details["Graphics: Intel Ivy Bridge"] is True: required_patches.update({"Metal 3802 Common": all_hardware_patchset["Graphics"]["Metal 3802 Common"]}) + required_patches.update({"Metal 3802 Common Extended": all_hardware_patchset["Graphics"]["Metal 3802 Common Extended"]}) required_patches.update({"Catalina GVA": all_hardware_patchset["Graphics"]["Catalina GVA"]}) required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]}) required_patches.update({"Big Sur OpenCL": all_hardware_patchset["Graphics"]["Big Sur OpenCL"]}) @@ -767,6 +776,7 @@ class DetectRootPatch: if hardware_details["Graphics: Intel Haswell"] is True: required_patches.update({"Metal 3802 Common": all_hardware_patchset["Graphics"]["Metal 3802 Common"]}) + required_patches.update({"Metal 3802 Common Extended": all_hardware_patchset["Graphics"]["Metal 3802 Common Extended"]}) required_patches.update({"Monterey GVA": all_hardware_patchset["Graphics"]["Monterey GVA"]}) required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]}) required_patches.update({"Intel Haswell": all_hardware_patchset["Graphics"]["Intel Haswell"]}) @@ -795,8 +805,8 @@ class DetectRootPatch: required_patches.update({"Non-Metal Enforcement": all_hardware_patchset["Graphics"]["Non-Metal Enforcement"]}) if hardware_details["Graphics: Nvidia Kepler"] is True: - required_patches.update({"Revert Metal Downgrade": all_hardware_patchset["Graphics"]["Revert Metal Downgrade"]}) required_patches.update({"Metal 3802 Common": all_hardware_patchset["Graphics"]["Metal 3802 Common"]}) + required_patches.update({"Metal 3802 Common Extended": all_hardware_patchset["Graphics"]["Metal 3802 Common Extended"]}) required_patches.update({"Catalina GVA": all_hardware_patchset["Graphics"]["Catalina GVA"]}) required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]}) required_patches.update({"Big Sur OpenCL": all_hardware_patchset["Graphics"]["Big Sur OpenCL"]}) @@ -827,7 +837,6 @@ class DetectRootPatch: del(required_patches["AMD TeraScale 2"]["Install"]["/System/Library/Extensions"]["AMDRadeonX3000.kext"]) if hardware_details["Graphics: AMD Legacy GCN"] is True or hardware_details["Graphics: AMD Legacy Polaris"] is True: - required_patches.update({"Revert Metal Downgrade": all_hardware_patchset["Graphics"]["Revert Metal Downgrade"]}) required_patches.update({"Monterey GVA": all_hardware_patchset["Graphics"]["Monterey GVA"]}) required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]}) if hardware_details["Graphics: AMD Legacy GCN"] is True: diff --git a/resources/updates.py b/resources/updates.py index a532df438..8c91d2349 100644 --- a/resources/updates.py +++ b/resources/updates.py @@ -11,14 +11,14 @@ REPO_LATEST_RELEASE_URL: str = "https://api.github.com/repos/dortania/OpenCore-L class CheckBinaryUpdates: - def __init__(self, global_constants: constants.Constants): + def __init__(self, global_constants: constants.Constants) -> None: self.constants: constants.Constants = global_constants self.binary_version = self.constants.patcher_version self.binary_version_array = [int(x) for x in self.binary_version.split(".")] - def _check_if_build_newer(self, remote_version: list = None, local_version: list = None): + def _check_if_build_newer(self, remote_version: list = None, local_version: list = None) -> bool: """ Check if the remote version is newer than the local version @@ -50,7 +50,7 @@ class CheckBinaryUpdates: return False - def _determine_local_build_type(self): + def _determine_local_build_type(self) -> str: """ Check if the local build is a GUI or TUI build @@ -64,7 +64,7 @@ class CheckBinaryUpdates: return "TUI" - def _determine_remote_type(self, remote_name: str): + def _determine_remote_type(self, remote_name: str) -> str: """ Check if the remote build is a GUI or TUI build @@ -83,7 +83,7 @@ class CheckBinaryUpdates: return "Unknown" - def check_binary_updates(self): + def check_binary_updates(self) -> dict: """ Check if any updates are available for the OpenCore Legacy Patcher binary diff --git a/resources/utilities.py b/resources/utilities.py index 84d2abf7b..335268453 100644 --- a/resources/utilities.py +++ b/resources/utilities.py @@ -422,9 +422,19 @@ def find_disk_off_uuid(uuid): return None def get_free_space(disk=None): + """ + Get free space on disk in bytes + + Parameters: + disk (str): Path to mounted disk (or folder on disk) + + Returns: + int: Free space in bytes + """ if disk is None: disk = "/" - total, used, free = shutil.disk_usage("/") + + total, used, free = shutil.disk_usage(disk) return free def grab_mount_point_from_disk(disk): diff --git a/resources/validation.py b/resources/validation.py index 709117972..1da6dd41f 100644 --- a/resources/validation.py +++ b/resources/validation.py @@ -15,7 +15,7 @@ class PatcherValidation: Primarily for Continuous Integration """ - def __init__(self, global_constants: constants.Constants): + def __init__(self, global_constants: constants.Constants) -> None: self.constants: constants.Constants = global_constants self.constants.validate = True @@ -54,7 +54,7 @@ class PatcherValidation: self._validate_sys_patch() - def _build_prebuilt(self): + def _build_prebuilt(self) -> None: """ Generate a build for each predefined model Then validate against ocvalidate @@ -73,7 +73,7 @@ class PatcherValidation: logging.info(f"Validation succeeded for predefined model: {model}") - def _build_dumps(self): + def _build_dumps(self) -> None: """ Generate a build for each predefined model Then validate against ocvalidate @@ -93,12 +93,16 @@ class PatcherValidation: logging.info(f"Validation succeeded for predefined model: {self.constants.computer.real_model}") - def _validate_root_patch_files(self, major_kernel, minor_kernel): + def _validate_root_patch_files(self, major_kernel: int, minor_kernel: int) -> None: """ Validate that all files in the patchset are present in the payload + + Parameters: + major_kernel (int): Major kernel version + minor_kernel (int): Minor kernel version """ - patchset = sys_patch_dict.SystemPatchDictionary(major_kernel, minor_kernel, self.constants.legacy_accel_support) + patchset = sys_patch_dict.SystemPatchDictionary(major_kernel, minor_kernel, self.constants.legacy_accel_support).patchset_dict host_os_float = float(f"{major_kernel}.{minor_kernel}") for patch_subject in patchset: @@ -124,7 +128,7 @@ class PatcherValidation: Path(self.constants.payload_path / f"OpenCore-Legacy-Patcher-{major_kernel}.{minor_kernel}.plist").unlink() - def _validate_sys_patch(self): + def _validate_sys_patch(self) -> None: """ Validates sys_patch modules """ @@ -160,7 +164,7 @@ class PatcherValidation: logging.info("- Skipping Root Patch File integrity validation") - def _validate_configs(self): + def _validate_configs(self) -> None: """ Validates build modules """