diff --git a/CHANGELOG.md b/CHANGELOG.md index 728a30916..8c3d47437 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## 0.3.0 - Fix Nvidia Tesla Acceleration in Monterey Beta 7+ - Add missing NVDAStartup +- Allow configuring GMUX usage for Windows + - Applicable for iGPU+dGPU MacBook Pros +- Allow usage of legacy AppleHDA + - Only use for machines that cannot achieve audio support normally + - Main usage for Macs without boot screen output ## 0.2.5 diff --git a/OpenCore-Patcher.command b/OpenCore-Patcher.command index 666a45304..1a7e231eb 100755 --- a/OpenCore-Patcher.command +++ b/OpenCore-Patcher.command @@ -249,6 +249,8 @@ system_profiler SPHardwareDataType | grep 'Model Identifier' f"Disable Thunderbolt:\tCurrently {self.constants.disable_thunderbolt}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).disable_thunderbolt, ], + [f"Set AppleALC Usage:\t\tCurrently {self.constants.set_alc_usage}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).applealc_support], + [f"Set Windows GMUX support:\tCurrently {self.constants.dGPU_switch}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).dGPU_switch_support], ] for option in options: diff --git a/Resources/Build.py b/Resources/Build.py index b4e64b0a5..849860f65 100644 --- a/Resources/Build.py +++ b/Resources/Build.py @@ -166,7 +166,7 @@ class BuildOpenCore: ("MarvelYukonEthernet.kext", self.constants.marvel_version, self.constants.marvel_path, lambda: self.model in ModelArray.EthernetMarvell), ("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path, lambda: self.model in ModelArray.EthernetBroadcom), # Legacy audio - ("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path, lambda: self.model in ModelArray.LegacyAudio or self.model in ModelArray.MacPro), + ("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path, lambda: (self.model in ModelArray.LegacyAudio or self.model in ModelArray.MacPro) and self.constants.set_alc_usage is True), # IDE patch ("AppleIntelPIIXATA.kext", self.constants.piixata_version, self.constants.piixata_path, lambda: self.model in ModelArray.IDEPatch), # Misc @@ -711,7 +711,7 @@ class BuildOpenCore: if self.constants.validate is False: print("- Adding bootmgfw.efi BlessOverride") self.config["Misc"]["BlessOverride"] += ["\\EFI\\Microsoft\\Boot\\bootmgfw.efi"] - if self.model in ModelArray.dGPU_switch: + if self.model in ModelArray.dGPU_switch and self.constants.dGPU_switch is True: print("- Allowing GMUX switching in Windows") self.config["Booter"]["Quirks"]["SignalAppleOS"] = True if self.constants.allow_fv_root is True: diff --git a/Resources/CliMenu.py b/Resources/CliMenu.py index f9b68ef9f..0c0da8fc4 100644 --- a/Resources/CliMenu.py +++ b/Resources/CliMenu.py @@ -631,3 +631,49 @@ handle acceleration tasks. print("") print(self.constants.computer) input("\nPress [ENTER] to exit: ") + + def applealc_support(self): + Utilities.cls() + Utilities.header(["Set AppleALC usage"]) + print( + """ +By default this patcher will install audio patches in-memory via +AppleALC. However for systems that cannot achieve boot screen support, +this option will allow you to install the legacy AppleHDA patch via +root patching. + +If AppleALC is detected, the Patcher will not install AppleHDA. + """ + ) + + change_menu = input("Set AppleALC usage?(y/n/q): ") + if change_menu in {"y", "Y", "yes", "Yes"}: + self.constants.set_alc_usage = True + elif change_menu in {"n", "N", "no", "No"}: + self.constants.set_alc_usage = False + elif change_menu in {"q", "Q", "Quit", "quit"}: + print("Returning to previous menu") + else: + self.applealc_support() + + def dGPU_switch_support(self): + Utilities.cls() + Utilities.header(["Set Windows GMUX support"]) + print( + """ +With OCLP, we're able to restore iGPU funbctionality on iGPU+dGPU +MacBook Pros. However for some this may not be desires, ie. eGPUs +for Windows may prefer to only work with the dGPU and eGPU present. + + """ + ) + + change_menu = input("Set Windows GMUX support?(y/n/q): ") + if change_menu in {"y", "Y", "yes", "Yes"}: + self.constants.dGPU_switch = True + elif change_menu in {"n", "N", "no", "No"}: + self.constants.dGPU_switch = False + elif change_menu in {"q", "Q", "Quit", "quit"}: + print("Returning to previous menu") + else: + self.dGPU_switch_support() diff --git a/Resources/Constants.py b/Resources/Constants.py index 424a1cb6b..da1bb0c70 100644 --- a/Resources/Constants.py +++ b/Resources/Constants.py @@ -14,7 +14,7 @@ class Constants: def __init__(self): # Patcher Versioning self.patcher_version = "0.3.0" # OpenCore-Legacy-Patcher - self.patcher_support_pkg_version = "0.1.3" # PatcherSupportPkg + self.patcher_support_pkg_version = "0.1.4" # PatcherSupportPkg # OpenCore Versioning # https://github.com/acidanthera/OpenCorePkg @@ -141,6 +141,8 @@ class Constants: self.disallow_cpufriend = False # Disable CPUFriend self.enable_wake_on_wlan = False # Allow Wake on WLAN for modern Broadcom self.disable_thunderbolt = False # Disable Thunderbolt Controller + self.set_alc_usage = True # Set AppleALC usage + self.dGPU_switch = True # Set Display GPU Switching for Windows # OS Versions ## Based off Major Kernel Version @@ -564,9 +566,14 @@ class Constants: return self.payload_apple_private_frameworks_path / Path("Brightness-Control") # Apple Extensions + # El Capitan Extensions @property def audio_path(self): return self.payload_apple_kexts_path / Path("Audio") + # High Sierra Extensions + @property + def audio_v2_path(self): + return self.payload_apple_kexts_path / Path("Audio-v2") # GPU Kexts and Bundles diff --git a/Resources/SysPatch.py b/Resources/SysPatch.py index 2f146746f..e30badca4 100644 --- a/Resources/SysPatch.py +++ b/Resources/SysPatch.py @@ -294,8 +294,11 @@ set million colour before rebooting""" Utilities.process_status(self.elevated(["chown", "-Rf", "root:wheel", f"{self.mount_private_frameworks}/DisplayServices.framework"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)) def add_audio_patch(self): - self.delete_old_binaries(SysPatchArray.DeleteVolumeControl) - self.add_new_binaries(SysPatchArray.AddVolumeControl, self.constants.audio_path) + if self.model in ["iMac7,1", "iMac8,1"]: + self.delete_old_binaries(SysPatchArray.DeleteVolumeControl) + self.add_new_binaries(SysPatchArray.AddVolumeControl, self.constants.audio_path) + else: + self.add_new_binaries(SysPatchArray.AddVolumeControlv2, self.constants.audio_v2_path) def add_wifi_patch(self): print("- Merging Wireless CoreSerices patches") @@ -668,7 +671,9 @@ set million colour before rebooting""" if self.constants.detected_os > self.constants.catalina: self.brightness_legacy = True - if self.model in ["iMac7,1", "iMac8,1"]: + if self.model in ["iMac7,1", "iMac8,1"] or (self.model in ModelArray.LegacyAudio and Utilities.check_kext_loaded("AppleALC", self.constants.detected_os) is False): + # Special hack for systems with botched GOPs + # TL;DR: No Boot Screen breaks Lilu, therefore breaking audio if self.constants.detected_os > self.constants.catalina: self.legacy_audio = True diff --git a/Resources/SysPatchArray.py b/Resources/SysPatchArray.py index 291b3239b..c2b62abc1 100644 --- a/Resources/SysPatchArray.py +++ b/Resources/SysPatchArray.py @@ -187,6 +187,10 @@ AddVolumeControl = [ "IOAudioFamily.kext", ] +AddVolumeControlv2 = [ + "AppleHDA.kext", +] + DeleteVolumeControl = [ "AppleVirtIO.kext", "AppleVirtualGraphics.kext", diff --git a/Resources/Utilities.py b/Resources/Utilities.py index 7a22d6950..298ee02b3 100644 --- a/Resources/Utilities.py +++ b/Resources/Utilities.py @@ -152,6 +152,15 @@ def amfi_status(): else: return True +def check_kext_loaded(kext_name, os_version): + if os_version > Constants.Constants().catalina: + kext_loaded = subprocess.run(["kmutil", "showloaded", "--list-only", "--variant-suffix", "release"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + else: + kext_loaded = subprocess.run(["kextstat", "-l"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + if kext_name in kext_loaded.stdout.decode(): + return True + else: + return False def check_oclp_boot(): if get_nvram("OCLP-Version", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True):