diff --git a/CHANGELOG.md b/CHANGELOG.md index b36b6564f..fc9ef55e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,9 +19,11 @@ - 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 @@ -34,7 +36,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 diff --git a/data/sys_patch_dict.py b/data/sys_patch_dict.py index 34fc0b70c..8eefd299b 100644 --- a/data/sys_patch_dict.py +++ b/data/sys_patch_dict.py @@ -1,1134 +1,1181 @@ # 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": { - "/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/Contents/MacOS": { + "IOUSBHostFamily": "12.6.2", + }, + "/System/Library/Extensions/IOUSBHostFamily.kext/Contents/PlugIns": { + "AppleUSBEHCI.kext": "12.6.2", + "AppleUSBHub.kext": "12.6.2", + }, + }, + } + }, + } \ No newline at end of file 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 97dedc864..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 """ 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 4066912cc..476c1ffd1 100644 --- a/resources/constants.py +++ b/resources/constants.py @@ -10,7 +10,7 @@ from data import os_data class Constants: - def __init__(self): + def __init__(self) -> None: # Patcher Versioning self.patcher_version: str = "0.6.2" # OpenCore-Legacy-Patcher self.patcher_support_pkg_version: str = "0.8.6" # PatcherSupportPkg @@ -18,11 +18,9 @@ class Constants: # URLs self.url_patcher_support_pkg: str = "https://github.com/dortania/PatcherSupportPkg/releases/download/" - self.nightly_url_patcher_support_pkg: str = "https://nightly.link/dortania/PatcherSupportPkg/workflows/build/master/" self.discord_link: str = "https://discord.gg/rqdPgH8xSN" self.guide_link: str = "https://dortania.github.io/OpenCore-Legacy-Patcher/" self.repo_link: str = "https://github.com/dortania/OpenCore-Legacy-Patcher" - self.repo_link_latest: str = f"{self.repo_link}/releases/tag/{self.patcher_version}" self.installer_pkg_url: str = f"{self.repo_link}/releases/download/{self.patcher_version}/AutoPkg-Assets.pkg" self.installer_pkg_url_nightly: str = "http://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython/main/AutoPkg-Assets.pkg.zip" @@ -62,10 +60,10 @@ class Constants: 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 + 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: str = "1.0.2" # CatalinaBCM5701Ethernet @@ -289,10 +287,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") diff --git a/resources/defaults.py b/resources/defaults.py index 427e9c30c..646f475a8 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 """ 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 be27e490a..86ee48e20 100644 --- a/resources/gui/gui_main.py +++ b/resources/gui/gui_main.py @@ -1941,7 +1941,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..a024b0992 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 @@ -460,7 +460,7 @@ class KernelDebugKitObject: 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 @@ -500,7 +500,7 @@ class KernelDebugKitObject: 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 +542,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 +577,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 +617,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 +627,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 868bec47c..6746be72f 100644 --- a/resources/sys_patch/sys_patch_detect.py +++ b/resources/sys_patch/sys_patch_detect.py @@ -744,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() @@ -758,10 +758,12 @@ 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"]}) 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/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 """